merge develop
This commit is contained in:
commit
2badd51032
|
@ -40,6 +40,7 @@ class PhpGroup {
|
|||
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
||||
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
||||
static ChangeNotifica changeNotifica = ChangeNotifica();
|
||||
static UpdateIDE updateIDE = UpdateIDE();
|
||||
static RespondeVinculo resopndeVinculo = RespondeVinculo();
|
||||
static ChangePass changePass = ChangePass();
|
||||
static ChangePanic changePanic = ChangePanic();
|
||||
|
@ -581,6 +582,41 @@ class ChangeNotifica {
|
|||
}
|
||||
}
|
||||
|
||||
class UpdateIDE {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
||||
final String devUUID = StorageUtil().devUUID;
|
||||
final String userUUID = StorageUtil().userUUID;
|
||||
final String cliID = StorageUtil().cliUUID;
|
||||
final String newIde = StorageUtil().userDevUUID;
|
||||
const String atividade = 'updVisitado';
|
||||
|
||||
return ApiManager.instance.makeApiCall(
|
||||
callName: 'changeNotifica',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
params: {
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'newIde': newIde,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UpdToken {
|
||||
Future<ApiCallResponse> call() async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart';
|
||||
|
@ -35,15 +37,11 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
String? Function(BuildContext, String?)? personNameTextControllerValidator;
|
||||
String? _personNameTextControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'3hqg8buh',
|
||||
);
|
||||
return FFLocalizations.of(context).getText('3hqg8buh');
|
||||
}
|
||||
|
||||
if (val.length > 80) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'l0b0zr50',
|
||||
);
|
||||
return FFLocalizations.of(context).getText('l0b0zr50');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -54,31 +52,26 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
String? Function(BuildContext, String?)? dateTimeTextControllerValidator;
|
||||
String? _dateTimeTextControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'uzefkuf9',
|
||||
);
|
||||
return FFLocalizations.of(context).getText('uzefkuf9');
|
||||
}
|
||||
|
||||
DateTime selectedDateTime;
|
||||
DateTime currentDateTime = DateTime.now();
|
||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(val);
|
||||
|
||||
DateTime currentDateTime = DateTime.now().add(const Duration(minutes: 59));
|
||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||
try {
|
||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(val);
|
||||
log('dateTimeTextController.text: ${dateTimeTextController.text}');
|
||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||
} catch (e) {
|
||||
return FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Formato de data/hora inválido',
|
||||
enText: 'Invalid date/time format',
|
||||
ptText: 'Formato de data inválido',
|
||||
enText: 'Invalid date format',
|
||||
);
|
||||
}
|
||||
|
||||
if (selectedDateTime.isBefore(currentDateTime)) {
|
||||
return FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'A data/hora selecionada é inválida',
|
||||
enText: 'The selected date/time is invalid',
|
||||
ptText: 'A data devem ser, no mínimo, uma (1) hora à frente.',
|
||||
enText: 'The date must be at least one (1) hour ahead.',
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -96,7 +89,8 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
personNameTextController ??= TextEditingController();
|
||||
personNameFocusNode ??= FocusNode();
|
||||
|
||||
dateTimeTextController ??= TextEditingController();
|
||||
dateTimeTextController ??= TextEditingController(
|
||||
text: DateFormat('dd/MM/yyyy HH:mm:ss').format(DateTime.now().add(const Duration(days: 1))));
|
||||
dateTimeFocusNode ??= FocusNode();
|
||||
|
||||
notesTextController ??= TextEditingController();
|
||||
|
@ -105,6 +99,18 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
init();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
personNameFocusNode?.dispose();
|
||||
personNameTextController?.dispose();
|
||||
|
||||
dateTimeFocusNode?.dispose();
|
||||
dateTimeTextController?.dispose();
|
||||
|
||||
notesFocusNode?.dispose();
|
||||
notesTextController?.dispose();
|
||||
}
|
||||
|
||||
bool isFormValid() {
|
||||
if (personNameTextController.text == '' || personNameTextController.text.length > 80) {
|
||||
return false;
|
||||
|
@ -115,7 +121,7 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
}
|
||||
|
||||
DateTime selectedDateTime;
|
||||
DateTime currentDateTime = DateTime.now();
|
||||
DateTime currentDateTime = DateTime.now().add(const Duration(minutes: 59));
|
||||
selectedDateTime = DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||
|
||||
try {
|
||||
|
@ -140,16 +146,4 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel<ScheduleProvisi
|
|||
ownerUUID = (await StorageHelper.instance.get(SQLiteStorageKey.ownerUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
setState?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
personNameFocusNode?.dispose();
|
||||
personNameTextController?.dispose();
|
||||
|
||||
dateTimeFocusNode?.dispose();
|
||||
dateTimeTextController?.dispose();
|
||||
|
||||
notesFocusNode?.dispose();
|
||||
notesTextController?.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,7 +289,10 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
labelText: FFLocalizations.of(context).getText('8zgsw5so'),
|
||||
labelText: FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Data de Validade da Visita",
|
||||
enText: "Visit Validity Date",
|
||||
),
|
||||
labelStyle: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
|
@ -432,7 +435,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
});
|
||||
}
|
||||
setState(() {
|
||||
model.datePicked = model.datePicked?.add(const Duration(hours: 3));
|
||||
model.datePicked = model.datePicked;
|
||||
model.dateTimeTextController?.text = dateTimeFormat(
|
||||
"dd/MM/yyyy HH:mm:ss",
|
||||
model.datePicked,
|
||||
|
@ -562,7 +565,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
: () async {
|
||||
try {
|
||||
model.provVisitSchedule = await PhpGroup.postProvVisitSchedulingCall.call(
|
||||
data: model.dateTimeTextController.text,
|
||||
data: DateFormat('dd/MM/yyyy HH:mm:ss').format(DateFormat('dd/MM/yyyy HH:mm:ss').parse(model.dateTimeTextController.text).add(const Duration(hours: 3))),
|
||||
motivo: model.notesTextController.text,
|
||||
nome: model.personNameTextController.text,
|
||||
proID: model.ownerUUID,
|
||||
|
@ -593,8 +596,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
setState(() {});
|
||||
} catch (e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed(
|
||||
"processRequest.php", "", "Cadastrar Visita Provisória", e, s);
|
||||
LogUtil.requestAPIFailed("processRequest.php", "", "Cadastrar Visita Provisória", e, s);
|
||||
}
|
||||
},
|
||||
showLoadingIndicator: true,
|
||||
|
|
|
@ -95,9 +95,7 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
labelText: FFLocalizations.of(context).getText(
|
||||
'cjlpru1m' /* Procure pelo documento do visi... */,
|
||||
),
|
||||
labelText: FFLocalizations.of(context).getText('cjlpru1m'),
|
||||
labelStyle: FlutterFlowTheme.of(context).labelMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
|
@ -105,59 +103,40 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).accent1,
|
||||
width: 0.5,
|
||||
),
|
||||
borderSide: BorderSide(color: FlutterFlowTheme.of(context).accent1, width: 0.5),
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(15.0),
|
||||
bottomRight: Radius.circular(15.0),
|
||||
topLeft: Radius.circular(15.0),
|
||||
topRight: Radius.circular(15.0),
|
||||
),
|
||||
topRight: Radius.circular(15.0)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).primary,
|
||||
width: 0.5,
|
||||
),
|
||||
borderSide: BorderSide(color: FlutterFlowTheme.of(context).primary, width: 0.5),
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(15.0),
|
||||
bottomRight: Radius.circular(15.0),
|
||||
topLeft: Radius.circular(15.0),
|
||||
topRight: Radius.circular(15.0),
|
||||
),
|
||||
topRight: Radius.circular(15.0)),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).error,
|
||||
width: 0.5,
|
||||
),
|
||||
borderSide: BorderSide(color: FlutterFlowTheme.of(context).error, width: 0.5),
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(15.0),
|
||||
bottomRight: Radius.circular(15.0),
|
||||
topLeft: Radius.circular(15.0),
|
||||
topRight: Radius.circular(15.0),
|
||||
),
|
||||
topRight: Radius.circular(15.0)),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context).error,
|
||||
width: 0.5,
|
||||
),
|
||||
borderSide: BorderSide(color: FlutterFlowTheme.of(context).error, width: 0.5),
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(15.0),
|
||||
bottomRight: Radius.circular(15.0),
|
||||
topLeft: Radius.circular(15.0),
|
||||
topRight: Radius.circular(15.0),
|
||||
),
|
||||
topRight: Radius.circular(15.0)),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
prefixIcon: Icon(
|
||||
Icons.search_outlined,
|
||||
color: FlutterFlowTheme.of(context).accent1,
|
||||
),
|
||||
prefixIcon: Icon(Icons.search_outlined, color: FlutterFlowTheme.of(context).accent1),
|
||||
),
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
|
@ -166,9 +145,7 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
),
|
||||
keyboardType: const TextInputType.numberWithOptions(signed: true),
|
||||
validator: _model.textControllerValidator.asValidator(context),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
],
|
||||
inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))],
|
||||
),
|
||||
),
|
||||
if (_model.visitors.isNotEmpty && _model.visitors.isNotEmpty)
|
||||
|
@ -179,9 +156,7 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'9coywebh' /* Visitantes encontrados */,
|
||||
),
|
||||
FFLocalizations.of(context).getText('9coywebh'),
|
||||
style: FlutterFlowTheme.of(context).labelMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
|
@ -265,10 +240,7 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
padding: const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
valueOrDefault<String>(
|
||||
getJsonField(
|
||||
visitorItem,
|
||||
r'''$.VTE_NOME''',
|
||||
)?.toString(),
|
||||
getJsonField(visitorItem, r'''$.VTE_NOME''')?.toString(),
|
||||
'NOT FOUND',
|
||||
),
|
||||
style: FlutterFlowTheme.of(context).bodyLarge.override(
|
||||
|
@ -286,11 +258,8 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
borderRadius: 20.0,
|
||||
borderWidth: 1.0,
|
||||
buttonSize: 40.0,
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: FlutterFlowTheme.of(context).customColor6,
|
||||
size: 20.0,
|
||||
),
|
||||
icon: Icon(Icons.close,
|
||||
color: FlutterFlowTheme.of(context).customColor6, size: 20.0),
|
||||
onPressed: () async {
|
||||
_model.removeFromVisitors(visitorItem);
|
||||
_model.removeFromDocs(docItem);
|
||||
|
@ -312,9 +281,7 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
return Container(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
),
|
||||
decoration: BoxDecoration(color: FlutterFlowTheme.of(context).primaryBackground),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -326,14 +293,8 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
children: [
|
||||
FFButtonWidget(
|
||||
onPressed: MediaQuery.of(context).viewInsets.bottom > 0
|
||||
? () async {
|
||||
await addVisitor(context);
|
||||
|
||||
safeSetState(() {});
|
||||
}
|
||||
: () async {
|
||||
await sendVisitors(context);
|
||||
},
|
||||
? () async => await addVisitor(context).whenComplete(safeSetState(() {}))
|
||||
: () async => await sendVisitors(context),
|
||||
text: MediaQuery.of(context).viewInsets.bottom > 0
|
||||
? FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Add',
|
||||
|
@ -357,23 +318,17 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).titleSmallFamily),
|
||||
),
|
||||
elevation: 3.0,
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.transparent,
|
||||
width: 1.0,
|
||||
),
|
||||
borderSide: const BorderSide(color: Colors.transparent, width: 1.0),
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(15),
|
||||
bottomRight: Radius.circular(15),
|
||||
topLeft: Radius.circular(15),
|
||||
topRight: Radius.circular(15),
|
||||
),
|
||||
topRight: Radius.circular(15)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30.0,
|
||||
)
|
||||
const SizedBox(height: 30.0)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -381,9 +336,7 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
}
|
||||
|
||||
Future<void> sendVisitors(BuildContext context) async {
|
||||
await widget.getVisitors?.call(
|
||||
_model.visitors,
|
||||
);
|
||||
await widget.getVisitors?.call(_model.visitors);
|
||||
log('() => docs: ${_model.docs}');
|
||||
await widget.getDocs?.call(_model.docs);
|
||||
context.pop();
|
||||
|
@ -394,22 +347,16 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
_model.textController?.text = _model.textController.text;
|
||||
_model.textController?.selection = TextSelection.collapsed(offset: _model.textController!.text.length);
|
||||
});
|
||||
_model.getVisitorByDoc = await PhpGroup.getVisitorByDocCall.call(
|
||||
documento: _model.textController.text,
|
||||
);
|
||||
_model.getVisitorByDoc =
|
||||
await PhpGroup.getVisitorByDocCall.call(documento: _model.textController.text.replaceFirst(RegExp(r'^0+'), ''));
|
||||
|
||||
if (PhpGroup.getVisitorByDocCall.vistanteId(
|
||||
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
||||
) !=
|
||||
'0' &&
|
||||
if (PhpGroup.getVisitorByDocCall.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) != '0' &&
|
||||
PhpGroup.getVisitorByDocCall.error((_model.getVisitorByDoc?.jsonBody ?? '')) == false &&
|
||||
PhpGroup.getVisitorByDocCall.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) != null) {
|
||||
String newDoc = _model.textController.text;
|
||||
bool existDoc = _model.docs.contains(newDoc);
|
||||
if (existDoc == false) {
|
||||
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
|
||||
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
||||
));
|
||||
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante((_model.getVisitorByDoc?.jsonBody ?? '')));
|
||||
safeSetState(() {});
|
||||
_model.addToDocs(_model.textController.text);
|
||||
safeSetState(() {});
|
||||
|
@ -426,9 +373,7 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State<VisitorSearc
|
|||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
child: VisitorNotFoundComponentWidget(
|
||||
doc: _model.textController.text,
|
||||
),
|
||||
child: VisitorNotFoundComponentWidget(doc: _model.textController.text),
|
||||
);
|
||||
},
|
||||
).then((value) => safeSetState(() {
|
||||
|
|
|
@ -98,6 +98,45 @@ class PreferencesPageModel with ChangeNotifier {
|
|||
showAlertDialog(context, title, content, onConfirm);
|
||||
}
|
||||
|
||||
Future<void> toggleIdentification(BuildContext context) async {
|
||||
final String title = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Atualizar Identificador de Acesso',
|
||||
enText: 'Update Access Identifier',
|
||||
);
|
||||
final String content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Tem certeza que deseja habilitar seu dispositivo para acesso?',
|
||||
enText: 'Are you sure you want to enable your device for access?',
|
||||
);
|
||||
onConfirm() async {
|
||||
String content;
|
||||
await PhpGroup.updateIDE.call().then((value) async {
|
||||
if (value.jsonBody['error'] == false) {
|
||||
notifyListeners();
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Atualização do identificador de acesso realizada com sucesso',
|
||||
enText: 'Access identifier updated successfully',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content);
|
||||
} else {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao atualizar identificador de acesso',
|
||||
enText: 'Error updating access identifier',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||
}
|
||||
}).catchError((e, s) {
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Erro ao atualizar identificador de acesso',
|
||||
enText: 'Error updating access identifier',
|
||||
);
|
||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||
}).whenComplete(() => notifyListeners());
|
||||
context.pop();
|
||||
}
|
||||
|
||||
showAlertDialog(context, title, content, onConfirm);
|
||||
}
|
||||
|
||||
Future<void> toggleAccess(BuildContext context) async {
|
||||
onChange(String key) async {
|
||||
await StorageHelper.instance.set(SecureStorageKey.accessPass.value, key, Storage.SecureStorage);
|
||||
|
|
|
@ -75,7 +75,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
Expanded(
|
||||
flex: 2,
|
||||
child: ListView.builder(
|
||||
itemCount: 7, // Assuming 7 items for simplicity
|
||||
itemCount: 8,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
|
@ -117,6 +117,15 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
);
|
||||
break;
|
||||
case 2:
|
||||
icon = Icons.info;
|
||||
onPressed = () => model.toggleIdentification(context);
|
||||
isEnabled = false;
|
||||
content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Atualize suas informações de identificação de acesso.',
|
||||
enText: 'Update your access identification information.',
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
icon = Icons.notifications;
|
||||
onPressed = () => model.toggleNotify(context);
|
||||
isEnabled = model.isNotify;
|
||||
|
@ -125,7 +134,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Enable to receive your access notification',
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
icon = Icons.lock;
|
||||
onPressed = () => model.toggleAccess(context);
|
||||
isEnabled = model.isAccess;
|
||||
|
@ -134,7 +143,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Enable to enter an access credential for the QRCode',
|
||||
);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
icon = Icons.lock_clock_sharp;
|
||||
onPressed = () => model.togglePanic(context);
|
||||
isEnabled = model.isPanic;
|
||||
|
@ -143,7 +152,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Enable to enter a panic credential for the QRCode',
|
||||
);
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
icon = Icons.landscape;
|
||||
onPressed = () {
|
||||
model.localUnlink(context);
|
||||
|
@ -154,7 +163,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Enable to unlink from the selected location',
|
||||
);
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
icon = Icons.delete;
|
||||
onPressed = () => model.deleteAccount(context);
|
||||
isEnabled = false;
|
||||
|
@ -163,7 +172,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
|||
enText: 'Delete your account and all associated data permanently.',
|
||||
);
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
icon = Icons.logout;
|
||||
onPressed = () => model.logout(context);
|
||||
isEnabled = false;
|
||||
|
|
Loading…
Reference in New Issue