From 73ea7d5641ec6c484da02e41ce6b541088c18829 Mon Sep 17 00:00:00 2001 From: jantunemesssias Date: Mon, 3 Feb 2025 09:02:23 -0300 Subject: [PATCH] format --- integration_test/auth_test.dart | 34 +- integration_test/example_test.dart | 1 + integration_test/test_bundle.dart | 3 +- integration_test/utils_test.dart | 15 +- integration_test/vehicle_test.dart | 29 +- .../shared_components_atoms/custom_input.dart | 1 - .../shared_components_atoms/tabview.dart | 3 +- ..._arrow_linked_locals_component_widget.dart | 80 +- .../card_item_template_component_widget.dart | 32 +- .../details_component_widget.dart | 27 +- ...ot_password_template_component_widget.dart | 118 ++- .../provisional_schedule_template_model.dart | 1 - .../sign_in_template_component_widget.dart | 839 +++++++++++++----- lib/core/meta/anotations.dart | 1 - .../backend/schema/structs/device_struct.dart | 1 - .../widgets/provisional_filter_modal.dart | 1 - .../home/presentation/pages/home_page.dart | 6 +- .../locals_remote_data_source.dart | 27 +- .../repositories/locals_repository_impl.dart | 6 +- lib/features/local/utils/local_util.dart | 120 ++- .../data_sources/menu_local_data_source.dart | 34 +- .../repositories/menu_repository_impl.dart | 30 +- .../module/domain/entities/license.dart | 32 +- .../notification/deep_link_service.dart | 3 +- lib/flutter_flow/nav/nav.dart | 150 +++- lib/initialization.dart | 1 - lib/main.dart | 13 +- .../forgot_password_screen.dart | 111 ++- lib/pages/pets_page/pets_page_model.dart | 1 - lib/pages/pets_page/pets_page_widget.dart | 2 - .../reception_page/reception_page_widget.dart | 1 - .../vehicle_register_screen.dart | 37 +- .../vehicle_update_screen.dart | 34 +- .../vehicles_on_the_property.dart | 32 +- lib/pages/visits_on_the_property/model.dart | 10 +- lib/shared/constants/index.dart | 1 + lib/shared/extensions/string_extensions.dart | 3 +- lib/shared/utils/license_util.dart | 3 +- 38 files changed, 1254 insertions(+), 589 deletions(-) diff --git a/integration_test/auth_test.dart b/integration_test/auth_test.dart index b1105a8b..e353d565 100644 --- a/integration_test/auth_test.dart +++ b/integration_test/auth_test.dart @@ -6,7 +6,8 @@ class AuthenticationTest { 'Sign-In with fuzzed emails', (PatrolIntegrationTester tester) async { $ = tester; - $.tester.printToConsole('Authentication Test - Sign-In with fuzzed emails'); + $.tester + .printToConsole('Authentication Test - Sign-In with fuzzed emails'); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); final Fuzzer fuzzer = Fuzzer( @@ -32,7 +33,8 @@ class AuthenticationTest { ], iterations: 2, ); - Map concat(String username, String domain, String password) { + Map concat( + String username, String domain, String password) { return { 'emailTextFormField': '$username@$domain.test', 'passwordTextFormField': password, @@ -61,7 +63,8 @@ class AuthenticationTest { 'Sign-In with email_app@exemplo.com', (PatrolIntegrationTester tester) async { $ = tester; - $.tester.printToConsole('Authentication Test - Sign-In with email_app@exemplo.com'); + $.tester.printToConsole( + 'Authentication Test - Sign-In with email_app@exemplo.com'); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); final Map credentials = { @@ -82,7 +85,8 @@ class AuthenticationTest { 'Sign Up - credenciais já registradas', (PatrolIntegrationTester tester) async { $ = tester; - $.tester.printToConsole('Authentication Test - Sign-Up: credenciais já registradas'); + $.tester.printToConsole( + 'Authentication Test - Sign-Up: credenciais já registradas'); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); final Map credentials = { @@ -102,7 +106,8 @@ class AuthenticationTest { 'Sign Up - credenciais novas', (PatrolIntegrationTester tester) async { $ = tester; - $.tester.printToConsole('Authentication Test - Sign-Up: credenciais novas'); + $.tester + .printToConsole('Authentication Test - Sign-Up: credenciais novas'); final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget); @@ -135,7 +140,8 @@ class AuthenticationTest { ], iterations: 2, ); - Map concat(String name, String username, String domain, String password) { + Map concat( + String name, String username, String domain, String password) { return { 'nameTextFormField': name, 'emailTextFormField': '$username@$domain.test', @@ -168,7 +174,8 @@ class AuthenticationTest { 'Deslogar da Conta', (PatrolIntegrationTester tester) async { $ = tester; - $.tester.printToConsole('Authentication Test - Sign-Out: Deslogar da Conta'); + $.tester.printToConsole( + 'Authentication Test - Sign-Out: Deslogar da Conta'); await _loggedWithMultiLocalsAccount($); await $.pumpWidget(const App()); @@ -179,7 +186,9 @@ class AuthenticationTest { await $.waitUntilVisible($(MenuListView)); - await $(Icons.exit_to_app).waitUntilVisible().tap(settlePolicy: SettlePolicy.trySettle); + await $(Icons.exit_to_app) + .waitUntilVisible() + .tap(settlePolicy: SettlePolicy.trySettle); await Future.delayed(const Duration(milliseconds: 500)); }, @@ -203,7 +212,8 @@ class AuthenticationTest { Future.delayed(Duration(seconds: 3)); await $.pump(Duration(seconds: 3)); await $.pumpAndSettle(); - final PatrolFinder forgotPassword = await $(#ForgotPasswordScreen).waitUntilVisible(); + final PatrolFinder forgotPassword = + await $(#ForgotPasswordScreen).waitUntilVisible(); expect(forgotPassword, findsOneWidget); }); } @@ -230,7 +240,8 @@ Future _enterCredentials( } } -Future _submit(String key, PatrolIntegrationTester $, PatrolFinder throwsException) async { +Future _submit( + String key, PatrolIntegrationTester $, PatrolFinder throwsException) async { await $(ValueKey(key)) // .waitUntilVisible() .tap(); @@ -248,5 +259,6 @@ Future _submit(String key, PatrolIntegrationTester $, PatrolFinder throwsE String _generateRandomString(int length) { const chars = 'abcdefghijklmnopqrstuvwxyz0123456789'; final rand = Random(); - return List.generate(length, (index) => chars[rand.nextInt(chars.length)]).join(); + return List.generate(length, (index) => chars[rand.nextInt(chars.length)]) + .join(); } diff --git a/integration_test/example_test.dart b/integration_test/example_test.dart index e69de29b..8b137891 100644 --- a/integration_test/example_test.dart +++ b/integration_test/example_test.dart @@ -0,0 +1 @@ + diff --git a/integration_test/test_bundle.dart b/integration_test/test_bundle.dart index 52ae7570..55d38e30 100644 --- a/integration_test/test_bundle.dart +++ b/integration_test/test_bundle.dart @@ -59,7 +59,8 @@ Future main() async { // Maybe somewhat counterintuitively, this callback runs *after* the calls // to group() below. final topLevelGroup = Invoker.current!.liveTest.groups.first; - final dartTestGroup = createDartTestGroup(topLevelGroup, + final dartTestGroup = createDartTestGroup( + topLevelGroup, tags: null, excludeTags: null, ); diff --git a/integration_test/utils_test.dart b/integration_test/utils_test.dart index 1f1bedc2..1ed65d0a 100644 --- a/integration_test/utils_test.dart +++ b/integration_test/utils_test.dart @@ -1,6 +1,7 @@ part of 'app_test.dart'; -Future _loggedWithMultiLocalsAccount(PatrolIntegrationTester $, [bool forceLinkedLocal = true]) async { +Future _loggedWithMultiLocalsAccount(PatrolIntegrationTester $, + [bool forceLinkedLocal = true]) async { await _init($); await StorageHelper() // .set(SecureStorageKey.isLogged.value, 'true'); @@ -20,13 +21,15 @@ Future _loggedWithMultiLocalsAccount(PatrolIntegrationTester $, [bool forc if (forceLinkedLocal == true) { await StorageHelper().set(ProfileStorageKey.clientUUID.key, '7'); await StorageHelper().set(ProfileStorageKey.ownerUUID.key, '7'); - await StorageHelper().set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO'); + await StorageHelper() + .set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO'); await PhpGroup.resopndeVinculo.call(tarefa: 'A'); await LicenseRepositoryImpl().resetLicense(); } } -Future _loggedWithSomeoneLocalAccount(PatrolIntegrationTester $, [bool forceLinkedLocal = true]) async { +Future _loggedWithSomeoneLocalAccount(PatrolIntegrationTester $, + [bool forceLinkedLocal = true]) async { await _init($); await StorageHelper() // .set(SecureStorageKey.isLogged.value, 'true'); @@ -46,7 +49,8 @@ Future _loggedWithSomeoneLocalAccount(PatrolIntegrationTester $, [bool for if (forceLinkedLocal == true) { await StorageHelper().set(ProfileStorageKey.clientUUID.key, '7'); await StorageHelper().set(ProfileStorageKey.ownerUUID.key, '7'); - await StorageHelper().set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO'); + await StorageHelper() + .set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO'); await PhpGroup.resopndeVinculo.call(tarefa: 'A'); await LicenseRepositoryImpl().resetLicense(); } @@ -95,7 +99,8 @@ Future _navigateToSignUp(PatrolIntegrationTester $) async { } Future _navigateBackUsingSystemGesture() async => - IntegrationTestWidgetsFlutterBinding.instance.keyboard.isLogicalKeyPressed(LogicalKeyboardKey.escape); + IntegrationTestWidgetsFlutterBinding.instance.keyboard + .isLogicalKeyPressed(LogicalKeyboardKey.escape); Future _initializeTracking() async { print('Requesting tracking authorization...'); diff --git a/integration_test/vehicle_test.dart b/integration_test/vehicle_test.dart index 1fa43131..6e89c69d 100644 --- a/integration_test/vehicle_test.dart +++ b/integration_test/vehicle_test.dart @@ -41,8 +41,9 @@ class VehicleTest { expect(listViewFinder, findsOneWidget); - final PatrolFinder entriesFinder = - await $(listViewFinder).$(CardItemTemplateComponentWidget).waitUntilVisible(); + final PatrolFinder entriesFinder = await $(listViewFinder) + .$(CardItemTemplateComponentWidget) + .waitUntilVisible(); expect(entriesFinder, findsWidgets); final int entriesCount = entriesFinder.evaluate().length; @@ -51,13 +52,16 @@ class VehicleTest { for (int i = 0; i < entriesCount; i++) { await $(entriesFinder.at(i)).scrollTo(); - await $(entriesFinder.at(i)).waitUntilVisible(timeout: const Duration(seconds: 1)).tap( + await $(entriesFinder.at(i)) + .waitUntilVisible(timeout: const Duration(seconds: 1)) + .tap( settleTimeout: const Duration(seconds: 1), settlePolicy: SettlePolicy.noSettle, ); await $.pumpAndSettle(duration: Duration(milliseconds: 500)); - final PatrolFinder detailsFinder = await $(DetailsComponentWidget).waitUntilVisible(); + final PatrolFinder detailsFinder = + await $(DetailsComponentWidget).waitUntilVisible(); expect(detailsFinder, findsOneWidget); await $.native.pressBack().then((_) => $.pumpAndSettle()); @@ -124,8 +128,9 @@ class VehicleTest { expect(listViewFinder, findsOneWidget); - final PatrolFinder entriesFinder = - await $(listViewFinder).$(CardItemTemplateComponentWidget).waitUntilVisible(); + final PatrolFinder entriesFinder = await $(listViewFinder) + .$(CardItemTemplateComponentWidget) + .waitUntilVisible(); expect(entriesFinder, findsWidgets); await $.pumpAndSettle(); @@ -170,8 +175,9 @@ class VehicleTest { expect(listViewFinder, findsOneWidget); - final PatrolFinder entriesFinder = - await $(listViewFinder).$(CardItemTemplateComponentWidget).waitUntilVisible(); + final PatrolFinder entriesFinder = await $(listViewFinder) + .$(CardItemTemplateComponentWidget) + .waitUntilVisible(); expect(entriesFinder, findsWidgets); final int entriesCount = entriesFinder.evaluate().length; @@ -180,13 +186,16 @@ class VehicleTest { for (int i = 0; i < entriesCount; i++) { await $(entriesFinder.at(i)).scrollTo(); - await $(entriesFinder.at(i)).waitUntilVisible(timeout: const Duration(seconds: 1)).tap( + await $(entriesFinder.at(i)) + .waitUntilVisible(timeout: const Duration(seconds: 1)) + .tap( settleTimeout: const Duration(seconds: 1), settlePolicy: SettlePolicy.noSettle, ); await $.pumpAndSettle(duration: Duration(milliseconds: 500)); - final PatrolFinder detailsFinder = await $(DetailsComponentWidget).waitUntilVisible(); + final PatrolFinder detailsFinder = + await $(DetailsComponentWidget).waitUntilVisible(); expect(detailsFinder, findsOneWidget); await $.native.pressBack().then((_) => $.pumpAndSettle()); diff --git a/lib/components/atomic_components/shared_components_atoms/custom_input.dart b/lib/components/atomic_components/shared_components_atoms/custom_input.dart index 02634611..cac159f4 100644 --- a/lib/components/atomic_components/shared_components_atoms/custom_input.dart +++ b/lib/components/atomic_components/shared_components_atoms/custom_input.dart @@ -150,7 +150,6 @@ class _CustomInputUtilState extends State { maxLines: null, maxLength: widget.haveMaxLength ? widget.maxLength : null, keyboardType: widget.keyboardType, - inputFormatters: [ LengthLimitingTextInputFormatter(widget.maxLength), ], diff --git a/lib/components/atomic_components/shared_components_atoms/tabview.dart b/lib/components/atomic_components/shared_components_atoms/tabview.dart index 8fe92916..32114202 100644 --- a/lib/components/atomic_components/shared_components_atoms/tabview.dart +++ b/lib/components/atomic_components/shared_components_atoms/tabview.dart @@ -41,7 +41,8 @@ class TabViewUtil extends StatelessWidget { fontFamily: FlutterFlowTheme.of(context).titleMediumFamily, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).titleMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).titleMediumFamily), ), unselectedLabelStyle: const TextStyle(), indicatorColor: FlutterFlowTheme.of(context).primary, diff --git a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart index 1993ba8e..6502afbc 100644 --- a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart +++ b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart @@ -19,10 +19,12 @@ class BottomArrowLinkedLocalsComponentWidget extends StatefulWidget { ApiCallResponse? response; @override - State createState() => _BottomArrowLinkedLocalsComponentWidgetState(); + State createState() => + _BottomArrowLinkedLocalsComponentWidgetState(); } -class _BottomArrowLinkedLocalsComponentWidgetState extends State { +class _BottomArrowLinkedLocalsComponentWidgetState + extends State { late BottomArrowLinkedLocalsComponentModel _model; bool _loading = false; @@ -40,7 +42,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State BottomArrowLinkedLocalsComponentModel()); + _model = + createModel(context, () => BottomArrowLinkedLocalsComponentModel()); _localsFuture = _fetchLocals(); } @@ -106,10 +109,14 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State _handleError(BuildContext context, String errorMsg) async { + static Future _handleError( + BuildContext context, String errorMsg) async { await DialogUtil.error(context, errorMsg); } @@ -145,8 +153,9 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State _statusHashMap(dynamic local) { return Map.from({ if (local['CLU_STATUS'] == 'A') - FFLocalizations.of(context).getVariableText(ptText: 'Ativo', enText: 'Active'): - FlutterFlowTheme.of(context).success + FFLocalizations.of(context).getVariableText( + ptText: 'Ativo', + enText: 'Active'): FlutterFlowTheme.of(context).success else if (local['CLU_STATUS'] == 'B') - FFLocalizations.of(context).getVariableText(ptText: 'Bloqueado', enText: 'Blocked'): - FlutterFlowTheme.of(context).error + FFLocalizations.of(context).getVariableText( + ptText: 'Bloqueado', + enText: 'Blocked'): FlutterFlowTheme.of(context).error else - FFLocalizations.of(context).getVariableText(ptText: 'Pendente', enText: 'Pending'): - FlutterFlowTheme.of(context).warning + FFLocalizations.of(context).getVariableText( + ptText: 'Pendente', + enText: 'Pending'): FlutterFlowTheme.of(context).warning }); } @@ -200,16 +213,21 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State _generateStatus() { double limitedBodyTextSize = LimitedFontSizeUtil.getBodyFontSize(context); - - return statusLinkedHashMap.expand((statusLinked) { + return statusLinkedHashMap.expand((statusLinked) { log('statusHashMap: ${statusLinked.length}'); return statusLinked.entries.map((entry) { final text = entry.key; final color = entry.value; - - return Tooltip( message: text, child: Container( @@ -245,9 +239,9 @@ class _CardItemTemplateComponentWidgetState mainAxisSize: MainAxisSize.max, children: [ Row( - mainAxisAlignment: MainAxisAlignment.end, - mainAxisSize: MainAxisSize.max, - children: [if(widget.pin != null) _generatePin()]), + mainAxisAlignment: MainAxisAlignment.end, + mainAxisSize: MainAxisSize.max, + children: [if (widget.pin != null) _generatePin()]), Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -258,7 +252,6 @@ class _CardItemTemplateComponentWidgetState mainAxisSize: MainAxisSize.min, children: [ ..._generateLabels(), - Wrap( spacing: 8, runSpacing: 4, @@ -270,23 +263,20 @@ class _CardItemTemplateComponentWidgetState .addToStart(const SizedBox(height: 5)), ), ), - if(widget.icon != null) _generateIcon(), + if (widget.icon != null) _generateIcon(), if (widget.imagePath != null) _generateImage() - ] .addToEnd(const SizedBox(width: 10)) .addToStart(const SizedBox(width: 10)), ), - ] - .addToStart(SizedBox(height: 5)) - .addToEnd(SizedBox(height: 5)), + ].addToStart(SizedBox(height: 5)).addToEnd(SizedBox(height: 5)), ); } else { return Column( mainAxisSize: MainAxisSize.min, children: [ if (widget.imagePath != null) _generateImage(), - if(widget.icon != null) _generateIcon(), + if (widget.icon != null) _generateIcon(), Container( padding: const EdgeInsets.all(8), child: Column( diff --git a/lib/components/templates_components/details_component/details_component_widget.dart b/lib/components/templates_components/details_component/details_component_widget.dart index b7c1c616..67a21e19 100644 --- a/lib/components/templates_components/details_component/details_component_widget.dart +++ b/lib/components/templates_components/details_component/details_component_widget.dart @@ -11,7 +11,7 @@ import 'package:hub/shared/utils/limited_text_size.dart'; class DetailsComponentWidget extends StatefulWidget { const DetailsComponentWidget({ - super.key, + super.key, required this.labelsHashMap, required this.statusHashMap, this.imagePath, @@ -98,7 +98,7 @@ class _DetailsComponentWidgetState extends State { useOldImageOnUrlChange: true, ), ), - if (widget.icon != null && widget.icon != '') + if (widget.icon != null && widget.icon != '') Container( width: MediaQuery.of(context).size.width * 0.3, height: MediaQuery.of(context).size.width * 0.3, @@ -171,19 +171,18 @@ class _DetailsComponentWidgetState extends State { ), ), style: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - fontWeight: FontWeight.bold, - color: FlutterFlowTheme.of(context).info, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .labelMediumFamily, - ), - fontSize: limitedBodyFontSize, + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + fontWeight: FontWeight.bold, + color: FlutterFlowTheme.of(context).info, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily, ), + fontSize: limitedBodyFontSize, + ), textAlign: TextAlign.center, maxLines: null, keyboardType: TextInputType.name, diff --git a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart index 62e99c23..12bdc25e 100644 --- a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart +++ b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart @@ -19,10 +19,12 @@ class ForgotPasswordTemplateComponentWidget extends StatefulWidget { const ForgotPasswordTemplateComponentWidget({super.key}); @override - State createState() => _ForgotPasswordTemplateComponentWidgetState(); + State createState() => + _ForgotPasswordTemplateComponentWidgetState(); } -class _ForgotPasswordTemplateComponentWidgetState extends State { +class _ForgotPasswordTemplateComponentWidgetState + extends State { late ForgotPasswordTemplateComponentModel _model; @override @@ -49,9 +51,11 @@ class _ForgotPasswordTemplateComponentWidgetState extends State('BackButton'), splashColor: Colors.transparent, @@ -98,7 +103,8 @@ class _ForgotPasswordTemplateComponentWidgetState extends State('SendButtonWidget'), - onPressed: (_model.emailAddressTextController.text == '' || - !ValidatorUtil.isValidEmail(_model.emailAddressTextController.text)) + onPressed: (_model.emailAddressTextController.text == + '' || + !ValidatorUtil.isValidEmail( + _model.emailAddressTextController.text)) ? null - : () async => await AuthenticationService.forgotPassword( + : () async => + await AuthenticationService.forgotPassword( context, _model.emailAddressTextController.text, ).then((v) => v == true ? context.pop() : null), @@ -251,23 +278,28 @@ class _ForgotPasswordTemplateComponentWidgetState extends State createState() => _SignInTemplateComponentWidgetState(); + State createState() => + _SignInTemplateComponentWidgetState(); } -class _SignInTemplateComponentWidgetState extends State with TickerProviderStateMixin { +class _SignInTemplateComponentWidgetState + extends State with TickerProviderStateMixin { late SignInTemplateComponentModel _model; final animationsMap = {}; @@ -99,14 +101,17 @@ class _SignInTemplateComponentWidgetState extends State('emailTextFormField'), - controller: _model.emailAddressTextController, - focusNode: _model.emailAddressFocusNode, - cursorColor: FlutterFlowTheme.of(context).primary, - onChanged: (_) => EasyDebounce.debounce( + key: const ValueKey( + 'emailTextFormField'), + controller: _model + .emailAddressTextController, + focusNode: _model + .emailAddressFocusNode, + cursorColor: + FlutterFlowTheme.of(context) + .primary, + onChanged: (_) => + EasyDebounce.debounce( '_model.emailAddressTextController', - const Duration(milliseconds: 500), + const Duration( + milliseconds: 500), () => setState(() {}), ), autofocus: true, - autofillHints: const [AutofillHints.email], - textCapitalization: TextCapitalization.none, - textInputAction: TextInputAction.next, + autofillHints: const [ + AutofillHints.email + ], + textCapitalization: + TextCapitalization.none, + textInputAction: + TextInputAction.next, obscureText: false, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( + labelText: FFLocalizations.of( + context) + .getText( '1ltg0ylb' /* Email */, ), - labelStyle: FlutterFlowTheme.of(context).labelLarge.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: limitedInputFontSize, + labelStyle: FlutterFlowTheme + .of(context) + .labelLarge + .override( + fontFamily: + 'Plus Jakarta Sans', + color: + FlutterFlowTheme.of( + context) + .primaryText, + fontSize: + limitedInputFontSize, letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + fontWeight: + FontWeight.w500, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), - enabledBorder: OutlineInputBorder( + enabledBorder: + OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).customColor1, + color: + FlutterFlowTheme.of( + context) + .customColor1, width: 0.25, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular( + 12.0), ), - focusedBorder: OutlineInputBorder( + focusedBorder: + OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).success, + color: + FlutterFlowTheme.of( + context) + .success, width: 0.25, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular( + 12.0), ), - errorBorder: OutlineInputBorder( + errorBorder: + OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of( + context) + .error, width: 0.25, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular( + 12.0), ), errorStyle: TextStyle( - color: FlutterFlowTheme.of(context).error, - fontSize: limitedInputFontSize, + color: FlutterFlowTheme.of( + context) + .error, + fontSize: + limitedInputFontSize, fontWeight: FontWeight.w500, ), - focusedErrorBorder: OutlineInputBorder( + focusedErrorBorder: + OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of( + context) + .error, width: 0.25, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular( + 12.0), ), suffixIcon: Icon( Icons.email, - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of( + context) + .accent1, size: 22.0, ), ), - style: FlutterFlowTheme.of(context).bodyLarge.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: limitedInputFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), - ), - keyboardType: TextInputType.emailAddress, - validator: - _model.emailAddressTextControllerValidator.asValidator(context), + style: + FlutterFlowTheme.of(context) + .bodyLarge + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme + .of(context) + .primaryText, + fontSize: + limitedInputFontSize, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), + ), + keyboardType: + TextInputType.emailAddress, + validator: _model + .emailAddressTextControllerValidator + .asValidator(context), ), ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0), + padding: const EdgeInsetsDirectional + .fromSTEB(0.0, 0.0, 0.0, 16.0), child: SizedBox( width: double.infinity, child: TextFormField( - key: const ValueKey('passwordTextFormField'), - controller: _model.passwordTextController, - cursorColor: FlutterFlowTheme.of(context).primary, - focusNode: _model.passwordFocusNode, - onChanged: (_) => EasyDebounce.debounce('_model.passwordTextController', - const Duration(milliseconds: 500), () => setState(() {})), + key: const ValueKey( + 'passwordTextFormField'), + controller: _model + .passwordTextController, + cursorColor: + FlutterFlowTheme.of(context) + .primary, + focusNode: + _model.passwordFocusNode, + onChanged: (_) => + EasyDebounce.debounce( + '_model.passwordTextController', + const Duration( + milliseconds: 500), + () => setState(() {})), autofocus: true, - autofillHints: const [AutofillHints.password], - textInputAction: TextInputAction.send, - obscureText: !_model.passwordVisibility, + autofillHints: const [ + AutofillHints.password + ], + textInputAction: + TextInputAction.send, + obscureText: + !_model.passwordVisibility, decoration: InputDecoration( isDense: true, - labelText: - FFLocalizations.of(context).getText('2x19ce8k' /* Senha */), - labelStyle: FlutterFlowTheme.of(context).labelLarge.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: limitedInputFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans')), - enabledBorder: OutlineInputBorder( + labelText: FFLocalizations.of( + context) + .getText( + '2x19ce8k' /* Senha */), + labelStyle: FlutterFlowTheme + .of(context) + .labelLarge + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme + .of(context) + .primaryText, + fontSize: + limitedInputFontSize, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans')), + enabledBorder: + OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).customColor1, width: 0.25), - borderRadius: BorderRadius.circular(12.0), + color: + FlutterFlowTheme.of( + context) + .customColor1, + width: 0.25), + borderRadius: + BorderRadius.circular( + 12.0), ), errorStyle: TextStyle( - color: FlutterFlowTheme.of(context).error, - fontSize: limitedInputFontSize, + color: FlutterFlowTheme.of( + context) + .error, + fontSize: + limitedInputFontSize, fontWeight: FontWeight.w500, ), focusedBorder: OutlineInputBorder( borderSide: - const BorderSide(color: Color(0xFF1AAB5F), width: 0.25), - borderRadius: BorderRadius.circular(12.0)), - errorBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Color(0xFFFF5963), width: 0.25), - borderRadius: BorderRadius.circular(12.0), + const BorderSide( + color: Color( + 0xFF1AAB5F), + width: 0.25), + borderRadius: + BorderRadius.circular( + 12.0)), + errorBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + color: Color( + 0xFFFF5963), + width: 0.25), + borderRadius: + BorderRadius.circular( + 12.0), ), - focusedErrorBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Color(0xFFFF5963), width: 0.25), - borderRadius: BorderRadius.circular(12.0), + focusedErrorBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + color: Color( + 0xFFFF5963), + width: 0.25), + borderRadius: + BorderRadius.circular( + 12.0), ), filled: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, + fillColor: + FlutterFlowTheme.of( + context) + .primaryBackground, suffixIcon: InkWell( - onTap: () => setState( - () => _model.passwordVisibility = !_model.passwordVisibility), - focusNode: FocusNode(skipTraversal: true), + onTap: () => setState(() => + _model.passwordVisibility = + !_model + .passwordVisibility), + focusNode: FocusNode( + skipTraversal: true), child: Icon( _model.passwordVisibility - ? Icons.visibility_outlined - : Icons.visibility_off_outlined, - color: FlutterFlowTheme.of(context).accent1, + ? Icons + .visibility_outlined + : Icons + .visibility_off_outlined, + color: + FlutterFlowTheme.of( + context) + .accent1, size: 24.0), ), ), - style: FlutterFlowTheme.of(context).bodyLarge.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: limitedInputFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), - ), - validator: _model.passwordTextControllerValidator.asValidator(context), + style: + FlutterFlowTheme.of(context) + .bodyLarge + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme + .of(context) + .primaryText, + fontSize: + limitedInputFontSize, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), + ), + validator: _model + .passwordTextControllerValidator + .asValidator(context), ), ), ), @@ -353,77 +512,153 @@ class _SignInTemplateComponentWidgetState extends State('SubmitButtonWidget'), + key: const ValueKey( + 'SubmitButtonWidget'), onPressed: _isFormInvalid() ? null : () async { - await AuthenticationService.signIn( + await AuthenticationService + .signIn( context, _model, - emailAdress: _model.emailAddressTextController.text, - password: _model.passwordTextController.text, + emailAdress: _model + .emailAddressTextController + .text, + password: _model + .passwordTextController + .text, ); setState(() {}); }, - text: FFLocalizations.of(context).getText('k44tm7wo' /* Entrar */), + text: FFLocalizations.of( + context) + .getText( + 'k44tm7wo' /* Entrar */), options: FFButtonOptions( width: double.infinity, height: 44.0, - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + padding: + const EdgeInsetsDirectional + .fromSTEB( + 0.0, 0.0, 0.0, 0.0), iconPadding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), - color: FlutterFlowTheme.of(context).primary, - textStyle: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).info, - fontSize: limitedInputFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans')), + const EdgeInsetsDirectional + .fromSTEB( + 0.0, 0.0, 0.0, 0.0), + color: FlutterFlowTheme.of( + context) + .primary, + textStyle: FlutterFlowTheme + .of(context) + .titleSmall + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme + .of(context) + .info, + fontSize: + limitedInputFontSize, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans')), elevation: 3.0, - borderSide: const BorderSide(color: Colors.transparent, width: 1.0), - borderRadius: BorderRadius.circular(12.0), - disabledColor: FlutterFlowTheme.of(context).customColor5, - disabledTextColor: Colors.white, + borderSide: + const BorderSide( + color: Colors + .transparent, + width: 1.0), + borderRadius: + BorderRadius.circular( + 12.0), + disabledColor: + FlutterFlowTheme.of( + context) + .customColor5, + disabledTextColor: + Colors.white, ), showLoadingIndicator: false, ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0), + padding: + const EdgeInsetsDirectional + .fromSTEB( + 0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( - key: const ValueKey('toggleSignUpPage'), - onPressed: () async => await widget.toggleSignUpPage?.call(), - text: FFLocalizations.of(context).getText( + key: const ValueKey( + 'toggleSignUpPage'), + onPressed: () async => + await widget + .toggleSignUpPage + ?.call(), + text: FFLocalizations.of( + context) + .getText( '14u7ipws' /* Cadastrar */, ), options: FFButtonOptions( width: double.infinity, height: 44.0, - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + padding: + const EdgeInsetsDirectional + .fromSTEB( + 0.0, 0.0, 0.0, 0.0), iconPadding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), - color: FlutterFlowTheme.of(context).customColor1, - textStyle: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).secondaryText, - fontSize: limitedInputFontSize, + const EdgeInsetsDirectional + .fromSTEB( + 0.0, 0.0, 0.0, 0.0), + color: FlutterFlowTheme.of( + context) + .customColor1, + textStyle: FlutterFlowTheme + .of(context) + .titleSmall + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme + .of(context) + .secondaryText, + fontSize: + limitedInputFontSize, letterSpacing: 0.0, - fontWeight: FontWeight.w500, + fontWeight: + FontWeight.w500, useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), elevation: 3.0, - borderSide: const BorderSide(color: Colors.transparent, width: 1.0), - borderRadius: BorderRadius.circular(12.0), + borderSide: + const BorderSide( + color: Colors + .transparent, + width: 1.0), + borderRadius: + BorderRadius.circular( + 12.0), ), showLoadingIndicator: false, ), @@ -433,158 +668,279 @@ class _SignInTemplateComponentWidgetState extends State('SubmitButtonWidget'), - onPressed: _isFormInvalid() - ? null - : () async { - try { - await AuthenticationService.signIn( - context, - _model, - emailAdress: _model.emailAddressTextController.text, - password: _model.passwordTextController.text, - ); - setState(() {}); - } catch (e, s) { - await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed( - 'login.php', - _model.emailAddressTextController.text, - "Login", - e, - s); - } - }, - text: FFLocalizations.of(context).getText('1x926nsn'), + key: const ValueKey< + String>( + 'SubmitButtonWidget'), + onPressed: + _isFormInvalid() + ? null + : () async { + try { + await AuthenticationService + .signIn( + context, + _model, + emailAdress: _model + .emailAddressTextController + .text, + password: _model + .passwordTextController + .text, + ); + setState( + () {}); + } catch (e, s) { + await DialogUtil + .errorDefault( + context); + LogUtil.requestAPIFailed( + 'login.php', + _model + .emailAddressTextController + .text, + "Login", + e, + s); + } + }, + text: FFLocalizations.of( + context) + .getText('1x926nsn'), options: FFButtonOptions( width: double.infinity, height: 44.0, padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + const EdgeInsetsDirectional + .fromSTEB(0.0, + 0.0, 0.0, 0.0), iconPadding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), - color: FlutterFlowTheme.of(context).accent1, - textStyle: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).info, - fontSize: limitedInputFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), - ), + const EdgeInsetsDirectional + .fromSTEB(0.0, + 0.0, 0.0, 0.0), + color: + FlutterFlowTheme.of( + context) + .accent1, + textStyle: + FlutterFlowTheme.of( + context) + .titleSmall + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme.of( + context) + .info, + fontSize: + limitedInputFontSize, + letterSpacing: + 0.0, + fontWeight: + FontWeight + .w500, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), + ), elevation: 3.0, - borderSide: const BorderSide( - color: Colors.transparent, + borderSide: + const BorderSide( + color: Colors + .transparent, width: 1.0, ), - borderRadius: BorderRadius.circular(12.0), - disabledColor: const Color(0xE81AAB5F), + borderRadius: + BorderRadius + .circular(12.0), + disabledColor: + const Color( + 0xE81AAB5F), ), - showLoadingIndicator: true, + showLoadingIndicator: + true, ), ), ), Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0), + padding: + const EdgeInsetsDirectional + .fromSTEB(0.0, 0.0, + 0.0, 16.0), child: FFButtonWidget( - key: const ValueKey('toggleSignUpPage'), - onPressed: () async => await widget.toggleSignUpPage?.call(), - text: FFLocalizations.of(context) - .getText('jwvd4ai1' /* Cadastrar */), + key: const ValueKey< + String>( + 'toggleSignUpPage'), + onPressed: () async => + await widget + .toggleSignUpPage + ?.call(), + text: FFLocalizations.of( + context) + .getText( + 'jwvd4ai1' /* Cadastrar */), options: FFButtonOptions( width: double.infinity, height: 44.0, padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + const EdgeInsetsDirectional + .fromSTEB(0.0, + 0.0, 0.0, 0.0), iconPadding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), - color: FlutterFlowTheme.of(context).customColor1, - textStyle: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).secondaryText, - fontSize: 16.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), - ), + const EdgeInsetsDirectional + .fromSTEB(0.0, + 0.0, 0.0, 0.0), + color: + FlutterFlowTheme.of( + context) + .customColor1, + textStyle: + FlutterFlowTheme.of( + context) + .titleSmall + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme.of( + context) + .secondaryText, + fontSize: + 16.0, + letterSpacing: + 0.0, + fontWeight: + FontWeight + .w500, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), + ), elevation: 3.0, - borderSide: const BorderSide( - color: Colors.transparent, + borderSide: + const BorderSide( + color: Colors + .transparent, width: 1.0, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius + .circular(12.0), ), - showLoadingIndicator: false, + showLoadingIndicator: + false, ), ), ), - ].divide(const SizedBox(width: 7.0))); + ].divide( + const SizedBox(width: 7.0))); } }, ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 12.0, 0.0, 12.0), + padding: + const EdgeInsetsDirectional.fromSTEB( + 0.0, 12.0, 0.0, 12.0), child: InkWell( - key: const ValueKey('ForgotPassword'), + key: const ValueKey( + 'ForgotPassword'), splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: const ForgotPasswordTemplateComponentWidget(), - ); - }).then((value) => safeSetState(() {})); + isScrollControlled: true, + backgroundColor: + Colors.transparent, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery + .viewInsetsOf( + context), + child: + const ForgotPasswordTemplateComponentWidget(), + ); + }) + .then((value) => + safeSetState(() {})); }, child: RichText( - textScaler: MediaQuery.of(context).textScaler, + textScaler: + MediaQuery.of(context).textScaler, text: TextSpan( children: [ TextSpan( - text: FFLocalizations.of(context).getText( + text: + FFLocalizations.of(context) + .getText( '05dx91ku' /* Você esqueceu a sua senha? */, ), style: TextStyle( - color: FlutterFlowTheme.of(context).primaryText, - fontSize: limitedInputFontSize, + color: FlutterFlowTheme.of( + context) + .primaryText, + fontSize: + limitedInputFontSize, ), ), TextSpan( - text: FFLocalizations.of(context) - .getText('p5c6d54y' /* Recupere aqui */), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primary, - fontSize: limitedInputFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.normal, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), - ), - mouseCursor: SystemMouseCursors.click, + text: FFLocalizations.of( + context) + .getText( + 'p5c6d54y' /* Recupere aqui */), + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme + .of(context) + .primary, + fontSize: + limitedInputFontSize, + letterSpacing: 0.0, + fontWeight: + FontWeight.normal, + useGoogleFonts: + GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), + ), + mouseCursor: + SystemMouseCursors.click, ) ], - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - fontSize: limitedInputFontSize), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + fontSize: + limitedInputFontSize), ), ), ), @@ -594,7 +950,8 @@ class _SignInTemplateComponentWidgetState extends State createState() => _HomePageWidgetState(); } -class _HomePageWidgetState extends State with WidgetsBindingObserver { +class _HomePageWidgetState extends State + with WidgetsBindingObserver { final scaffoldKey = GlobalKey(); @override @@ -96,7 +97,8 @@ class _HomePageWidgetState extends State with WidgetsBindingObse fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).info, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), ), ].divide(const SizedBox(width: 8.0)), diff --git a/lib/features/local/data/data_sources/locals_remote_data_source.dart b/lib/features/local/data/data_sources/locals_remote_data_source.dart index 0babde3a..a40883cf 100644 --- a/lib/features/local/data/data_sources/locals_remote_data_source.dart +++ b/lib/features/local/data/data_sources/locals_remote_data_source.dart @@ -24,7 +24,8 @@ abstract class LocalsRemoteDataSource { } class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { - static final LocalsRemoteDataSourceImpl _instance = LocalsRemoteDataSourceImpl._internal(); + static final LocalsRemoteDataSourceImpl _instance = + LocalsRemoteDataSourceImpl._internal(); factory LocalsRemoteDataSourceImpl() => _instance; LocalsRemoteDataSourceImpl._internal(); @@ -50,7 +51,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { final List locals = response.jsonBody['locais'] ?? []; final bool isEmpty = locals.isEmpty; - final bool isActive = locals.where((local) => local['CLU_STATUS'] != 'B').isNotEmpty; + final bool isActive = + locals.where((local) => local['CLU_STATUS'] != 'B').isNotEmpty; final bool isEnable = !isEmpty && isActive; if (isEnable) { @@ -95,7 +97,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { final bool isInactived = await LocalUtil.isInactived(locals); final bool isPending = LocalUtil.isPending(locals); final bool isUnique = locals.length == 1; - final bool isBlocked = locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty; + final bool isBlocked = + locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty; final bool isEnabled = isUnique && isActive; final bool isDisabled = isUnique && isBlocked; final bool isUnselected = await LocalUtil.isUnselected(); @@ -148,8 +151,10 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { @override Future checkLocals(BuildContext context) async { - final String? cliUUID = await StorageHelper().get(ProfileStorageKey.clientUUID.key); - final String? cliName = await StorageHelper().get(ProfileStorageKey.clientName.key); + final String? cliUUID = + await StorageHelper().get(ProfileStorageKey.clientUUID.key); + final String? cliName = + await StorageHelper().get(ProfileStorageKey.clientName.key); final haveCli = cliUUID != null && cliUUID.isNotEmpty; final haveName = cliName != null && cliName.isNotEmpty; return haveCli && haveName; @@ -175,7 +180,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { if (isError == true) { final GetLocalsCall callback = PhpGroup.getLocalsCall; response = await callback.call(); - final String errorMsg = response.jsonBody['error_msg'] ?? 'Local indisponível'; + final String errorMsg = + response.jsonBody['error_msg'] ?? 'Local indisponível'; // await DialogUtil.error(context, errorMsg).whenComplete(() async => await selectLocal(context, response)); return false; } else { @@ -194,7 +200,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { } @override - Future selectLocal(BuildContext context, ApiCallResponse? response) async { + Future selectLocal( + BuildContext context, ApiCallResponse? response) async { return await showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent, @@ -224,13 +231,15 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { enText: 'Device unlinked successfully', ptText: 'Dispositivo desvinculado com sucesso', ); - final bool status = await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async { + final bool status = + await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async { if (value.jsonBody['error'] == false) { await StorageHelper().set(ProfileStorageKey.clientName.key, ''); await StorageHelper().set(ProfileStorageKey.ownerName.key, ''); await StorageHelper().set(ProfileStorageKey.clientUUID.key, ''); context.pop(); - context.go('/homePage', extra: {'update': LocalsRepositoryImpl().update}); + context.go('/homePage', + extra: {'update': LocalsRepositoryImpl().update}); SnackBarUtil.showSnackBar(context, content); return true; } diff --git a/lib/features/local/data/repositories/locals_repository_impl.dart b/lib/features/local/data/repositories/locals_repository_impl.dart index ea37e12e..a7245383 100644 --- a/lib/features/local/data/repositories/locals_repository_impl.dart +++ b/lib/features/local/data/repositories/locals_repository_impl.dart @@ -49,8 +49,10 @@ class LocalsRepositoryImpl implements LocalsRepository { } Future check(BuildContext context) async { - final String? cliUUID = await StorageHelper().get(ProfileStorageKey.clientUUID.key); - final String? ownerUUID = await StorageHelper().get(ProfileStorageKey.ownerUUID.key); + final String? cliUUID = + await StorageHelper().get(ProfileStorageKey.clientUUID.key); + final String? ownerUUID = + await StorageHelper().get(ProfileStorageKey.ownerUUID.key); final bool haveCli = cliUUID != null && cliUUID.isNotEmpty; final bool haveOwner = ownerUUID != null && ownerUUID.isNotEmpty; if (!haveCli && !haveOwner) { diff --git a/lib/features/local/utils/local_util.dart b/lib/features/local/utils/local_util.dart index 2a0b6d6b..783e7fa7 100644 --- a/lib/features/local/utils/local_util.dart +++ b/lib/features/local/utils/local_util.dart @@ -11,10 +11,13 @@ import 'package:hub/shared/utils/log_util.dart'; class LocalUtil { static void handleError(BuildContext context, String errorMsg) async { - final String devUUID = await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? ''; - final String userUUID = await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? ''; + final String devUUID = + await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? ''; + final String userUUID = + await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? ''; final bool isAuthenticated = userUUID.isNotEmpty && devUUID.isNotEmpty; - final bool isDevLinked = !errorMsg.contains('Esse dispositivo nao pertence a esse usuario'); + final bool isDevLinked = + !errorMsg.contains('Esse dispositivo nao pertence a esse usuario'); log('() => isLinked: $errorMsg'); if (!isAuthenticated) { errorMsg = FFLocalizations.of(context).getVariableText( @@ -36,13 +39,18 @@ class LocalUtil { // await DialogUtil.error(context, errorMsg).whenComplete(() async => await LocalsRemoteDataSourceImpl().selectLocal(context, null)); } - static Future handleUnavailable(BuildContext context, List locals) async { + static Future handleUnavailable( + BuildContext context, List locals) async { log('() => isUnavailable'); try { - await StorageHelper().set(ProfileStorageKey.clientUUID.key, locals[0]['CLI_ID']); - await StorageHelper().set(ProfileStorageKey.ownerUUID.key, locals[0]['CLU_OWNER_ID']); - await StorageHelper().set(ProfileStorageKey.clientName.key, locals[0]['CLI_NOME']); - await StorageHelper().set(ProfileStorageKey.ownerName.key, locals[0]['CLU_OWNER_DSC']); + await StorageHelper() + .set(ProfileStorageKey.clientUUID.key, locals[0]['CLI_ID']); + await StorageHelper() + .set(ProfileStorageKey.ownerUUID.key, locals[0]['CLU_OWNER_ID']); + await StorageHelper() + .set(ProfileStorageKey.clientName.key, locals[0]['CLI_NOME']); + await StorageHelper() + .set(ProfileStorageKey.ownerName.key, locals[0]['CLU_OWNER_DSC']); var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A'); if (response.jsonBody['error'] == true) { @@ -54,10 +62,13 @@ class LocalUtil { return false; } if (response.jsonBody['error'] == false) - return await LocalsRemoteDataSourceImpl().processProperty(context).then((value) => value); + return await LocalsRemoteDataSourceImpl() + .processProperty(context) + .then((value) => value); } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed('responderVinculo.php', '', 'Responder Vínculo', e, s); + LogUtil.requestAPIFailed( + 'responderVinculo.php', '', 'Responder Vínculo', e, s); return false; } return false; @@ -65,12 +76,19 @@ class LocalUtil { static Future handleEnabled(BuildContext context, dynamic local) async { log('() => isEnabled'); - await StorageHelper().set(ProfileStorageKey.clientUUID.key, local['CLI_ID']); - await StorageHelper().set(ProfileStorageKey.ownerUUID.key, local['CLU_OWNER_ID']); - await StorageHelper().set(ProfileStorageKey.clientName.key, local['CLI_NOME']); - await StorageHelper().set(ProfileStorageKey.ownerName.key, local['CLU_OWNER_DSC']); - await StorageHelper().set(ProfileStorageKey.userName.key, local['USU_NOME']); - return await LocalsRemoteDataSourceImpl().processProperty(context).then((v) async { + await StorageHelper() + .set(ProfileStorageKey.clientUUID.key, local['CLI_ID']); + await StorageHelper() + .set(ProfileStorageKey.ownerUUID.key, local['CLU_OWNER_ID']); + await StorageHelper() + .set(ProfileStorageKey.clientName.key, local['CLI_NOME']); + await StorageHelper() + .set(ProfileStorageKey.ownerName.key, local['CLU_OWNER_DSC']); + await StorageHelper() + .set(ProfileStorageKey.userName.key, local['USU_NOME']); + return await LocalsRemoteDataSourceImpl() + .processProperty(context) + .then((v) async { if (v == true) return await LicenseRepositoryImpl().updateLicense(); return v; }); @@ -93,9 +111,12 @@ class LocalUtil { static Future updateStorageUtil(Map jsonBody) async { try { - await StorageHelper().set(LocalsStorageKey.whatsapp.key, jsonBody['whatsapp'] ?? false); - await StorageHelper().set(LocalsStorageKey.provisional.key, jsonBody['provisional'] ?? false); - await StorageHelper().set(LocalsStorageKey.vehicleAutoApproval.key, jsonBody['vehicleAutoApproval'] ?? false); + await StorageHelper() + .set(LocalsStorageKey.whatsapp.key, jsonBody['whatsapp'] ?? false); + await StorageHelper().set( + LocalsStorageKey.provisional.key, jsonBody['provisional'] ?? false); + await StorageHelper().set(LocalsStorageKey.vehicleAutoApproval.key, + jsonBody['vehicleAutoApproval'] ?? false); await StorageHelper().set( LocalsStorageKey.pets.key, @@ -118,19 +139,28 @@ class LocalUtil { ); } - await StorageHelper().set(LocalsStorageKey.petAmount.key, - jsonBody['petAmountRegister']?.toString().isEmpty ?? true ? '0' : jsonBody['petAmountRegister'].toString()); - - await StorageHelper().set(LocalsStorageKey.vehicleAmountRegister.key, - jsonBody['vehicleAmountRegister']?.toString().isEmpty ?? true ? '0' : jsonBody['vehicleAmountRegister'].toString()); + await StorageHelper().set( + LocalsStorageKey.petAmount.key, + jsonBody['petAmountRegister']?.toString().isEmpty ?? true + ? '0' + : jsonBody['petAmountRegister'].toString()); + await StorageHelper().set( + LocalsStorageKey.vehicleAmountRegister.key, + jsonBody['vehicleAmountRegister']?.toString().isEmpty ?? true + ? '0' + : jsonBody['vehicleAmountRegister'].toString()); - await StorageHelper().set(ProfileStorageKey.userName.key, jsonBody['visitado']['VDO_NOME'] ?? ''); - await StorageHelper().set(ProfileStorageKey.userEmail.key, jsonBody['visitado']['VDO_EMAIL'] ?? ''); - await StorageHelper().set(LocalsStorageKey.provisional.key, jsonBody['provisional'] ?? false); + await StorageHelper().set(ProfileStorageKey.userName.key, + jsonBody['visitado']['VDO_NOME'] ?? ''); + await StorageHelper().set(ProfileStorageKey.userEmail.key, + jsonBody['visitado']['VDO_EMAIL'] ?? ''); + await StorageHelper().set( + LocalsStorageKey.provisional.key, jsonBody['provisional'] ?? false); final bool isNewVersion = jsonBody['newVersion'] ?? false; - await StorageHelper().set(LocalsStorageKey.isNewVersion.key, isNewVersion); + await StorageHelper() + .set(LocalsStorageKey.isNewVersion.key, isNewVersion); return isNewVersion; } catch (e, s) { log('Error in _updateStorageUtil: $e', stackTrace: s); @@ -143,30 +173,44 @@ class LocalUtil { } static Future isInactived(List locals) async { - String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; - return locals.where((local) => local['CLI_ID'] != cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty; + String cliUUID = + (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; + return locals + .where( + (local) => local['CLI_ID'] != cliUUID && local['CLU_STATUS'] == 'A') + .isNotEmpty; } static bool isPending(List locals) { - return locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').isNotEmpty; + return locals + .where( + (local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A') + .isNotEmpty; } static Future isUnselected() async { - String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; - String cliName = (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? ''; - String ownerUUID = (await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? ''; + String cliUUID = + (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; + String cliName = + (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? ''; + String ownerUUID = + (await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? ''; return cliUUID.isEmpty && cliName.isEmpty && ownerUUID.isEmpty; } static Future isSelected(bool isInactived) async { - String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; - String cliName = (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? ''; + String cliUUID = + (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; + String cliName = + (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? ''; return cliUUID.isNotEmpty && cliName.isNotEmpty && isInactived; } static Future isAvailable() async { - String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; - String cliName = (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? ''; + String cliUUID = + (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; + String cliName = + (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? ''; return cliUUID.isNotEmpty && cliName.isNotEmpty; } } diff --git a/lib/features/menu/data/data_sources/menu_local_data_source.dart b/lib/features/menu/data/data_sources/menu_local_data_source.dart index b736ed41..ad8502f8 100644 --- a/lib/features/menu/data/data_sources/menu_local_data_source.dart +++ b/lib/features/menu/data/data_sources/menu_local_data_source.dart @@ -9,16 +9,19 @@ import 'package:hub/shared/extensions/dialog_extensions.dart'; import 'package:hub/shared/utils/path_util.dart'; abstract class MenuLocalDataSource { - Future addMenuEntry( - Key key, EnumMenuItem item, List entries, IconData icon, String text, Function() action); + Future addMenuEntry(Key key, EnumMenuItem item, + List entries, IconData icon, String text, Function() action); - Future processDisplayDefault(EnumMenuItem item, MenuEntry opt, List entries); + Future processDisplayDefault( + EnumMenuItem item, MenuEntry opt, List entries); - Future handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt, List entries); + Future handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt, + List entries); } class MenuLocalDataSourceImpl implements MenuLocalDataSource { - static final MenuLocalDataSourceImpl _instance = MenuLocalDataSourceImpl._internal(); + static final MenuLocalDataSourceImpl _instance = + MenuLocalDataSourceImpl._internal(); factory MenuLocalDataSourceImpl() => _instance; @@ -45,9 +48,12 @@ class MenuLocalDataSourceImpl implements MenuLocalDataSource { } @override - Future processDisplayDefault(EnumMenuItem item, MenuEntry opt, List entries) async { + Future processDisplayDefault( + EnumMenuItem item, MenuEntry opt, List entries) async { if (opt.key == 'FRE-HUB-LOGOUT') { - await addMenuEntry(ValueKey(opt.key), item, entries, opt.icon, opt.name, () async { + await addMenuEntry( + ValueKey(opt.key), item, entries, opt.icon, opt.name, + () async { await AuthenticationService.signOut(navigatorKey.currentContext!); }); return true; @@ -56,17 +62,23 @@ class MenuLocalDataSourceImpl implements MenuLocalDataSource { } @override - Future handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt, List entries) async { + Future handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt, + List entries) async { try { switch (display.value) { case 'VISIVEL': - await addMenuEntry(ValueKey(opt.key), item, entries, opt.icon, opt.name, () async { + await addMenuEntry( + ValueKey(opt.key), item, entries, opt.icon, opt.name, + () async { await PathUtil.nav(opt.route); }); break; case 'DESABILITADO': - await addMenuEntry(ValueKey(opt.key), item, entries, opt.icon, opt.name, () async { - await DialogUnavailable.unavailableFeature(navigatorKey.currentContext!); + await addMenuEntry( + ValueKey(opt.key), item, entries, opt.icon, opt.name, + () async { + await DialogUnavailable.unavailableFeature( + navigatorKey.currentContext!); }); break; case 'INVISIVEL': diff --git a/lib/features/menu/data/repositories/menu_repository_impl.dart b/lib/features/menu/data/repositories/menu_repository_impl.dart index bf59361b..0a73d855 100644 --- a/lib/features/menu/data/repositories/menu_repository_impl.dart +++ b/lib/features/menu/data/repositories/menu_repository_impl.dart @@ -10,13 +10,15 @@ class MenuRepositoryImpl implements MenuRepository { final MenuLocalDataSource menuDataSource = MenuLocalDataSourceImpl(); @override - Future> entries2Items(List menuEntries, EnumMenuItem menuItem) async { + Future> entries2Items( + List menuEntries, EnumMenuItem menuItem) async { List entries = []; // final bool isNewVersion = await StorageHelper().get(KeychainStorageKey.isNewVersion.value).then((v) => v.toBoolean()); try { for (var entry in menuEntries) { - final bool isDefault = await menuDataSource.processDisplayDefault(menuItem, entry, entries); + final bool isDefault = await menuDataSource.processDisplayDefault( + menuItem, entry, entries); if (isDefault) continue; final licenseValue = await LicenseRepositoryImpl().getModule(entry.key); if (licenseValue != null) { @@ -25,17 +27,20 @@ class MenuRepositoryImpl implements MenuRepository { final startDate = licenseMap['startDate'] ?? ''; final expirationDate = licenseMap['expirationDate'] ?? ''; final isStarted = await DateTimeUtil.processStartDate(startDate); - final isExpired = await DateTimeUtil.processExpirationDate(expirationDate); + final isExpired = + await DateTimeUtil.processExpirationDate(expirationDate); if (isStarted && !isExpired) { await menuDataSource.handleMenu(menuItem, display, entry, entries); } if (isExpired) { log('Entry ${entry.key} is expired'); - await menuDataSource.handleMenu(menuItem, EnumDisplay.inactive, entry, entries); + await menuDataSource.handleMenu( + menuItem, EnumDisplay.inactive, entry, entries); } if (!isStarted) { log('Entry ${entry.key} is not started'); - await menuDataSource.handleMenu(menuItem, EnumDisplay.inactive, entry, entries); + await menuDataSource.handleMenu( + menuItem, EnumDisplay.inactive, entry, entries); } } } @@ -45,9 +50,11 @@ class MenuRepositoryImpl implements MenuRepository { return entries; } - Future processDisplay(Map module, bool isNewVersion) async { + Future processDisplay( + Map module, bool isNewVersion) async { if (await _shouldUpdateDisplay(module, isNewVersion)) { - final displayValue = module['display'] == EnumDisplay.active ? 'VISIVEL' : 'INVISIVEL'; + final displayValue = + module['display'] == EnumDisplay.active ? 'VISIVEL' : 'INVISIVEL'; await LicenseLocalDataSourceImpl(DatabaseService.database) .setDisplayByKey(['FRE-HUB-ABOUT-PROPERTY'], displayValue); return EnumDisplay.fromString(displayValue); @@ -56,8 +63,13 @@ class MenuRepositoryImpl implements MenuRepository { return EnumDisplay.fromString(module['display']); } - Future _shouldUpdateDisplay(Map module, bool isNewVersion) async { - const keysToCheck = [LicenseKeys.residents, LicenseKeys.vehicles, LicenseKeys.openedVisits]; + Future _shouldUpdateDisplay( + Map module, bool isNewVersion) async { + const keysToCheck = [ + LicenseKeys.residents, + LicenseKeys.vehicles, + LicenseKeys.openedVisits + ]; return isNewVersion && keysToCheck.any((key) => module['key'] == key.value); } } diff --git a/lib/features/module/domain/entities/license.dart b/lib/features/module/domain/entities/license.dart index 130c7462..dde5fee0 100644 --- a/lib/features/module/domain/entities/license.dart +++ b/lib/features/module/domain/entities/license.dart @@ -61,7 +61,9 @@ class License { } static Future _precessWpp() async { - final bool whatsapp = await StorageHelper().get(LocalsStorageKey.whatsapp.key).then((v) => v.toBoolean); + final bool whatsapp = await StorageHelper() + .get(LocalsStorageKey.whatsapp.key) + .then((v) => v.toBoolean); if (whatsapp) return ModuleStatus.active.key; else @@ -69,7 +71,9 @@ class License { } static Future _processProvisional() async { - final bool provisional = await StorageHelper().get(LocalsStorageKey.provisional.key).then((v) => v.toBoolean); + final bool provisional = await StorageHelper() + .get(LocalsStorageKey.provisional.key) + .then((v) => v.toBoolean); if (provisional) return ModuleStatus.active.key; else @@ -77,7 +81,9 @@ class License { } static Future _processPets() async { - final bool pets = await StorageHelper().get(LocalsStorageKey.pets.key).then((v) => v.toBoolean); + final bool pets = await StorageHelper() + .get(LocalsStorageKey.pets.key) + .then((v) => v.toBoolean); if (pets) return ModuleStatus.active.key; else @@ -134,14 +140,18 @@ class License { ), Module( key: LicenseKeys.openedVisits.value, - display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key, + display: isNewVersionWithModule + ? ModuleStatus.active.key + : ModuleStatus.inactive.key, expirationDate: '', startDate: '', quantity: 0, ), Module( key: LicenseKeys.vehicles.value, - display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key, + display: isNewVersionWithModule + ? ModuleStatus.active.key + : ModuleStatus.inactive.key, expirationDate: '', startDate: '', quantity: 0, @@ -155,7 +165,9 @@ class License { ), Module( key: LicenseKeys.residents.value, - display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key, + display: isNewVersionWithModule + ? ModuleStatus.active.key + : ModuleStatus.inactive.key, expirationDate: '', startDate: '', quantity: 0, @@ -218,14 +230,18 @@ class License { ), Module( key: LicenseKeys.property.value, - display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key, + display: isNewVersionWithModule + ? ModuleStatus.active.key + : ModuleStatus.inactive.key, expirationDate: '', startDate: '', quantity: 0, ), Module( key: LicenseKeys.people.value, - display: isNewVersionWithModule ? ModuleStatus.inactive.key : ModuleStatus.active.key, + display: isNewVersionWithModule + ? ModuleStatus.inactive.key + : ModuleStatus.active.key, expirationDate: '', startDate: '', quantity: 0, diff --git a/lib/features/notification/deep_link_service.dart b/lib/features/notification/deep_link_service.dart index 374a8cd5..77792519 100644 --- a/lib/features/notification/deep_link_service.dart +++ b/lib/features/notification/deep_link_service.dart @@ -65,7 +65,8 @@ class DeepLinkService { ), ), isScrollControlled: true, - backgroundColor: FlutterFlowTheme.of(navigatorKey.currentContext!).primaryBackground, + backgroundColor: FlutterFlowTheme.of(navigatorKey.currentContext!) + .primaryBackground, showDragHandle: true, useSafeArea: true, enableDrag: true, diff --git a/lib/flutter_flow/nav/nav.dart b/lib/flutter_flow/nav/nav.dart index cadc837a..6da3a666 100644 --- a/lib/flutter_flow/nav/nav.dart +++ b/lib/flutter_flow/nav/nav.dart @@ -86,11 +86,20 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { builder: (context, _) { return FutureBuilder( future: () async { - final bool isLogged = await StorageHelper().get(SecureStorageKey.isLogged.value) == 'true'; - final bool haveLocal = await StorageHelper().get(SecureStorageKey.haveLocal.value) == 'true'; + final bool isLogged = + await StorageHelper().get(SecureStorageKey.isLogged.value) == + 'true'; + final bool haveLocal = + await StorageHelper().get(SecureStorageKey.haveLocal.value) == + 'true'; final bool haveUserUUID = - (await StorageHelper().get(ProfileStorageKey.userUUID.key))?.isNotEmpty ?? false; - final bool haveDevUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key))?.isNotEmpty ?? false; + (await StorageHelper().get(ProfileStorageKey.userUUID.key)) + ?.isNotEmpty ?? + false; + final bool haveDevUUID = + (await StorageHelper().get(ProfileStorageKey.devUUID.key)) + ?.isNotEmpty ?? + false; if (isLogged && haveDevUUID && haveUserUUID) { return haveLocal @@ -100,17 +109,20 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { create: (context) => MenuBloc( style: MenuView.list_grid, item: EnumMenuItem.button, - entries: MenuEntry.getEntriesByType(MenuEntryType.Home), + entries: MenuEntry.getEntriesByType( + MenuEntryType.Home), )..add(MenuEvent()), ), BlocProvider( create: (context) => HomeBloc()..add(HomeEvent()), ), BlocProvider( - create: (context) => LocalProfileBloc()..add(LocalProfileEvent()), + create: (context) => + LocalProfileBloc()..add(LocalProfileEvent()), ), ], - child: HomePageWidget(key: UniqueKey(), LocalsRepositoryImpl().update), + child: HomePageWidget( + key: UniqueKey(), LocalsRepositoryImpl().update), ) : const ReceptionPageWidget(); } else { @@ -134,8 +146,10 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { name: 'forgotPassword', path: '/forgotPassword', builder: (context, params) { - late final String email = params.getParam('email', ParamType.String); - late final String token = params.getParam('token', ParamType.String); + late final String email = + params.getParam('email', ParamType.String); + late final String token = + params.getParam('token', ParamType.String); return ForgotPasswordScreen( key: ValueKey('ForgotPasswordScreen'), @@ -152,7 +166,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { name: 'homePage', path: '/homePage', builder: (context, params) { - final Future Function(BuildContext context)? update = params.getParam('update', ParamType.Function); + final Future Function(BuildContext context)? update = + params.getParam('update', ParamType.Function); return MultiBlocProvider( providers: [ BlocProvider( @@ -166,7 +181,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { create: (context) => HomeBloc()..add(HomeEvent()), ), BlocProvider( - create: (context) => LocalProfileBloc()..add(LocalProfileEvent()), + create: (context) => + LocalProfileBloc()..add(LocalProfileEvent()), ), ], child: HomePageWidget(key: UniqueKey(), update), @@ -175,12 +191,16 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { FFRoute( name: 'petsOnThePropertyPage', path: '/petsOnThePropertyPage', - builder: (context, params) => Scaffold(body: const PetsHistoryScreen(isApp: true))), + builder: (context, params) => + Scaffold(body: const PetsHistoryScreen(isApp: true))), FFRoute( name: 'vehiclesOnThePropertyPage', path: '/vehiclesOnThePropertyPage', builder: (context, params) => const VehiclePage()), - FFRoute(name: 'receptionPage', path: '/receptionPage', builder: (context, params) => const ReceptionPageWidget()), + FFRoute( + name: 'receptionPage', + path: '/receptionPage', + builder: (context, params) => const ReceptionPageWidget()), FFRoute( name: 'messageHistoryPage', path: '/messageHistoryPage', @@ -192,19 +212,28 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { FFRoute( name: 'scheduleCompleteVisitPage', path: '/scheduleCompleteVisitPage', - builder: (context, params) => const ScheduleCompleteVisitPageWidget()), + builder: (context, params) => + const ScheduleCompleteVisitPageWidget()), FFRoute( - name: 'deliverySchedule', path: '/deliverySchedule', builder: (context, params) => const DeliverySchedule()), + name: 'deliverySchedule', + path: '/deliverySchedule', + builder: (context, params) => const DeliverySchedule()), FFRoute( name: 'provisionalSchedule', path: '/provisionalSchedule', builder: (context, params) => const ProvisionalSchedule()), - FFRoute(name: 'fastPassPage', path: '/fastPassPage', builder: (context, params) => FastPassPageWidget()), + FFRoute( + name: 'fastPassPage', + path: '/fastPassPage', + builder: (context, params) => FastPassPageWidget()), FFRoute( name: 'preferencesSettings', path: '/preferencesSettings', builder: (context, params) => PreferencesPageWidget()), - FFRoute(name: 'aboutProperty', path: '/aboutProperty', builder: (context, params) => AboutPropertyPage()), + FFRoute( + name: 'aboutProperty', + path: '/aboutProperty', + builder: (context, params) => AboutPropertyPage()), FFRoute( name: 'residentsOnThePropertyPage', path: '/residentsOnThePropertyPage', @@ -220,8 +249,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { FFRoute( name: 'acessHistoryPage', path: '/acessHistoryPage', - builder: (context, params) => - AccessHistoryScreen(opt: const {'personType': '.*', 'accessType': '.*', 'search': '.*'})), + builder: (context, params) => AccessHistoryScreen(opt: const { + 'personType': '.*', + 'accessType': '.*', + 'search': '.*' + })), FFRoute( name: 'provisionalHistoryPage', path: '/provisionalHistoryPage', @@ -230,13 +262,34 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { name: 'liberationHistory', path: '/liberationHistory', builder: (context, params) => const LiberationHistoryWidget()), - FFRoute(name: 'signInPage', path: '/signInPage', builder: (context, params) => const SignInPageWidget()), - FFRoute(name: 'signUpPage', path: '/signUpPage', builder: (context, params) => const SignUpPageWidget()), - FFRoute(name: 'welcomePage', path: '/welcomePage', builder: (context, params) => const WelcomePage()), - FFRoute(name: 'qrCodePage', path: '/qrCodePage', builder: (context, params) => const QrCodePageWidget()), - FFRoute(name: 'preferencesPage', path: '/preferencesPage', builder: (context, params) => PreferencesPageWidget()), - FFRoute(name: 'packageOrder', path: '/packageOrder', builder: (context, params) => const PackageOrderPage()), - FFRoute(name: 'reservation', path: '/reservation', builder: (context, params) => ReservationPageWidget()), + FFRoute( + name: 'signInPage', + path: '/signInPage', + builder: (context, params) => const SignInPageWidget()), + FFRoute( + name: 'signUpPage', + path: '/signUpPage', + builder: (context, params) => const SignUpPageWidget()), + FFRoute( + name: 'welcomePage', + path: '/welcomePage', + builder: (context, params) => const WelcomePage()), + FFRoute( + name: 'qrCodePage', + path: '/qrCodePage', + builder: (context, params) => const QrCodePageWidget()), + FFRoute( + name: 'preferencesPage', + path: '/preferencesPage', + builder: (context, params) => PreferencesPageWidget()), + FFRoute( + name: 'packageOrder', + path: '/packageOrder', + builder: (context, params) => const PackageOrderPage()), + FFRoute( + name: 'reservation', + path: '/reservation', + builder: (context, params) => ReservationPageWidget()), FFRoute( name: 'petsPage', path: '/petsPage', @@ -252,7 +305,9 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { extension NavParamExtensions on Map { Map get withoutNulls => Map.fromEntries( - entries.where((e) => e.value != null).map((e) => MapEntry(e.key, e.value!)), + entries + .where((e) => e.value != null) + .map((e) => MapEntry(e.key, e.value!)), ); } @@ -266,7 +321,8 @@ extension NavigationExtensions on BuildContext { } extension _GoRouterStateExtensions on GoRouterState { - Map get extraMap => extra != null ? extra as Map : {}; + Map get extraMap => + extra != null ? extra as Map : {}; Map get allParams => {} ..addAll(pathParameters) ..addAll(uri.queryParameters) @@ -279,8 +335,9 @@ extension _GoRouterStateExtensions on GoRouterState { extension GoRouterLocationExtension on GoRouter { String getCurrentLocation() { final RouteMatch lastMatch = routerDelegate.currentConfiguration.last; - final RouteMatchList matchList = - lastMatch is ImperativeRouteMatch ? lastMatch.matches : routerDelegate.currentConfiguration; + final RouteMatchList matchList = lastMatch is ImperativeRouteMatch + ? lastMatch.matches + : routerDelegate.currentConfiguration; return matchList.uri.toString(); } } @@ -293,13 +350,17 @@ class FFParameters { Map futureParamValues = {}; bool get isEmpty => - state.allParams.isEmpty || (state.allParams.length == 1 && state.extraMap.containsKey(kTransitionInfoKey)); - bool isAsyncParam(MapEntry param) => asyncParams.containsKey(param.key) && param.value is String; + state.allParams.isEmpty || + (state.allParams.length == 1 && + state.extraMap.containsKey(kTransitionInfoKey)); + bool isAsyncParam(MapEntry param) => + asyncParams.containsKey(param.key) && param.value is String; bool get hasFutures => state.allParams.entries.any(isAsyncParam); Future completeFutures() => Future.wait( state.allParams.entries.where(isAsyncParam).map( (param) async { - final doc = await asyncParams[param.key]!(param.value).onError((_, __) => null); + final doc = await asyncParams[param.key]!(param.value) + .onError((_, __) => null); if (doc != null) { futureParamValues[param.key] = doc; return true; @@ -309,12 +370,15 @@ class FFParameters { ), ).onError((_, __) => [false]).then((v) => v.every((e) => e)); - dynamic getParam(String paramName, ParamType type, {bool isList = false, StructBuilder? structBuilder}) { - if (futureParamValues.containsKey(paramName)) return futureParamValues[paramName]; + dynamic getParam(String paramName, ParamType type, + {bool isList = false, StructBuilder? structBuilder}) { + if (futureParamValues.containsKey(paramName)) + return futureParamValues[paramName]; if (!state.allParams.containsKey(paramName)) return null; final param = state.allParams[paramName]; if (param is! String) return param; - return deserializeParam(param, type, isList, structBuilder: structBuilder); + return deserializeParam(param, type, isList, + structBuilder: structBuilder); } } @@ -354,13 +418,16 @@ class FFRoute { key: state.pageKey, child: child, transitionDuration: transitionInfo.duration, - transitionsBuilder: (context, animation, secondaryAnimation, child) => PageTransition( + transitionsBuilder: + (context, animation, secondaryAnimation, child) => + PageTransition( type: transitionInfo.transitionType, duration: transitionInfo.duration, reverseDuration: transitionInfo.duration, alignment: transitionInfo.alignment, child: child, - ).buildTransitions(context, animation, secondaryAnimation, child), + ).buildTransitions( + context, animation, secondaryAnimation, child), ) : MaterialPage(key: state.pageKey, child: child); }, @@ -381,7 +448,8 @@ class TransitionInfo { final Duration duration; final Alignment? alignment; - static TransitionInfo appDefault() => const TransitionInfo(hasTransition: false); + static TransitionInfo appDefault() => + const TransitionInfo(hasTransition: false); } class RootPageContext { @@ -393,7 +461,9 @@ class RootPageContext { final rootPageContext = context.read(); final isRootPage = rootPageContext?.isRootPage ?? false; final location = GoRouterState.of(context).uri.toString(); - return isRootPage && location != '/' && location != rootPageContext?.errorRoute; + return isRootPage && + location != '/' && + location != rootPageContext?.errorRoute; } static Widget wrap(Widget child, {String? errorRoute}) => diff --git a/lib/initialization.dart b/lib/initialization.dart index 217044ec..3f780c8c 100644 --- a/lib/initialization.dart +++ b/lib/initialization.dart @@ -1,4 +1,3 @@ - import 'package:app_tracking_transparency/app_tracking_transparency.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart'; diff --git a/lib/main.dart b/lib/main.dart index 144a9fb5..3e98ba72 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -53,7 +53,8 @@ class App extends StatefulWidget { @override State createState() => _AppState(); - static _AppState of(BuildContext context) => context.findAncestorStateOfType<_AppState>()!; + static _AppState of(BuildContext context) => + context.findAncestorStateOfType<_AppState>()!; } class _AppState extends State { @@ -95,7 +96,8 @@ class _AppState extends State { }), ), ); - final Iterable>? localizationsDelegates = const [ + final Iterable>? localizationsDelegates = + const [ FFLocalizationsDelegate(), GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -137,7 +139,8 @@ class _AppState extends State { await StorageHelper().set(SecureStorageKey.haveLocal.value, true); log('onMessageOpenedApp'); } else { - onMessageReceived(message.data, message.notification!.body, message.data['click_action']); + onMessageReceived(message.data, message.notification!.body, + message.data['click_action']); } }); FirebaseMessaging.instance.getInitialMessage().then((message) async { @@ -171,7 +174,9 @@ class _AppState extends State { _router = createRouter(_appStateNotifier); Future.delayed( const Duration(milliseconds: 1000), - () => mounted ? setState(() => _appStateNotifier.stopShowingSplashImage()) : null, + () => mounted + ? setState(() => _appStateNotifier.stopShowingSplashImage()) + : null, ); _setupFirebaseMessaging(); diff --git a/lib/pages/forgot_password_page/forgot_password_screen.dart b/lib/pages/forgot_password_page/forgot_password_screen.dart index da97657c..99d0914d 100644 --- a/lib/pages/forgot_password_page/forgot_password_screen.dart +++ b/lib/pages/forgot_password_page/forgot_password_screen.dart @@ -15,7 +15,8 @@ import '../../flutter_flow/internationalization.dart'; import 'forgot_password_model.dart'; class ForgotPasswordScreen extends StatefulWidget { - const ForgotPasswordScreen({super.key, required this.email, required this.token}); + const ForgotPasswordScreen( + {super.key, required this.email, required this.token}); final String email; final String token; @@ -23,7 +24,8 @@ class ForgotPasswordScreen extends StatefulWidget { State createState() => _ForgotPasswordScreenState(); } -class _ForgotPasswordScreenState extends State with TickerProviderStateMixin { +class _ForgotPasswordScreenState extends State + with TickerProviderStateMixin { late ForgotPasswordScreenModel _model; final animationsMap = {}; @@ -148,7 +150,8 @@ class _ForgotPasswordScreenState extends State with Ticker width: MediaQuery.of(context).size.width, child: SingleChildScrollView( child: Padding( - padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 0.0), + padding: const EdgeInsets.only( + left: 15.0, right: 15.0, top: 10.0, bottom: 0.0), child: Container( width: double.infinity, constraints: const BoxConstraints(maxWidth: 570.0), @@ -157,7 +160,8 @@ class _ForgotPasswordScreenState extends State with Ticker borderRadius: BorderRadius.circular(12.0), ), child: Padding( - padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 10.0, bottom: 0.0), + padding: const EdgeInsets.only( + left: 20.0, right: 20.0, top: 10.0, bottom: 0.0), child: Column( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -171,21 +175,25 @@ class _ForgotPasswordScreenState extends State with Ticker fontSize: 24.0, fontWeight: FontWeight.bold, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), + useGoogleFonts: + GoogleFonts.asMap().containsKey('Nunito'), ), )), Align( alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(20.0, 24.0, 0.0, 30.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 24.0, 0.0, 30.0), child: Text( message, textAlign: TextAlign.start, style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, fontWeight: FontWeight.bold, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), ), ), @@ -201,32 +209,42 @@ class _ForgotPasswordScreenState extends State with Ticker controller: _model.passwordRegisterFormTextController, focusNode: _model.passwordRegisterFormFocusNode, visibility: _model.passwordRegisterFormVisibility, - onVisibilityToggle: () => setState( - () => _model.passwordRegisterFormVisibility = !_model.passwordRegisterFormVisibility), - label: - FFLocalizations.of(context).getVariableText(ptText: 'Nova Senha', enText: 'New Password'), - hint: FFLocalizations.of(context) - .getVariableText(ptText: 'Insira sua senha', enText: 'Enter your password'), - asValidator: _model.passwordRegisterFormTextControllerValidator.asValidator(context), + onVisibilityToggle: () => setState(() => + _model.passwordRegisterFormVisibility = + !_model.passwordRegisterFormVisibility), + label: FFLocalizations.of(context).getVariableText( + ptText: 'Nova Senha', enText: 'New Password'), + hint: FFLocalizations.of(context).getVariableText( + ptText: 'Insira sua senha', + enText: 'Enter your password'), + asValidator: _model + .passwordRegisterFormTextControllerValidator + .asValidator(context), ), _buildPasswordField( context, controller: _model.passwordConfirmFormTextController, focusNode: _model.passwordConfirmFormFocusNode, visibility: _model.passwordConfirmFormVisibility, - onVisibilityToggle: () => setState( - () => _model.passwordConfirmFormVisibility = !_model.passwordConfirmFormVisibility), - label: FFLocalizations.of(context) - .getVariableText(ptText: 'Confirme a Senha', enText: 'Confirm Password'), - hint: FFLocalizations.of(context) - .getVariableText(ptText: 'Confirme sua senha', enText: 'Confirm your password'), - asValidator: _model.passwordConfirmFormTextControllerValidator.asValidator(context), + onVisibilityToggle: () => setState(() => + _model.passwordConfirmFormVisibility = + !_model.passwordConfirmFormVisibility), + label: FFLocalizations.of(context).getVariableText( + ptText: 'Confirme a Senha', + enText: 'Confirm Password'), + hint: FFLocalizations.of(context).getVariableText( + ptText: 'Confirme sua senha', + enText: 'Confirm your password'), + asValidator: _model + .passwordConfirmFormTextControllerValidator + .asValidator(context), ), ], ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( key: const ValueKey('SubmitButtonWidget'), onPressed: _model.isFormInvalid() @@ -248,16 +266,22 @@ class _ForgotPasswordScreenState extends State with Ticker width: double.infinity, height: 44.0, color: FlutterFlowTheme.of(context).accent1, - textStyle: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).secondaryText, - fontSize: 16.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans')), + textStyle: FlutterFlowTheme.of(context) + .titleSmall + .override( + fontFamily: 'Plus Jakarta Sans', + color: + FlutterFlowTheme.of(context).secondaryText, + fontSize: 16.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans')), elevation: 3.0, - borderSide: const BorderSide(color: Colors.transparent, width: 1.0), + borderSide: const BorderSide( + color: Colors.transparent, width: 1.0), borderRadius: BorderRadius.circular(12.0), - disabledColor: FlutterFlowTheme.of(context).customColor5, + disabledColor: + FlutterFlowTheme.of(context).customColor5, disabledTextColor: Colors.white, ), showLoadingIndicator: true, @@ -305,22 +329,28 @@ class _ForgotPasswordScreenState extends State with Ticker color: FlutterFlowTheme.of(context).primaryText, fontSize: 16.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: + GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: FlutterFlowTheme.of(context).customColor1, width: 0.25), + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).customColor1, + width: 0.25), borderRadius: BorderRadius.circular(12.0), ), focusedBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Color(0xFF1AAB5F), width: 0.25), + borderSide: + const BorderSide(color: Color(0xFF1AAB5F), width: 0.25), borderRadius: BorderRadius.circular(12.0), ), errorBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Color(0xFFFF5963), width: 0.25), + borderSide: + const BorderSide(color: Color(0xFFFF5963), width: 0.25), borderRadius: BorderRadius.circular(12.0), ), focusedErrorBorder: OutlineInputBorder( - borderSide: const BorderSide(color: Color(0xFFFF5963), width: 0.25), + borderSide: + const BorderSide(color: Color(0xFFFF5963), width: 0.25), borderRadius: BorderRadius.circular(12.0), ), filled: true, @@ -330,7 +360,9 @@ class _ForgotPasswordScreenState extends State with Ticker onTap: onVisibilityToggle, focusNode: FocusNode(skipTraversal: true), child: Icon( - visibility ? Icons.visibility_outlined : Icons.visibility_off_outlined, + visibility + ? Icons.visibility_outlined + : Icons.visibility_off_outlined, color: FlutterFlowTheme.of(context).accent1, size: 24.0, ), @@ -341,7 +373,8 @@ class _ForgotPasswordScreenState extends State with Ticker color: FlutterFlowTheme.of(context).primaryText, fontSize: 16.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: + GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), ), validator: asValidator, ), diff --git a/lib/pages/pets_page/pets_page_model.dart b/lib/pages/pets_page/pets_page_model.dart index b24db31b..e7de27fe 100644 --- a/lib/pages/pets_page/pets_page_model.dart +++ b/lib/pages/pets_page/pets_page_model.dart @@ -504,7 +504,6 @@ class PetsPageModel extends FlutterFlowModel { ); }); }); - }, options: FFButtonOptions( height: 40, diff --git a/lib/pages/pets_page/pets_page_widget.dart b/lib/pages/pets_page/pets_page_widget.dart index a2aae357..8816c468 100644 --- a/lib/pages/pets_page/pets_page_widget.dart +++ b/lib/pages/pets_page/pets_page_widget.dart @@ -1049,6 +1049,4 @@ class _PetsPageWidgetState extends State ), ); } - - } diff --git a/lib/pages/reception_page/reception_page_widget.dart b/lib/pages/reception_page/reception_page_widget.dart index b56f8bfe..4fc8c064 100644 --- a/lib/pages/reception_page/reception_page_widget.dart +++ b/lib/pages/reception_page/reception_page_widget.dart @@ -1,4 +1,3 @@ - import 'package:awesome_notifications/awesome_notifications.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; diff --git a/lib/pages/vehicles_on_the_property/vehicle_register_screen.dart b/lib/pages/vehicles_on_the_property/vehicle_register_screen.dart index 07b786a3..c424aa3a 100644 --- a/lib/pages/vehicles_on_the_property/vehicle_register_screen.dart +++ b/lib/pages/vehicles_on_the_property/vehicle_register_screen.dart @@ -35,10 +35,13 @@ class _VehicleRegisterScreenState extends State { children: [ CustomInputUtil( controller: widget.model.textFieldControllerLicensePlate, - validator: widget.model.textControllerLicensePlateValidator.asValidator(context), + validator: widget.model.textControllerLicensePlateValidator + .asValidator(context), focusNode: widget.model.textFieldFocusLicensePlate, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'), - hintText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'), + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Placa', enText: 'License Plate'), + hintText: FFLocalizations.of(context) + .getVariableText(ptText: 'Placa', enText: 'License Plate'), suffixIcon: Symbols.format_color_text, haveMaxLength: true, onChanged: (value) => setState(() {}), @@ -46,9 +49,11 @@ class _VehicleRegisterScreenState extends State { ), CustomInputUtil( controller: widget.model.textFieldControllerModel, - validator: widget.model.textControllerModelValidator.asValidator(context), + validator: widget.model.textControllerModelValidator + .asValidator(context), focusNode: widget.model.textFieldFocusModel, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Modelo', enText: 'Model'), + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Modelo', enText: 'Model'), hintText: FFLocalizations.of(context).getVariableText( ptText: 'Ex: Voyage, Ford', enText: 'e.g. Voyage, Ford', @@ -60,9 +65,11 @@ class _VehicleRegisterScreenState extends State { ), CustomInputUtil( controller: widget.model.textFieldControllerColor, - validator: widget.model.textControllerColorValidator.asValidator(context), + validator: widget.model.textControllerColorValidator + .asValidator(context), focusNode: widget.model.textFieldFocusColor, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cor', enText: 'Color'), + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Cor', enText: 'Color'), hintText: FFLocalizations.of(context).getVariableText( ptText: 'Ex: Preto, Amarelo, Branco', enText: 'e.g. Black, Yellow, White', @@ -75,8 +82,11 @@ class _VehicleRegisterScreenState extends State { Padding( padding: const EdgeInsets.fromLTRB(70, 20, 70, 30), child: SubmitButtonUtil( - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register'), - onPressed: widget.model.isFormValid(context) ? widget.model.registerVehicle : null), + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Cadastrar', enText: 'Register'), + onPressed: widget.model.isFormValid(context) + ? widget.model.registerVehicle + : null), ), ], )); @@ -84,7 +94,8 @@ class _VehicleRegisterScreenState extends State { Align _buildHeader(BuildContext context) { // double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context); - double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context); + double limitedHeaderFontSize = + LimitedFontSizeUtil.getHeaderFontSize(context); // double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context); return Align( @@ -93,14 +104,16 @@ class _VehicleRegisterScreenState extends State { padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15), child: Text( FFLocalizations.of(context).getVariableText( - ptText: 'Preencha o formulário de cadastro com os dados do seu veículo', + ptText: + 'Preencha o formulário de cadastro com os dados do seu veículo', enText: 'Fill out the registration form with your vehicle data', ), textAlign: TextAlign.start, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), fontSize: limitedHeaderFontSize, ), ), diff --git a/lib/pages/vehicles_on_the_property/vehicle_update_screen.dart b/lib/pages/vehicles_on_the_property/vehicle_update_screen.dart index a9293149..534a9f58 100644 --- a/lib/pages/vehicles_on_the_property/vehicle_update_screen.dart +++ b/lib/pages/vehicles_on_the_property/vehicle_update_screen.dart @@ -24,14 +24,16 @@ class _VehicleUpdateScreenState extends State { padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15), child: Text( FFLocalizations.of(context).getVariableText( - ptText: 'Preencha o formulário de alteração com os dados do seu veículo', + ptText: + 'Preencha o formulário de alteração com os dados do seu veículo', enText: 'Fill out the update form with your vehicle data', ), textAlign: TextAlign.start, style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), ), ), @@ -45,10 +47,13 @@ class _VehicleUpdateScreenState extends State { children: [ CustomInputUtil( controller: widget.model.textFieldControllerLicensePlate, - validator: widget.model.textControllerLicensePlateValidator.asValidator(context), + validator: widget.model.textControllerLicensePlateValidator + .asValidator(context), focusNode: widget.model.textFieldFocusLicensePlate, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'), - hintText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'), + labelText: FFLocalizations.of(context).getVariableText( + ptText: 'Placa', enText: 'License Plate'), + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Placa', enText: 'License Plate'), suffixIcon: Symbols.format_color_text, haveMaxLength: true, onChanged: (value) => setState(() {}), @@ -58,9 +63,11 @@ class _VehicleUpdateScreenState extends State { padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), child: CustomInputUtil( controller: widget.model.textFieldControllerModel, - validator: widget.model.textControllerModelValidator.asValidator(context), + validator: widget.model.textControllerModelValidator + .asValidator(context), focusNode: widget.model.textFieldFocusModel, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Modelo', enText: 'Model'), + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Modelo', enText: 'Model'), hintText: FFLocalizations.of(context).getVariableText( ptText: 'Ex: Voyage, Ford', enText: 'e.g. Voyage, Ford', @@ -75,9 +82,11 @@ class _VehicleUpdateScreenState extends State { padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), child: CustomInputUtil( controller: widget.model.textFieldControllerColor, - validator: widget.model.textControllerColorValidator.asValidator(context), + validator: widget.model.textControllerColorValidator + .asValidator(context), focusNode: widget.model.textFieldFocusColor, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cor', enText: 'Color'), + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Cor', enText: 'Color'), hintText: FFLocalizations.of(context).getVariableText( ptText: 'Ex: Preto, Amarelo, Branco', enText: 'e.g. Black, Yellow, White', @@ -91,8 +100,11 @@ class _VehicleUpdateScreenState extends State { Padding( padding: const EdgeInsets.fromLTRB(70, 20, 70, 30), child: SubmitButtonUtil( - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Salvar', enText: 'Save'), - onPressed: widget.model.isFormValid(context) ? widget.model.updateVehicle : null), + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Salvar', enText: 'Save'), + onPressed: widget.model.isFormValid(context) + ? widget.model.updateVehicle + : null), ), ], )), diff --git a/lib/pages/vehicles_on_the_property/vehicles_on_the_property.dart b/lib/pages/vehicles_on_the_property/vehicles_on_the_property.dart index cd3b28a4..586aa3c4 100644 --- a/lib/pages/vehicles_on_the_property/vehicles_on_the_property.dart +++ b/lib/pages/vehicles_on_the_property/vehicles_on_the_property.dart @@ -1,4 +1,3 @@ - import 'dart:collection'; import 'package:flutter/material.dart'; @@ -31,7 +30,8 @@ class VehiclePage extends StatefulWidget { _VehiclePageState createState() => _VehiclePageState(); } -class _VehiclePageState extends State with TickerProviderStateMixin { +class _VehiclePageState extends State + with TickerProviderStateMixin { int count = 0; late final VehicleModel _model; @@ -99,7 +99,8 @@ class _VehiclePageState extends State with TickerProviderStateMixin Future _initializeModule() async { try { - final module = await LicenseRepositoryImpl().getModule('FRE-HUB-VEHICLES-MANAGER'); + final module = + await LicenseRepositoryImpl().getModule('FRE-HUB-VEHICLES-MANAGER'); return await LicenseUtil.processModule(module); } catch (e) { WidgetsBinding.instance.addPostFrameCallback((_) async { @@ -121,20 +122,25 @@ class _VehiclePageState extends State with TickerProviderStateMixin } Widget _buildVehicleManager(BuildContext context) { - final vehicleHistoryScreenLabel = - FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'History'); - final vehicleRegisterScreenLabel = - FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register'); - final vehicleUpdateScreenLabel = FFLocalizations.of(context).getVariableText(ptText: 'Editar', enText: 'Edit'); + final vehicleHistoryScreenLabel = FFLocalizations.of(context) + .getVariableText(ptText: 'Consultar', enText: 'History'); + final vehicleRegisterScreenLabel = FFLocalizations.of(context) + .getVariableText(ptText: 'Cadastrar', enText: 'Register'); + final vehicleUpdateScreenLabel = FFLocalizations.of(context) + .getVariableText(ptText: 'Editar', enText: 'Edit'); return TabViewUtil( context: context, model: _model, labelTab1: vehicleHistoryScreenLabel, - labelTab2: _model.isEditing ? vehicleUpdateScreenLabel : vehicleRegisterScreenLabel, + labelTab2: _model.isEditing + ? vehicleUpdateScreenLabel + : vehicleRegisterScreenLabel, controller: _model.tabBarController, widget1: VehicleHistoryScreen(_model), - widget2: _model.isEditing ? VehicleUpdateScreen(_model) : VehicleRegisterScreen(_model), + widget2: _model.isEditing + ? VehicleUpdateScreen(_model) + : VehicleRegisterScreen(_model), onEditingChanged: onEditingChanged, ); } @@ -145,14 +151,16 @@ class _VehiclePageState extends State with TickerProviderStateMixin final theme = FlutterFlowTheme.of(context); final backgroundColor = theme.primaryBackground; final primaryText = theme.primaryText; - final title = FFLocalizations.of(context).getVariableText(enText: 'Vehicles', ptText: 'Veículos'); + final title = FFLocalizations.of(context) + .getVariableText(enText: 'Vehicles', ptText: 'Veículos'); final titleStyle = theme.headlineMedium.override( fontFamily: theme.headlineMediumFamily, color: primaryText, fontSize: 16.0, fontWeight: FontWeight.bold, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), + useGoogleFonts: + GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), ); final backButton = _backButton(context, theme); diff --git a/lib/pages/visits_on_the_property/model.dart b/lib/pages/visits_on_the_property/model.dart index 4e15ebef..b263e717 100644 --- a/lib/pages/visits_on_the_property/model.dart +++ b/lib/pages/visits_on_the_property/model.dart @@ -11,7 +11,8 @@ class VisitsModel extends FlutterFlowModel { VisitsModel._internal({this.onRefresh}); - factory VisitsModel({VoidCallback? onRefresh}) => _instance ??= VisitsModel._internal(onRefresh: onRefresh); + factory VisitsModel({VoidCallback? onRefresh}) => + _instance ??= VisitsModel._internal(onRefresh: onRefresh); static void resetInstance() => _instance = null; late final VoidCallback? onRefresh; @@ -33,7 +34,8 @@ class VisitsModel extends FlutterFlowModel { Future initAsync() async { devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; - cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; + cliUUID = + (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; onRefresh?.call(); } @@ -87,7 +89,9 @@ class VisitsModel extends FlutterFlowModel { FFLocalizations.of(context).getVariableText( ptText: item['VTA_FIXA'] ? "Entrada Recorrente" : "Entrada Única", enText: item['VTA_FIXA'] ? "Recurrent Entry" : "Single Entry", - ): item['VTA_FIXA'] == false ? FlutterFlowTheme.of(context).success : FlutterFlowTheme.of(context).warning, + ): item['VTA_FIXA'] == false + ? FlutterFlowTheme.of(context).success + : FlutterFlowTheme.of(context).warning, }) ], ); diff --git a/lib/shared/constants/index.dart b/lib/shared/constants/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/constants/index.dart +++ b/lib/shared/constants/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/extensions/string_extensions.dart b/lib/shared/extensions/string_extensions.dart index 67cf03db..43d536ba 100644 --- a/lib/shared/extensions/string_extensions.dart +++ b/lib/shared/extensions/string_extensions.dart @@ -10,7 +10,7 @@ extension StringNullableExtensions on String? { return false; } - bool get isNotNullAndEmpty { + bool get isNotNullAndEmpty { if (this == null) return false; if (this == '') return false; return true; @@ -19,7 +19,6 @@ extension StringNullableExtensions on String? { extension StringExtensions on String { bool get toBoolean { - return toLowerCase() == 'true'; } } diff --git a/lib/shared/utils/license_util.dart b/lib/shared/utils/license_util.dart index 78e8bcb8..4959f1af 100644 --- a/lib/shared/utils/license_util.dart +++ b/lib/shared/utils/license_util.dart @@ -10,7 +10,8 @@ class LicenseUtil { final expirationDate = moduleMap['expirationDate'] ?? ''; final isStarted = await DateTimeUtil.processStartDate(startDate); final isExpired = await DateTimeUtil.processExpirationDate(expirationDate); - if (isStarted && !isExpired) return EnumDisplay.fromString(moduleMap["display"]) == EnumDisplay.active; + if (isStarted && !isExpired) + return EnumDisplay.fromString(moduleMap["display"]) == EnumDisplay.active; if (isExpired) return false; return false; }