import 'package:f_r_e_hub/backend/api_requests/api_calls.dart'; import 'package:f_r_e_hub/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart'; import 'package:f_r_e_hub/flutter_flow/flutter_flow_theme.dart'; import 'package:f_r_e_hub/flutter_flow/flutter_flow_util.dart'; import 'package:flutter/material.dart'; import 'package:local_auth/local_auth.dart'; class PreferencesPageModel with ChangeNotifier { final unfocusNode = FocusNode(); final LocalAuthentication auth = LocalAuthentication(); Future toggleFingerprint() async { FFAppState().checkBiometrics().then((value) => FFAppState().authenticateBiometric().then( (value) => FFAppState().fingerprint = !FFAppState().fingerprint).whenComplete(() => notifyListeners())); } void enablePerson(BuildContext context) { notifyListeners(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text(FFAppState().userDevUUID, style: TextStyle(color: FlutterFlowTheme.of(context).info) ), backgroundColor: FlutterFlowTheme.of(context).primary, duration: const Duration(seconds: 1), behavior: SnackBarBehavior.floating, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), ), ), ); } void toggleNotify() { FFAppState().notify = !FFAppState().notify; PhpGroup.changeNotifica.call( userUUID: FFAppState().userUUID, devUUID: FFAppState().devUUID, cliID: FFAppState().cliUUID, atividade: 'updVisitado', notifica: FFAppState().notify ? 'S' : 'N', ); notifyListeners(); } void localLogout(){ PhpGroup.resopndeVinculo.call( userUUID: FFAppState().userUUID, devUUID: FFAppState().devUUID, cliID: FFAppState().cliUUID, tarefa: 'I', ); notifyListeners(); } void deleteAccount(BuildContext context) { FFAppState().deleteAll(); FFAppState().isLogged = false; context.goNamed( 'welcomePage', extra: { kTransitionInfoKey: const TransitionInfo( hasTransition: true, transitionType: PageTransitionType.scale, alignment: Alignment.bottomCenter, ), }, ); } Future togglePass(BuildContext context) async { FFAppState().pass = true; notifyListeners(); await showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent, useSafeArea: true, context: context, builder: (context) { return Padding( padding: MediaQuery.viewInsetsOf(context), child: PassKeyTemplateWidget( toggleActionStatus: (key) async { FFAppState().accessPass = key; notifyListeners(); debugPrint('key: $key'); // PhpGroup.changePass.call( // userUUID: FFAppState().userUUID, // devUUID: FFAppState().devUUID, // cliID: FFAppState().cliUUID, // atividade: 'updVisitado', // newSenha: FFAppState().accessPass, // ); }, ), ); }, ); FFAppState().pass = false; notifyListeners(); } @override void dispose() { unfocusNode.dispose(); super.dispose(); } }