From 28852d719faf9e4eb3f423dc70d44c3731ad6768 Mon Sep 17 00:00:00 2001 From: "J. A. Messias" Date: Wed, 18 Dec 2024 10:53:24 -0300 Subject: [PATCH] dart format --- integration_test/app_test.dart | 53 +- .../features/provisional_history_test.dart | 6 +- lib/backend/api_requests/api_calls.dart | 435 +++-- lib/backend/api_requests/api_manager.dart | 77 +- .../api_requests/get_streamed_response.dart | 3 +- .../firebase_messaging_service.dart | 6 +- .../notifications/notification_service.dart | 66 +- lib/backend/schema/enums/enums.dart | 3 +- lib/backend/schema/structs/device_struct.dart | 6 +- lib/backend/schema/util/schema_util.dart | 20 +- .../atom_image_svg_theme.dart | 6 +- .../custom_datepicker.dart | 69 +- .../custom_select.dart | 42 +- .../media_upload_button.dart | 41 +- .../submit_button.dart | 3 +- .../shared_components_atoms/tabview.dart | 3 +- .../text_field_component_model.dart | 3 +- .../text_field_component_widget.dart | 15 +- .../option_selection_modal_model.dart | 3 +- .../option_selection_modal_widget.dart | 49 +- .../order_filter_modal_model.dart | 5 +- .../order_filter_modal_widget.dart | 68 +- .../throw_exception_widget.dart | 38 +- .../visitor_not_found_component_model.dart | 3 +- .../visitor_not_found_component_widget.dart | 37 +- ...m_arrow_linked_locals_component_model.dart | 3 +- ..._arrow_linked_locals_component_widget.dart | 80 +- .../schedule_visit_detail_model.dart | 15 +- .../schedule_visit_detail_widget.dart | 396 +++-- ...p_arrow_linked_locals_component_model.dart | 15 +- ..._arrow_linked_locals_component_widget.dart | 64 +- ...cation_modal_template_component_model.dart | 12 +- ...ation_modal_template_component_widget.dart | 163 +- .../card_item_template_component_model.dart | 6 +- .../card_item_template_component_widget.dart | 25 +- .../change_pass_model.dart | 6 +- .../change_pass_widget.dart | 101 +- .../details_component_widget.dart | 71 +- ...got_password_template_component_model.dart | 9 +- ...ot_password_template_component_widget.dart | 118 +- ...item_details_template_component_model.dart | 12 +- ...tem_details_template_component_widget.dart | 154 +- .../message_notification_widget.dart | 78 +- .../provisional_schedule_template_model.dart | 48 +- .../provisional_shcedule_template_widget.dart | 824 ++++++--- ...ode_pass_key_template_component_model.dart | 9 +- ...de_pass_key_template_component_widget.dart | 114 +- ...siter_vistor_template_component_model.dart | 25 +- ...iter_vistor_template_component_widget.dart | 340 ++-- .../sign_in_template_component_model.dart | 9 +- .../sign_in_template_component_widget.dart | 829 ++++++--- .../sign_up_template_component_model.dart | 33 +- .../sign_up_template_component_widget.dart | 688 ++++++-- .../view_visit_detail_model.dart | 9 +- .../view_visit_detail_widget.dart | 304 ++-- ...etails_modal_template_component_model.dart | 6 +- ...tails_modal_template_component_widget.dart | 9 +- ...etails_modal_template_component_model.dart | 6 +- ...tails_modal_template_component_widget.dart | 85 +- ...search_modal_template_component_model.dart | 21 +- ...earch_modal_template_component_widget.dart | 191 ++- .../welcome_template_component_model.dart | 6 +- .../welcome_template_component_widget.dart | 199 ++- .../_template_/data/data_sources/index.dart | 1 + .../_template_/data/models/index.dart | 1 + .../_template_/data/repositories/index.dart | 1 + .../_template_/domain/entities/index.dart | 1 + .../domain/respositories/index.dart | 1 + .../_template_/domain/usecases/index.dart | 1 + .../_template_/presentation/blocs/index.dart | 1 + .../_template_/presentation/pages/index.dart | 1 + .../presentation/widgets/index.dart | 1 + .../access_history_local_data_source.dart | 1 + ...provisional_history_local_data_source.dart | 1 + .../access_history_remote_data_source.dart | 1 + ...rovisional_history_remote_data_source.dart | 1 + lib/features/history/data/models/index.dart | 1 + .../access_history_repository_impl.dart | 1 + .../provisional_history_repository_impl.dart | 1 + .../history/domain/entities/index.dart | 1 + .../respositories/history_repository.dart | 1 + .../history/domain/usecases/index.dart | 1 + .../blocs/access_history_bloc.dart | 12 +- .../blocs/provisional_history_bloc.dart | 22 +- .../pages/acess_history_page_widget.dart | 90 +- .../pages/provisional_history_page.dart | 138 +- .../widgets/access_filter_modal.dart | 59 +- .../widgets/provisional_filter_modal.dart | 49 +- .../home/data/data_sources/index.dart | 1 + lib/features/home/data/models/index.dart | 1 + .../home/data/repositories/index.dart | 1 + lib/features/home/domain/entities/index.dart | 1 + .../home/domain/respositories/index.dart | 1 + lib/features/home/domain/usecases/index.dart | 1 + .../home/presentation/blocs/home_bloc.dart | 24 +- .../home/presentation/pages/about_system.dart | 9 +- .../home/presentation/pages/home_page.dart | 6 +- .../presentation/widgets/drawer_widget.dart | 12 +- .../home/presentation/widgets/index.dart | 1 + .../property/data/data_sources/index.dart | 1 + lib/features/property/data/models/index.dart | 1 + .../property/data/repositories/index.dart | 1 + .../property/domain/entities/index.dart | 1 + .../property/domain/respositories/index.dart | 1 + .../property/domain/usecases/index.dart | 1 + .../property/presentation/blocs/index.dart | 1 + .../pages/about_property_screen.dart | 11 +- .../property/presentation/widgets/index.dart | 1 + lib/firebase_options.dart | 9 +- lib/flutter_flow/custom_functions.dart | 5 +- lib/flutter_flow/custom_icons.dart | 3 +- lib/flutter_flow/flutter_flow_animations.dart | 14 +- .../flutter_flow_button_tabbar.dart | 121 +- .../flutter_flow_checkbox_group.dart | 16 +- lib/flutter_flow/flutter_flow_drop_down.dart | 69 +- .../flutter_flow_icon_button.dart | 12 +- lib/flutter_flow/flutter_flow_model.dart | 6 +- lib/flutter_flow/flutter_flow_theme.dart | 12 +- lib/flutter_flow/flutter_flow_util.dart | 111 +- lib/flutter_flow/flutter_flow_widgets.dart | 60 +- lib/flutter_flow/form_field_controller.dart | 3 +- lib/flutter_flow/internationalization.dart | 39 +- lib/flutter_flow/keep_alive_wrapper.dart | 3 +- lib/flutter_flow/lat_lng.dart | 5 +- lib/flutter_flow/nav/nav.dart | 214 ++- lib/flutter_flow/nav/serialization_util.dart | 10 +- lib/flutter_flow/permissions_util.dart | 3 +- lib/flutter_flow/random_data_util.dart | 9 +- lib/flutter_flow/request_manager.dart | 11 +- lib/flutter_flow/upload_data.dart | 98 +- lib/main.dart | 14 +- .../delivery_schedule_widget.dart | 6 +- .../fast_pass_page/fast_pass_page_widget.dart | 47 +- .../forgot_password_model.dart | 18 +- .../forgot_password_screen.dart | 111 +- .../liberation_history_model.dart | 12 +- .../liberation_history_widget.dart | 48 +- .../message_history_page_model.dart | 18 +- .../message_history_page_widget.dart | 68 +- .../package_order_page.dart | 97 +- .../people_on_the_property_page_model.dart | 3 +- .../people_on_the_property_page_widget.dart | 24 +- .../pets_history_screen.dart | 71 +- lib/pages/pets_page/pets_page_model.dart | 98 +- lib/pages/pets_page/pets_page_widget.dart | 1484 ++++++++++------- .../preferences_settings_model.dart | 56 +- .../preferences_settings_widget.dart | 15 +- .../provisional_schedule_widget.dart | 3 +- .../qr_code_page/qr_code_page_model.dart | 26 +- .../qr_code_page/qr_code_page_widget.dart | 142 +- .../reception_page/reception_page_model.dart | 3 +- .../reception_page/reception_page_widget.dart | 97 +- .../register_visitor_page_model.dart | 6 +- .../register_visitor_page_widget.dart | 6 +- .../reservation_page_widget.dart | 47 +- .../residents_on_the_property_model.dart | 9 +- .../residents_on_the_property_screen.dart | 49 +- .../schedule_complete_visit_page_model.dart | 94 +- .../schedule_complete_visit_page_widget.dart | 810 ++++++--- .../visit_history_page_widget.dart | 79 +- .../sign_in_page/sign_in_page_model.dart | 3 +- .../sign_up_page/sign_up_page_model.dart | 3 +- .../vehicles_on_the_property.dart | 31 +- lib/pages/visits_on_the_property/model.dart | 109 +- .../visits_on_the_property_screen.dart | 43 +- .../welcome_page/welcome_page_model.dart | 3 +- .../atoms/term_of_use/atom_terms_of_use.dart | 3 +- .../locals_local_data_source.dart | 8 +- .../locals_remote_data_source.dart | 32 +- .../molecules/locals/data/models/index.dart | 1 + .../repositories/locals_repository_impl.dart | 18 +- .../locals/domain/entities/index.dart | 1 + .../locals/domain/usecases/index.dart | 1 + .../components/molecules/locals/index.dart | 2 +- .../blocs/local_profile_bloc.dart | 38 +- .../locals/presentation/widgets/index.dart | 2 +- .../local_profile/local_profile_widget.dart | 447 ++--- .../molecules/locals/utils/local_util.dart | 112 +- .../data_sources/menu_local_data_source.dart | 45 +- .../molecules/menu/data/models/index.dart | 1 + .../repositories/menu_repository_impl.dart | 43 +- .../menu/domain/entities/menu_item.dart | 4 +- .../menu/domain/respositories/index.dart | 1 + .../domain/respositories/menu_repository.dart | 5 +- .../molecules/menu/domain/usecases/index.dart | 1 + .../menu/presentation/blocs/menu_bloc.dart | 12 +- .../presentation/blocs/menu_view_bloc.dart | 2 - .../molecules/menu/presentation/index.dart | 2 +- .../menu/presentation/mappers/menu_entry.dart | 3 +- .../menu/presentation/widgets/index.dart | 2 +- .../presentation/widgets/menu_factory.dart | 2 - .../widgets/menu_item/menu_item_button.dart | 4 +- .../widgets/menu_item/menu_item_card.dart | 4 +- .../widgets/menu_view/menu_list_view.dart | 6 +- .../menu_view/menu_staggered_view.dart | 11 +- .../molecules/modules/constants/index.dart | 2 +- .../modules/constants/license_constants.dart | 31 +- .../license_local_data_source.dart | 33 +- .../license_remote_data_source.dart | 58 +- .../modules/data/models/license_model.dart | 3 +- .../modules/data/models/module_model.dart | 3 +- .../repositories/license_repository_impl.dart | 13 +- .../modules/domain/entities/base_module.dart | 2 - .../modules/domain/entities/license.dart | 32 +- .../modules/domain/entities/module.dart | 7 - .../modules/domain/usecases/index.dart | 1 + .../components/molecules/modules/index.dart | 2 +- .../modules/presentation/blocs/index.dart | 1 + .../modules/presentation/widgets/index.dart | 1 + .../history/history_page_template.dart | 1 + .../templates/home/home_page_template.dart | 1 + .../schedule/schedule_page_template.dart | 1 + lib/shared/constants/keychain_constants.dart | 6 +- lib/shared/extensions/dialog_extensions.dart | 3 +- .../flutter_secure_storage_extensions.dart | 33 +- .../helpers/database/database_helper.dart | 10 +- .../helpers/storage/keychain_storage.dart | 14 +- .../helpers/storage/secure_storage.dart | 11 +- .../helpers/storage/storage_helper.dart | 13 +- lib/shared/index.dart | 1 + .../authentication_service.dart | 47 +- .../services/deeplink/deep_link_service.dart | 3 +- lib/shared/utils/device_util.dart | 6 +- lib/shared/utils/dialog_util.dart | 9 +- lib/shared/utils/image_util.dart | 3 +- lib/shared/utils/limited_text_size.dart | 8 +- lib/shared/utils/loading_util.dart | 7 +- lib/shared/utils/log_util.dart | 6 +- lib/shared/utils/path_util.dart | 4 +- lib/shared/utils/share_util.dart | 6 +- lib/shared/utils/snackbar_util.dart | 14 +- lib/shared/utils/text_util.dart | 5 +- 232 files changed, 8221 insertions(+), 4188 deletions(-) diff --git a/integration_test/app_test.dart b/integration_test/app_test.dart index 28e5df89..a57665f5 100644 --- a/integration_test/app_test.dart +++ b/integration_test/app_test.dart @@ -17,7 +17,9 @@ void main() { 'Initialization', () { group('Navigation', () { - setUpAll(() async => await initializeApp().then((_) async => await StorageHelper().set(SecureStorageKey.isLogged.value, 'false'))); + setUpAll(() async => await initializeApp().then((_) async => + await StorageHelper() + .set(SecureStorageKey.isLogged.value, 'false'))); testWidgets('Test Welcome', (WidgetTester tester) async { widget = tester; await _testWelcome(); @@ -32,14 +34,16 @@ void main() { group('Authentication', () { group('Sign in', () { - setUpAll(() async => await initializeApp().then((_) async => await StorageHelper().set(SecureStorageKey.isLogged.value, 'false'))); + setUpAll(() async => await initializeApp().then((_) async => + await StorageHelper().set(SecureStorageKey.isLogged.value, 'false'))); testWidgets('Test Sign In', (WidgetTester tester) async { widget = tester; await _testSignIn(); }); }); group('Sign up', () { - setUpAll(() async => await initializeApp().then((_) async => await StorageHelper().set(SecureStorageKey.isLogged.value, 'false'))); + setUpAll(() async => await initializeApp().then((_) async => + await StorageHelper().set(SecureStorageKey.isLogged.value, 'false'))); testWidgets('Test Sign Up', (WidgetTester tester) async { widget = tester; await _testSignUp(); @@ -101,24 +105,41 @@ Future _testWelcome() async { Future _testSignIn() async { await widget.pumpWidget(const App()); await _navigateToSignIn(); - await _auth({'emailTextFormField': 'erro@exemplo.com', 'passwordTextFormField': '12345678'}); - await _auth({'emailTextFormField': 'email_app@exemplo.com', 'passwordTextFormField': '12345678'}); + await _auth({ + 'emailTextFormField': 'erro@exemplo.com', + 'passwordTextFormField': '12345678' + }); + await _auth({ + 'emailTextFormField': 'email_app@exemplo.com', + 'passwordTextFormField': '12345678' + }); } Future _testSignUp() async { await widget.pumpWidget(const App()); await _navigateToSignUp(); - var credentials = {'nameTextFormField': 'app', 'emailTextFormField': 'email_app@exemplo.com', 'passwordTextFormField': '12345678'}; + var credentials = { + 'nameTextFormField': 'app', + 'emailTextFormField': 'email_app@exemplo.com', + 'passwordTextFormField': '12345678' + }; await _auth(credentials); var name = randomString(7, 7, true, true, true); var email = '$name@example.com'; var password = '12345678'; - credentials = {'nameTextFormField': name, 'emailTextFormField': email, 'passwordTextFormField': password}; + credentials = { + 'nameTextFormField': name, + 'emailTextFormField': email, + 'passwordTextFormField': password + }; await _navigateToSignUp(); await _auth(credentials); - credentials = {'emailTextFormField': email, 'passwordTextFormField': password}; + credentials = { + 'emailTextFormField': email, + 'passwordTextFormField': password + }; await _auth(credentials); } @@ -140,16 +161,20 @@ Future _testForgotPassword() async { Future _recoveryPassword() async { await widget.pumpAndSettle(); - final Finder forgotPassword = find.byKey(const ValueKey('ForgotPassword')); + final Finder forgotPassword = + find.byKey(const ValueKey('ForgotPassword')); if (forgotPassword.evaluate().isNotEmpty) await widget.tap(forgotPassword); await widget.ensureVisible(forgotPassword); await widget.pumpAndSettle(); } -Future _navigateBackUsingSystemGesture() async => IntegrationTestWidgetsFlutterBinding.instance.keyboard.isLogicalKeyPressed(LogicalKeyboardKey.escape); +Future _navigateBackUsingSystemGesture() async => + IntegrationTestWidgetsFlutterBinding.instance.keyboard + .isLogicalKeyPressed(LogicalKeyboardKey.escape); Future _navigateToSignUp() async { await widget.pumpAndSettle(); - final Finder navToSignUp = find.byKey(const ValueKey('toggleSignUpPage')); + final Finder navToSignUp = + find.byKey(const ValueKey('toggleSignUpPage')); if (navToSignUp.evaluate().isNotEmpty) { await widget.tap(navToSignUp); await widget.pumpAndSettle(); @@ -158,7 +183,8 @@ Future _navigateToSignUp() async { Future _navigateToSignIn() async { await widget.pumpAndSettle(); - final Finder navToSignIn = find.byKey(const ValueKey('toggleSignInPage')); + final Finder navToSignIn = + find.byKey(const ValueKey('toggleSignInPage')); expect(navToSignIn, findsOneWidget); if (navToSignIn.evaluate().isNotEmpty) { await widget.tap(navToSignIn); @@ -197,7 +223,8 @@ Future _submit(String key) async { await widget.pumpAndSettle(); } - final Finder throwExceptionWidget = find.byKey(const ValueKey('ThrowExceptionWidget')); + final Finder throwExceptionWidget = + find.byKey(const ValueKey('ThrowExceptionWidget')); await widget.pumpAndSettle(); if (throwExceptionWidget.evaluate().isNotEmpty) { await widget.ensureVisible(throwExceptionWidget); diff --git a/integration_test/features/provisional_history_test.dart b/integration_test/features/provisional_history_test.dart index a95362d5..32eb72a1 100644 --- a/integration_test/features/provisional_history_test.dart +++ b/integration_test/features/provisional_history_test.dart @@ -14,8 +14,10 @@ void main() { setUpAll(() async => await initializeApp().then((_) async { await StorageHelper().set(SecureStorageKey.isLogged.value, 'true'); await StorageHelper().set(SecureStorageKey.haveLocal.value, 'true'); - await StorageHelper().set(KeychainStorageKey.devUUID.value, 'b5c3818753e76d85'); - await StorageHelper().set(KeychainStorageKey.userUUID.value, '649c45d7514a28.85876308'); + await StorageHelper() + .set(KeychainStorageKey.devUUID.value, 'b5c3818753e76d85'); + await StorageHelper().set( + KeychainStorageKey.userUUID.value, '649c45d7514a28.85876308'); await StorageHelper().set(KeychainStorageKey.clientUUID.value, '7'); })); diff --git a/lib/backend/api_requests/api_calls.dart b/lib/backend/api_requests/api_calls.dart index 06f7bf5b..cc284f6b 100644 --- a/lib/backend/api_requests/api_calls.dart +++ b/lib/backend/api_requests/api_calls.dart @@ -27,17 +27,20 @@ class PhpGroup { static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall(); static ChangePasswordCall changePasswordCall = ChangePasswordCall(); static GetLocalsCall getLocalsCall = GetLocalsCall(); - static PostScheduleVisitorCall postScheduleVisitorCall = PostScheduleVisitorCall(); + static PostScheduleVisitorCall postScheduleVisitorCall = + PostScheduleVisitorCall(); static PostScheduleVisitCall postScheduleVisitCall = PostScheduleVisitCall(); static GetScheduleVisitCall getScheduleVisitCall = GetScheduleVisitCall(); static GetDadosCall getDadosCall = GetDadosCall(); static GetVisitorByDocCall getVisitorByDocCall = GetVisitorByDocCall(); static GetFotoVisitanteCall getFotoVisitanteCall = GetFotoVisitanteCall(); - static PostProvVisitSchedulingCall postProvVisitSchedulingCall = PostProvVisitSchedulingCall(); + static PostProvVisitSchedulingCall postProvVisitSchedulingCall = + PostProvVisitSchedulingCall(); static GetVisitsCall getVisitsCall = GetVisitsCall(); static DeleteVisitCall deleteVisitCall = DeleteVisitCall(); static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall(); - static RespondeSolicitacaoCall respondeSolicitacaoCall = RespondeSolicitacaoCall(); + static RespondeSolicitacaoCall respondeSolicitacaoCall = + RespondeSolicitacaoCall(); static GetAccessCall getAccessCall = GetAccessCall(); static GetLiberationsCall getLiberationsCall = GetLiberationsCall(); static GetMessagesCall getMessagesCall = GetMessagesCall(); @@ -56,7 +59,8 @@ class PhpGroup { static GetPetPhoto getPetPhoto = GetPetPhoto(); static UnregisterDevice unregisterDevice = UnregisterDevice(); static GetVehiclesByProperty getVehiclesByProperty = GetVehiclesByProperty(); - static GetResidentsByProperty getResidentsByProperty = GetResidentsByProperty(); + static GetResidentsByProperty getResidentsByProperty = + GetResidentsByProperty(); static GetOpenedVisits getOpenedVisits = GetOpenedVisits(); static GetLicense getLicense = GetLicense(); static GetProvSchedules getProvSchedules = GetProvSchedules(); @@ -65,9 +69,12 @@ class PhpGroup { class GetProvSchedules { Future call(final String page, final String status) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getAgendamentoProv'; const String pageSize = '10'; final bool isFiltered = status != '' && status != '.*'; @@ -100,9 +107,12 @@ class GetProvSchedules { class GetOpenedVisits { Future call(final String page) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getOpenedVisits'; const String pageSize = '10'; return await ApiManager.instance.makeApiCall( @@ -132,9 +142,12 @@ class GetOpenedVisits { class GetResidentsByProperty { Future call(final String page) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? ''; - final String userUUID = await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? ''; - final String cliID = await StorageHelper().get(KeychainStorageKey.clientUUID.value) ?? ''; + final String devUUID = + await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? ''; + final String userUUID = + await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? ''; + final String cliID = + await StorageHelper().get(KeychainStorageKey.clientUUID.value) ?? ''; const String atividade = 'getResidentsByProperty'; const String pageSize = '10'; return await ApiManager.instance.makeApiCall( @@ -163,9 +176,12 @@ class GetResidentsByProperty { class GetVehiclesByProperty { Future call(final String page) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getVehiclesByProperty'; const String pageSize = '10'; return await ApiManager.instance.makeApiCall( @@ -196,9 +212,12 @@ class GetVehiclesByProperty { class GetLicense { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'getLicense', @@ -227,8 +246,10 @@ class GetLicense { class UnregisterDevice { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'unregisterDevice', @@ -255,9 +276,12 @@ class UnregisterDevice { class DeletePet { Future call({final int? petID = 0}) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'excluirPet'; return await ApiManager.instance.makeApiCall( @@ -300,9 +324,12 @@ class UpdatePet { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'atualizarPet'; return await ApiManager.instance.makeApiCall( @@ -323,7 +350,9 @@ class UpdatePet { 'species': species, 'breed': breed, if (color != '') 'color': color, - if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!), + if (birthdayDate != '') + 'birthdayDate': + ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!), 'gender': gender, 'size': size, if (notes != '') 'notes': notes, @@ -346,9 +375,12 @@ class GetPets { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'consultaPets'; return await ApiManager.instance.makeApiCall( @@ -380,9 +412,12 @@ class GetPetPhoto { Future call({final int? petId}) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'consultaFotoPet'; return await ApiManager.instance.makeApiCall( @@ -423,9 +458,12 @@ class RegisterPet { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'cadastrarPet'; return await ApiManager.instance.makeApiCall( @@ -445,7 +483,9 @@ class RegisterPet { 'species': species, 'breed': breed, if (color != '') 'color': color, - if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!), + if (birthdayDate != '') + 'birthdayDate': + ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!), 'gender': gender, 'size': size, if (notes != '') 'notes': notes, @@ -468,9 +508,12 @@ class BuscaEnconcomendas { final String? adresseeType, final String? status, }) async { - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getEncomendas'; final String baseUrl = PhpGroup.getBaseUrl(); @@ -512,9 +555,12 @@ class CancelaVisita { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'cancelaVisita'; return await ApiManager.instance.makeApiCall( @@ -546,8 +592,10 @@ class CancelaVisita { class DeleteAccount { Future call() async { - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; final String baseUrl = PhpGroup.getBaseUrl(); return await ApiManager.instance.makeApiCall( @@ -578,9 +626,12 @@ class ChangePanic { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'updVisitado'; return await ApiManager.instance.makeApiCall( @@ -614,9 +665,12 @@ class ChangePass { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'updVisitado'; return await ApiManager.instance.makeApiCall( @@ -650,9 +704,12 @@ class RespondeVinculo { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'respondeVinculo', @@ -684,9 +741,12 @@ class ChangeNotifica { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'updVisitado'; return await ApiManager.instance.makeApiCall( @@ -718,10 +778,14 @@ class UpdateIDE { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - final String newIde = (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String newIde = + (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? ''; const String atividade = 'updVisitado'; return await ApiManager.instance.makeApiCall( @@ -753,9 +817,12 @@ class UpdToken { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String token = (await StorageHelper().get(SecureStorageKey.token.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String token = + (await StorageHelper().get(SecureStorageKey.token.value)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'updToken', @@ -782,11 +849,17 @@ class UpdToken { class LoginCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; - final String password = (await StorageHelper().get(SecureStorageKey.password.value)) ?? ''; - final String type = (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? ''; - final String description = (await StorageHelper().get(SecureStorageKey.deviceDescription.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String email = + (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; + final String password = + (await StorageHelper().get(SecureStorageKey.password.value)) ?? ''; + final String type = + (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? ''; + final String description = + (await StorageHelper().get(SecureStorageKey.deviceDescription.value)) ?? + ''; late final String token; try { token = await FirebaseMessagingService.getToken(); @@ -869,9 +942,12 @@ class ChangePasswordCall { required final String psswd, }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'changePassword', @@ -930,8 +1006,10 @@ class GetLocalsCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? ''; - final String userUUID = await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? ''; + final String devUUID = + await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? ''; + final String userUUID = + await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? ''; return await ApiManager.instance .makeApiCall( @@ -972,9 +1050,12 @@ class PostScheduleVisitorCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'putVisitante'; return await ApiManager.instance.makeApiCall( @@ -1027,9 +1108,12 @@ class PostScheduleVisitCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'putVisita'; return await ApiManager.instance.makeApiCall( @@ -1081,9 +1165,12 @@ class GetScheduleVisitCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getVisitas'; return await ApiManager.instance.makeApiCall( @@ -1355,32 +1442,37 @@ class GetDadosCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getDados'; - return await ApiManager.instance.makeApiCall( - callName: 'getDados', - apiUrl: '$baseUrl/processRequest.php', - callType: ApiCallType.POST, - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - params: { - 'devUUID': devUUID, - 'userUUID': userUUID, - 'cliID': cliUUID, - 'atividade': atividade, - }, - bodyType: BodyType.X_WWW_FORM_URL_ENCODED, - returnBody: true, - encodeBodyUtf8: false, - decodeUtf8: false, - cache: false, - isStreamingApi: false, - alwaysAllowBody: false, - ).timeout(const Duration(seconds: 30)); + return await ApiManager.instance + .makeApiCall( + callName: 'getDados', + apiUrl: '$baseUrl/processRequest.php', + callType: ApiCallType.POST, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + params: { + 'devUUID': devUUID, + 'userUUID': userUUID, + 'cliID': cliUUID, + 'atividade': atividade, + }, + bodyType: BodyType.X_WWW_FORM_URL_ENCODED, + returnBody: true, + encodeBodyUtf8: false, + decodeUtf8: false, + cache: false, + isStreamingApi: false, + alwaysAllowBody: false, + ) + .timeout(const Duration(seconds: 30)); } bool? errorBolean(dynamic response) => castToType(getJsonField( @@ -1391,7 +1483,8 @@ class GetDadosCall { response, r'''$.error_msg''', )); - String? visitedDesNomeStr(dynamic response) => castToType(getJsonField( + String? visitedDesNomeStr(dynamic response) => + castToType(getJsonField( response, r'''$.visitado.DES_NOME''', )); @@ -1399,27 +1492,33 @@ class GetDadosCall { response, r'''$.visitado.VDO_ID''', )); - String? visitedVDOTNomeStr(dynamic response) => castToType(getJsonField( + String? visitedVDOTNomeStr(dynamic response) => + castToType(getJsonField( response, r'''$.visitado.VDO_NOME''', )); - String? visitedVDOTipoStr(dynamic response) => castToType(getJsonField( + String? visitedVDOTipoStr(dynamic response) => + castToType(getJsonField( response, r'''$.visitado.VDO_TIPO''', )); - String? visitedVDOImeiStr(dynamic response) => castToType(getJsonField( + String? visitedVDOImeiStr(dynamic response) => + castToType(getJsonField( response, r'''$.visitado.VDO_IMEI''', )); - String? visitedVDODocumentoStr(dynamic response) => castToType(getJsonField( + String? visitedVDODocumentoStr(dynamic response) => + castToType(getJsonField( response, r'''$.visitado.VDO_DOCUMENTO''', )); - String? visitedVDOEmailStr(dynamic response) => castToType(getJsonField( + String? visitedVDOEmailStr(dynamic response) => + castToType(getJsonField( response, r'''$.visitado.VDO_EMAIL''', )); - String? visitedVDOStatusWebStr(dynamic response) => castToType(getJsonField( + String? visitedVDOStatusWebStr(dynamic response) => + castToType(getJsonField( response, r'''$.visitado.VDO_STATUSWEB''', )); @@ -1467,7 +1566,8 @@ class GetDadosCall { response, r'''$.visitado.DES_ID''', )); - String? visitedVDoNotTerceirosStr(dynamic response) => castToType(getJsonField( + String? visitedVDoNotTerceirosStr(dynamic response) => + castToType(getJsonField( response, r'''$.visitado.VDO_NOTTERCEIROS''', )); @@ -1536,7 +1636,8 @@ class GetDadosCall { .map((x) => castToType(x)) .withoutNulls .toList(); - List? levelNACIndPermiteReentradaStrList(dynamic response) => (getJsonField( + List? levelNACIndPermiteReentradaStrList(dynamic response) => + (getJsonField( response, r'''$.niveis[:].NAC_INDPERMITEREENTRADA''', true, @@ -1554,7 +1655,8 @@ class GetDadosCall { .map((x) => castToType(x)) .withoutNulls .toList(); - List? levelNACTempoAntiCaronaStrList(dynamic response) => (getJsonField( + List? levelNACTempoAntiCaronaStrList(dynamic response) => + (getJsonField( response, r'''$.niveis[:].NAC_TEMPOANTICARONA''', true, @@ -1588,9 +1690,12 @@ class GetVisitorByDocCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getVisitante'; return await ApiManager.instance.makeApiCall( @@ -1642,9 +1747,12 @@ class GetFotoVisitanteCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getFotoVisitante'; return await ApiManager.instance.makeApiCall( @@ -1681,9 +1789,12 @@ class PostProvVisitSchedulingCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'putAgendamentoProv'; return await ApiManager.instance.makeApiCall( @@ -1730,9 +1841,12 @@ class GetVisitsCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getVisitas'; return await ApiManager.instance.makeApiCall( @@ -1993,9 +2107,12 @@ class DeleteVisitCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'cancelaVisita'; return await ApiManager.instance.makeApiCall( @@ -2036,10 +2153,14 @@ class GetPessoasLocalCall { Future call() async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String ownerUUID = (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String ownerUUID = + (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; return await ApiManager.instance.makeApiCall( callName: 'getPessoasLocal', @@ -2102,9 +2223,12 @@ class RespondeSolicitacaoCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'respondeSolicitacao'; return await ApiManager.instance.makeApiCall( @@ -2152,9 +2276,12 @@ class GetAccessCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getAcessos'; return await ApiManager.instance.makeApiCall( @@ -2401,9 +2528,13 @@ class GetLiberationsCall { final StreamController controller = StreamController(); Future.microtask(() async { - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? + ''; const String atividade = 'getSolicitacoes'; try { @@ -2593,9 +2724,12 @@ class GetMessagesCall { }) async { final String baseUrl = PhpGroup.getBaseUrl(); - final String devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final String userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final String devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final String userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const String atividade = 'getMensagens'; return await ApiManager.instance.makeApiCall( @@ -2639,7 +2773,8 @@ class ApiPagingParams { }); @override - String toString() => 'PagingParams(nextPageNumber: $nextPageNumber, numItems: $numItems, lastResponse: $lastResponse,)'; + String toString() => + 'PagingParams(nextPageNumber: $nextPageNumber, numItems: $numItems, lastResponse: $lastResponse,)'; } String _toEncodable(dynamic item) { diff --git a/lib/backend/api_requests/api_manager.dart b/lib/backend/api_requests/api_manager.dart index 5e8f68bb..72087153 100644 --- a/lib/backend/api_requests/api_manager.dart +++ b/lib/backend/api_requests/api_manager.dart @@ -107,7 +107,9 @@ class ApiCallResponse { final Object? exception; bool get succeeded => statusCode >= 200 && statusCode < 300; String getHeader(String headerName) => headers[headerName] ?? ''; - String get bodyText => response?.body ?? (jsonBody is String ? jsonBody as String : jsonEncode(jsonBody)); + String get bodyText => + response?.body ?? + (jsonBody is String ? jsonBody as String : jsonEncode(jsonBody)); String get exceptionMessage => exception.toString(); static ApiCallResponse fromHttpResponse( @@ -121,7 +123,9 @@ class ApiCallResponse { if (bodyType == BodyType.BLOB) { jsonBody = response.bodyBytes; } else { - final responseBody = decodeUtf8 && returnBody ? const Utf8Decoder().convert(response.bodyBytes) : response.body; + final responseBody = decodeUtf8 && returnBody + ? const Utf8Decoder().convert(response.bodyBytes) + : response.body; jsonBody = returnBody ? json.decode(responseBody) : null; } } catch (_) {} @@ -133,7 +137,8 @@ class ApiCallResponse { ); } - static ApiCallResponse fromCloudCallResponse(Map response) => ApiCallResponse( + static ApiCallResponse fromCloudCallResponse(Map response) => + ApiCallResponse( response['body'], ApiManager.toStringMap(response['headers'] ?? {}), response['statusCode'] ?? 400, @@ -150,14 +155,17 @@ class ApiManager { static String? _accessToken; - static void clearCache(String callName) => - _apiCache.keys.toSet().forEach((k) => k.callName == callName ? _apiCache.remove(k) : null); + static void clearCache(String callName) => _apiCache.keys + .toSet() + .forEach((k) => k.callName == callName ? _apiCache.remove(k) : null); static Map toStringMap(Map map) => map.map((key, value) => MapEntry(key.toString(), value.toString())); - static String asQueryParams(Map map) => - map.entries.map((e) => "${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value.toString())}").join('&'); + static String asQueryParams(Map map) => map.entries + .map((e) => + "${Uri.encodeComponent(e.key)}=${Uri.encodeComponent(e.value.toString())}") + .join('&'); static Future urlRequest( ApiCallType callType, @@ -171,13 +179,15 @@ class ApiManager { BodyType? bodyType, }) async { if (params.isNotEmpty) { - final specifier = Uri.parse(apiUrl).queryParameters.isNotEmpty ? '&' : '?'; + final specifier = + Uri.parse(apiUrl).queryParameters.isNotEmpty ? '&' : '?'; apiUrl = '$apiUrl$specifier${asQueryParams(params)}'; } if (isStreamingApi) { client ??= http.Client(); - final request = http.Request(callType.toString().split('.').last, Uri.parse(apiUrl)) - ..headers.addAll(toStringMap(headers)); + final request = + http.Request(callType.toString().split('.').last, Uri.parse(apiUrl)) + ..headers.addAll(toStringMap(headers)); final streamedResponse = await getStreamedResponse(request); return ApiCallResponse( null, @@ -189,8 +199,10 @@ class ApiManager { final makeRequest = callType == ApiCallType.GET ? (client != null ? client.get : http.get) : (client != null ? client.delete : http.delete); - final response = await makeRequest(Uri.parse(apiUrl), headers: toStringMap(headers)); - return ApiCallResponse.fromHttpResponse(response, returnBody, decodeUtf8, bodyType); + final response = + await makeRequest(Uri.parse(apiUrl), headers: toStringMap(headers)); + return ApiCallResponse.fromHttpResponse( + response, returnBody, decodeUtf8, bodyType); } static Future requestWithBody( @@ -212,11 +224,13 @@ class ApiManager { (alwaysAllowBody && type == ApiCallType.DELETE), 'Invalid ApiCallType $type for request with body', ); - final postBody = createBody(headers, params, body, bodyType, encodeBodyUtf8); + final postBody = + createBody(headers, params, body, bodyType, encodeBodyUtf8); if (isStreamingApi) { client ??= http.Client(); - final request = http.Request(type.toString().split('.').last, Uri.parse(apiUrl)) - ..headers.addAll(toStringMap(headers)); + final request = + http.Request(type.toString().split('.').last, Uri.parse(apiUrl)) + ..headers.addAll(toStringMap(headers)); request.body = postBody; final streamedResponse = await getStreamedResponse(request); return ApiCallResponse( @@ -228,7 +242,8 @@ class ApiManager { } if (bodyType == BodyType.MULTIPART) { - return multipartRequest(type, apiUrl, headers, params, returnBody, decodeUtf8, alwaysAllowBody, bodyType); + return multipartRequest(type, apiUrl, headers, params, returnBody, + decodeUtf8, alwaysAllowBody, bodyType); } final requestFn = { @@ -237,8 +252,10 @@ class ApiManager { ApiCallType.PATCH: client != null ? client.patch : http.patch, ApiCallType.DELETE: client != null ? client.delete : http.delete, }[type]!; - final response = await requestFn(Uri.parse(apiUrl), headers: toStringMap(headers), body: postBody); - return ApiCallResponse.fromHttpResponse(response, returnBody, decodeUtf8, bodyType); + final response = await requestFn(Uri.parse(apiUrl), + headers: toStringMap(headers), body: postBody); + return ApiCallResponse.fromHttpResponse( + response, returnBody, decodeUtf8, bodyType); } static Future multipartRequest( @@ -258,14 +275,19 @@ class ApiManager { ); bool isFile(dynamic e) => - e is FFUploadedFile || e is List || (e is List && e.firstOrNull is FFUploadedFile); + e is FFUploadedFile || + e is List || + (e is List && e.firstOrNull is FFUploadedFile); - final nonFileParams = toStringMap(Map.fromEntries(params.entries.where((e) => !isFile(e.value)))); + final nonFileParams = toStringMap( + Map.fromEntries(params.entries.where((e) => !isFile(e.value)))); List files = []; params.entries.where((e) => isFile(e.value)).forEach((e) { final param = e.value; - final uploadedFiles = param is List ? param as List : [param as FFUploadedFile]; + final uploadedFiles = param is List + ? param as List + : [param as FFUploadedFile]; for (var uploadedFile in uploadedFiles) { files.add( http.MultipartFile.fromBytes( @@ -278,13 +300,15 @@ class ApiManager { } }); - final request = http.MultipartRequest(type.toString().split('.').last, Uri.parse(apiUrl)) + final request = http.MultipartRequest( + type.toString().split('.').last, Uri.parse(apiUrl)) ..headers.addAll(toStringMap(headers)) ..files.addAll(files); nonFileParams.forEach((key, value) => request.fields[key] = value); final response = await http.Response.fromStream(await request.send()); - return ApiCallResponse.fromHttpResponse(response, returnBody, decodeUtf8, bodyType); + return ApiCallResponse.fromHttpResponse( + response, returnBody, decodeUtf8, bodyType); } static MediaType? _getMediaType(String? filename) { @@ -333,10 +357,13 @@ class ApiManager { case null: break; } - if (contentType != null && !headers.keys.any((h) => h.toLowerCase() == 'content-type')) { + if (contentType != null && + !headers.keys.any((h) => h.toLowerCase() == 'content-type')) { headers['Content-Type'] = contentType; } - return encodeBodyUtf8 && postBody is String ? utf8.encode(postBody) : postBody; + return encodeBodyUtf8 && postBody is String + ? utf8.encode(postBody) + : postBody; } Future call(ApiCallOptions options) => makeApiCall( diff --git a/lib/backend/api_requests/get_streamed_response.dart b/lib/backend/api_requests/get_streamed_response.dart index 73280a05..1a53aab0 100644 --- a/lib/backend/api_requests/get_streamed_response.dart +++ b/lib/backend/api_requests/get_streamed_response.dart @@ -1,3 +1,4 @@ import 'package:http/http.dart'; -Future getStreamedResponse(Request request) => Client().send(request); +Future getStreamedResponse(Request request) => + Client().send(request); diff --git a/lib/backend/notifications/firebase_messaging_service.dart b/lib/backend/notifications/firebase_messaging_service.dart index 3b768ad2..846be8a9 100644 --- a/lib/backend/notifications/firebase_messaging_service.dart +++ b/lib/backend/notifications/firebase_messaging_service.dart @@ -17,7 +17,8 @@ Future handleMessage(RemoteMessage message) async { class FirebaseMessagingService { // Singleton instance - static final FirebaseMessagingService _instance = FirebaseMessagingService._internal(); + static final FirebaseMessagingService _instance = + FirebaseMessagingService._internal(); // Factory constructor factory FirebaseMessagingService() => _instance; @@ -36,7 +37,8 @@ class FirebaseMessagingService { _firebaseMessaging.pluginConstants; } - static Future getToken() async => await FirebaseMessaging.instance.getToken() ?? ''; + static Future getToken() async => + await FirebaseMessaging.instance.getToken() ?? ''; Future updateDeviceToken() async { try { diff --git a/lib/backend/notifications/notification_service.dart b/lib/backend/notifications/notification_service.dart index 36284d57..ecd7c88f 100644 --- a/lib/backend/notifications/notification_service.dart +++ b/lib/backend/notifications/notification_service.dart @@ -12,10 +12,12 @@ import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart'; import 'package:hub/shared/utils/dialog_util.dart'; -Future onMessageReceived(Map payload, String? extra, String? handleClick) async { +Future onMessageReceived( + Map payload, String? extra, String? handleClick) async { final localId = jsonDecode(payload['local']!)['CLI_ID']; - final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; answersRequest( {required BuildContext context, @@ -63,8 +65,10 @@ Future onMessageReceived(Map payload, String? extra, Stri enText: 'Approve Visit', ), FFLocalizations.of(context).getVariableText( - ptText: 'Você tem certeza que deseja aprovar essa visita?', - enText: 'Are you sure you want to approve this visit?', + ptText: + 'Você tem certeza que deseja aprovar essa visita?', + enText: + 'Are you sure you want to approve this visit?', ), () async { await answersRequest( @@ -101,8 +105,10 @@ Future onMessageReceived(Map payload, String? extra, Stri enText: 'Block Visit', ), FFLocalizations.of(context).getVariableText( - ptText: 'Você tem certeza que deseja bloquear essa visita?', - enText: 'Are you sure you want to block this visit?', + ptText: + 'Você tem certeza que deseja bloquear essa visita?', + enText: + 'Are you sure you want to block this visit?', ), () async { await answersRequest .call( @@ -183,11 +189,15 @@ Future onMessageReceived(Map payload, String? extra, Stri FFLocalizations.of(context).getVariableText( enText: 'Name', ptText: 'Nome', - ): payload['PES_NOME'] != null ? payload['PES_NOME'].toString() : payload['USR_NOME'].toString(), + ): payload['PES_NOME'] != null + ? payload['PES_NOME'].toString() + : payload['USR_NOME'].toString(), FFLocalizations.of(context).getVariableText( enText: 'Type', ptText: 'Tipo', - ): payload['USR_TIPO'].toString() == 'O' ? 'Morador' : 'Visitante', + ): payload['USR_TIPO'].toString() == 'O' + ? 'Morador' + : 'Visitante', FFLocalizations.of(context).getVariableText( enText: 'Access Date', ptText: 'Data de Acesso', @@ -230,8 +240,11 @@ Future onMessageReceived(Map payload, String? extra, Stri child: MessageNotificationModalTemplateComponentWidget( id: localId, from: payload['remetente'].toString(), - to: payload['destinatario'].toString() == 'O' ? 'Morador' : 'Visitante', - message: extra.toString().isEmpty ? 'Unknown' : extra.toString(), + to: payload['destinatario'].toString() == 'O' + ? 'Morador' + : 'Visitante', + message: + extra.toString().isEmpty ? 'Unknown' : extra.toString(), ), ), ); @@ -266,16 +279,24 @@ class NotificationService { ledColor: Colors.white, ) ], - channelGroups: [NotificationChannelGroup(channelGroupKey: 'basic_channel_group', channelGroupName: 'group_1')], + channelGroups: [ + NotificationChannelGroup( + channelGroupKey: 'basic_channel_group', + channelGroupName: 'group_1') + ], debug: kDebugMode); - await AwesomeNotifications().isNotificationAllowed().then((isAllowed) async { - final bool requestOSnotification = - (await StorageHelper().get(KeychainStorageKey.requestOSNotification.value)) == 'true'; + await AwesomeNotifications() + .isNotificationAllowed() + .then((isAllowed) async { + final bool requestOSnotification = (await StorageHelper() + .get(KeychainStorageKey.requestOSNotification.value)) == + 'true'; if (requestOSnotification == false) { if (isAllowed == false) { - await StorageHelper().set(KeychainStorageKey.requestOSNotification.value, true); + await StorageHelper() + .set(KeychainStorageKey.requestOSNotification.value, true); await AwesomeNotifications().requestPermissionToSendNotifications(); } } @@ -289,18 +310,22 @@ class NotificationService { onDismissActionReceivedMethod: onDismissActionReceivedMethod); } - static Future onActionReceivedMethod(ReceivedAction receivedAction) async { + static Future onActionReceivedMethod( + ReceivedAction receivedAction) async { final payload = receivedAction.payload ?? {}; final extra = receivedAction.body; final handleClick = payload['click_action']; onMessageReceived(payload, extra, handleClick); } - static Future onNotificationCreatedMethod(ReceivedNotification receivedNotification) async {} + static Future onNotificationCreatedMethod( + ReceivedNotification receivedNotification) async {} - static Future onNotificationDisplayedMethod(ReceivedNotification receivedNotification) async {} + static Future onNotificationDisplayedMethod( + ReceivedNotification receivedNotification) async {} - static Future onDismissActionReceivedMethod(ReceivedAction receivedAction) async {} + static Future onDismissActionReceivedMethod( + ReceivedAction receivedAction) async {} static Future show({ required final String title, @@ -334,7 +359,8 @@ class NotificationService { schedule: scheduled ? NotificationInterval( interval: Duration(seconds: interval!), - timeZone: await AwesomeNotifications().getLocalTimeZoneIdentifier(), + timeZone: + await AwesomeNotifications().getLocalTimeZoneIdentifier(), preciseAlarm: true) : null); } diff --git a/lib/backend/schema/enums/enums.dart b/lib/backend/schema/enums/enums.dart index 8f7ed174..cfef83fe 100644 --- a/lib/backend/schema/enums/enums.dart +++ b/lib/backend/schema/enums/enums.dart @@ -10,7 +10,8 @@ extension FFEnumExtensions on T { } extension FFEnumListExtensions on Iterable { - T? deserialize(String? value) => firstWhereOrNull((e) => e.serialize() == value); + T? deserialize(String? value) => + firstWhereOrNull((e) => e.serialize() == value); } T? deserializeEnum(String? value) { diff --git a/lib/backend/schema/structs/device_struct.dart b/lib/backend/schema/structs/device_struct.dart index 620863c4..ea504028 100644 --- a/lib/backend/schema/structs/device_struct.dart +++ b/lib/backend/schema/structs/device_struct.dart @@ -65,7 +65,8 @@ class DeviceStruct extends BaseStruct { ), }.withoutNulls; - static DeviceStruct fromSerializableMap(Map data) => DeviceStruct( + static DeviceStruct fromSerializableMap(Map data) => + DeviceStruct( devUUID: deserializeParam( data['devUUID'], ParamType.String, @@ -95,7 +96,8 @@ class DeviceStruct extends BaseStruct { } @override - int get hashCode => const ListEquality().hash([devUUID, version, description]); + int get hashCode => + const ListEquality().hash([devUUID, version, description]); } DeviceStruct createDeviceStruct({ diff --git a/lib/backend/schema/util/schema_util.dart b/lib/backend/schema/util/schema_util.dart index d6c251d9..8ec1188e 100644 --- a/lib/backend/schema/util/schema_util.dart +++ b/lib/backend/schema/util/schema_util.dart @@ -36,7 +36,8 @@ dynamic deserializeStructParam( return null; } return paramValues - .map((e) => deserializeStructParam(e, paramType, false, structBuilder: structBuilder)) + .map((e) => deserializeStructParam(e, paramType, false, + structBuilder: structBuilder)) .toList(); } else if (param is Map) { return structBuilder(param); @@ -54,9 +55,16 @@ List? getStructList( dynamic value, StructBuilder structBuilder, ) => - value is! List ? null : value.whereType>().map((e) => structBuilder(e)).toList(); + value is! List + ? null + : value + .whereType>() + .map((e) => structBuilder(e)) + .toList(); -List? getEnumList(dynamic value) => value is! List ? null : value.map((e) => deserializeEnum(e)).withoutNulls; +List? getEnumList(dynamic value) => value is! List + ? null + : value.map((e) => deserializeEnum(e)).withoutNulls; Color? getSchemaColor(dynamic value) => value is String ? fromCssColor(value) @@ -64,6 +72,8 @@ Color? getSchemaColor(dynamic value) => value is String ? value : null; -List? getColorsList(dynamic value) => value is! List ? null : value.map(getSchemaColor).withoutNulls; +List? getColorsList(dynamic value) => + value is! List ? null : value.map(getSchemaColor).withoutNulls; -List? getDataList(dynamic value) => value is! List ? null : value.map((e) => castToType(e)!).toList(); +List? getDataList(dynamic value) => + value is! List ? null : value.map((e) => castToType(e)!).toList(); diff --git a/lib/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart b/lib/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart index 7f19801a..a07154e5 100644 --- a/lib/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart +++ b/lib/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart @@ -6,7 +6,11 @@ class AtomImageSvgTheme extends StatelessWidget { final double width; final double height; - const AtomImageSvgTheme({super.key, required this.filename, required this.width, required this.height}); + const AtomImageSvgTheme( + {super.key, + required this.filename, + required this.width, + required this.height}); @override Widget build(BuildContext context) { diff --git a/lib/components/atomic_components/shared_components_atoms/custom_datepicker.dart b/lib/components/atomic_components/shared_components_atoms/custom_datepicker.dart index b615051b..2c420571 100644 --- a/lib/components/atomic_components/shared_components_atoms/custom_datepicker.dart +++ b/lib/components/atomic_components/shared_components_atoms/custom_datepicker.dart @@ -65,7 +65,8 @@ class _CustomDatePickerState extends State { fontSize: 32.0, letterSpacing: 0.0, fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).headlineLargeFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).headlineLargeFamily), ), pickerBackgroundColor: FlutterFlowTheme.of(context).primaryBackground, pickerForegroundColor: FlutterFlowTheme.of(context).primaryText, @@ -88,19 +89,27 @@ class _CustomDatePickerState extends State { child!, headerBackgroundColor: FlutterFlowTheme.of(context).primary, headerForegroundColor: FlutterFlowTheme.of(context).info, - headerTextStyle: FlutterFlowTheme.of(context).headlineLarge.override( - fontFamily: FlutterFlowTheme.of(context).headlineLargeFamily, - fontSize: 32.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).headlineLargeFamily), - ), - pickerBackgroundColor: FlutterFlowTheme.of(context).primaryBackground, + headerTextStyle: + FlutterFlowTheme.of(context).headlineLarge.override( + fontFamily: + FlutterFlowTheme.of(context).headlineLargeFamily, + fontSize: 32.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w600, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).headlineLargeFamily), + ), + pickerBackgroundColor: + FlutterFlowTheme.of(context).primaryBackground, pickerForegroundColor: FlutterFlowTheme.of(context).info, - selectedDateTimeBackgroundColor: FlutterFlowTheme.of(context).primary, - selectedDateTimeForegroundColor: FlutterFlowTheme.of(context).info, - pickerDialForegroundColor: FlutterFlowTheme.of(context).primaryText, - actionButtonForegroundColor: FlutterFlowTheme.of(context).primaryText, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of(context).primary, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of(context).info, + pickerDialForegroundColor: + FlutterFlowTheme.of(context).primaryText, + actionButtonForegroundColor: + FlutterFlowTheme.of(context).primaryText, iconSize: 24.0, ); }, @@ -157,7 +166,8 @@ class _CustomDatePickerState extends State { child: Stack( children: [ Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: widget.controller, focusNode: widget.focusNode, @@ -167,20 +177,26 @@ class _CustomDatePickerState extends State { obscureText: false, decoration: InputDecoration( isDense: true, - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), hintText: widget.hintText, - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), lineHeight: 1.0, ), enabledBorder: OutlineInputBorder( @@ -217,9 +233,11 @@ class _CustomDatePickerState extends State { ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), lineHeight: 1.8, ), textAlign: TextAlign.start, @@ -227,7 +245,8 @@ class _CustomDatePickerState extends State { ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, diff --git a/lib/components/atomic_components/shared_components_atoms/custom_select.dart b/lib/components/atomic_components/shared_components_atoms/custom_select.dart index 8898a47b..7a2b791a 100644 --- a/lib/components/atomic_components/shared_components_atoms/custom_select.dart +++ b/lib/components/atomic_components/shared_components_atoms/custom_select.dart @@ -52,7 +52,8 @@ class _CustomSelectState extends State { children: [ Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: Container( width: 100.0, height: 48.0, @@ -66,11 +67,14 @@ class _CustomSelectState extends State { isMultiSelect: false, width: double.infinity, height: double.infinity, - textStyle: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + textStyle: 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: limitedInputFontSize, ), hintText: widget.hintText, @@ -83,7 +87,8 @@ class _CustomSelectState extends State { borderColor: FlutterFlowTheme.of(context).customColor6, borderWidth: 0.5, borderRadius: 10.0, - margin: const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 16.0, 0.0), + margin: const EdgeInsetsDirectional.fromSTEB( + 12.0, 0.0, 16.0, 0.0), hidesUnderline: true, isOverButton: true, isSearchable: false, @@ -96,25 +101,32 @@ class _CustomSelectState extends State { if (widget.isRequired) if (widget.dropDownValue == null || widget.dropDownValue == '') Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), child: Row( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ Padding( - padding: const EdgeInsetsDirectional.only(top: 5, start: 15), + padding: + const EdgeInsetsDirectional.only(top: 5, start: 15), child: Text( FFLocalizations.of(context).getVariableText( enText: 'This field is required', ptText: 'Este campo é obrigatório', ), - style: FlutterFlowTheme.of(context).bodySmall.override( - fontFamily: FlutterFlowTheme.of(context).bodySmallFamily, - color: FlutterFlowTheme.of(context).customColor6, - letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodySmallFamily), - fontSize: limitedInputFontSize)), + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + color: + FlutterFlowTheme.of(context).customColor6, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context) + .bodySmallFamily), + fontSize: limitedInputFontSize)), ), ], ), diff --git a/lib/components/atomic_components/shared_components_atoms/media_upload_button.dart b/lib/components/atomic_components/shared_components_atoms/media_upload_button.dart index 2977f7cb..ec1c5af3 100644 --- a/lib/components/atomic_components/shared_components_atoms/media_upload_button.dart +++ b/lib/components/atomic_components/shared_components_atoms/media_upload_button.dart @@ -37,7 +37,8 @@ class _MediaUploadButtonUtilState extends State { return Builder( builder: (context) { - if (widget.uploadedFiles != null && widget.uploadedFiles!.bytes!.isNotEmpty) { + if (widget.uploadedFiles != null && + widget.uploadedFiles!.bytes!.isNotEmpty) { { return InkWell( splashColor: Colors.transparent, @@ -47,7 +48,8 @@ class _MediaUploadButtonUtilState extends State { onTap: () async { setState(() { widget.isUploading = false; - widget.uploadedFiles = FFUploadedFile(bytes: Uint8List.fromList([])); + widget.uploadedFiles = + FFUploadedFile(bytes: Uint8List.fromList([])); widget.onUploadComplete(widget.uploadedFiles!); }); }, @@ -72,7 +74,8 @@ class _MediaUploadButtonUtilState extends State { setState(() { _isLoading = true; }); - final selectedMedia = await selectMediaWithSourceBottomSheet( + final selectedMedia = + await selectMediaWithSourceBottomSheet( context: context, imageQuality: 100, allowPhoto: true, @@ -84,7 +87,9 @@ class _MediaUploadButtonUtilState extends State { try { final message = FFLocalizations.of(context) - .getVariableText(enText: 'Uploading file...', ptText: 'Enviando arquivo...'); + .getVariableText( + enText: 'Uploading file...', + ptText: 'Enviando arquivo...'); showUploadMessage( context, message, @@ -103,20 +108,24 @@ class _MediaUploadButtonUtilState extends State { ScaffoldMessenger.of(context).hideCurrentSnackBar(); widget.isUploading = false; } - if (selectedUploadedFiles.length == selectedMedia.length) { + if (selectedUploadedFiles.length == + selectedMedia.length) { setState(() { widget.uploadedFiles = selectedUploadedFiles.first; }); widget.onUploadComplete(widget.uploadedFiles!); - final message = - FFLocalizations.of(context).getVariableText(enText: 'Success!', ptText: 'Sucesso!'); + final message = FFLocalizations.of(context) + .getVariableText( + enText: 'Success!', ptText: 'Sucesso!'); showUploadMessage(context, message); } else { setState(() { _isLoading = false; }); final message = FFLocalizations.of(context) - .getVariableText(enText: 'Failed to upload data', ptText: 'Falha ao enviar dados'); + .getVariableText( + enText: 'Failed to upload data', + ptText: 'Falha ao enviar dados'); showUploadMessage(context, message); return; } @@ -163,13 +172,19 @@ class _MediaUploadButtonUtilState extends State { 'p4ftwxcy', ), textAlign: TextAlign.center, - style: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: FlutterFlowTheme.of(context).titleSmallFamily, - color: FlutterFlowTheme.of(context).primaryText, + style: FlutterFlowTheme.of(context) + .titleSmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .titleSmallFamily, + color: FlutterFlowTheme.of(context) + .primaryText, fontSize: limitedInputTextSize, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).titleSmallFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .titleSmallFamily), ), ), ) diff --git a/lib/components/atomic_components/shared_components_atoms/submit_button.dart b/lib/components/atomic_components/shared_components_atoms/submit_button.dart index 1a4cdd39..bffdee8e 100644 --- a/lib/components/atomic_components/shared_components_atoms/submit_button.dart +++ b/lib/components/atomic_components/shared_components_atoms/submit_button.dart @@ -30,7 +30,8 @@ class SubmitButtonUtil extends StatelessWidget { fontFamily: FlutterFlowTheme.of(context).titleSmallFamily, color: FlutterFlowTheme.of(context).info, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).titleSmallFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context).titleSmallFamily), ), borderSide: const BorderSide( color: Colors.transparent, diff --git a/lib/components/atomic_components/shared_components_atoms/tabview.dart b/lib/components/atomic_components/shared_components_atoms/tabview.dart index 3ae0d4dd..8a62cbf3 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/atomic_components/text_field_component/text_field_component_model.dart b/lib/components/atomic_components/text_field_component/text_field_component_model.dart index ff40e7d4..30f54431 100644 --- a/lib/components/atomic_components/text_field_component/text_field_component_model.dart +++ b/lib/components/atomic_components/text_field_component/text_field_component_model.dart @@ -2,7 +2,8 @@ import '/flutter_flow/flutter_flow_util.dart'; import 'text_field_component_widget.dart' show TextFieldComponentWidget; import 'package:flutter/material.dart'; -class TextFieldComponentModel extends FlutterFlowModel { +class TextFieldComponentModel + extends FlutterFlowModel { /// State fields for stateful widgets in this component. // State field(s) for TextField widget. diff --git a/lib/components/atomic_components/text_field_component/text_field_component_widget.dart b/lib/components/atomic_components/text_field_component/text_field_component_widget.dart index 2e98b097..7c99bad0 100644 --- a/lib/components/atomic_components/text_field_component/text_field_component_widget.dart +++ b/lib/components/atomic_components/text_field_component/text_field_component_widget.dart @@ -20,7 +20,8 @@ class TextFieldComponentWidget extends StatefulWidget { final String? hintTextStrParam; @override - State createState() => _TextFieldComponentWidgetState(); + State createState() => + _TextFieldComponentWidgetState(); } class _TextFieldComponentWidgetState extends State { @@ -37,7 +38,8 @@ class _TextFieldComponentWidgetState extends State { super.initState(); _model = createModel(context, () => TextFieldComponentModel()); - _model.textController ??= TextEditingController(text: widget.initialValueStrParam); + _model.textController ??= + TextEditingController(text: widget.initialValueStrParam); _model.textFieldFocusNode ??= FocusNode(); } @@ -63,14 +65,16 @@ class _TextFieldComponentWidgetState extends State { fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), hintText: widget.hintTextStrParam, hintStyle: FlutterFlowTheme.of(context).labelMedium.override( fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -105,7 +109,8 @@ class _TextFieldComponentWidgetState extends State { fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).secondaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), ), validator: _model.textControllerValidator.asValidator(context), ), diff --git a/lib/components/molecular_components/option_selection_modal/option_selection_modal_model.dart b/lib/components/molecular_components/option_selection_modal/option_selection_modal_model.dart index e2e83af6..214c6fb4 100644 --- a/lib/components/molecular_components/option_selection_modal/option_selection_modal_model.dart +++ b/lib/components/molecular_components/option_selection_modal/option_selection_modal_model.dart @@ -3,7 +3,8 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:flutter/material.dart'; -class OptionSelectionModalModel extends FlutterFlowModel { +class OptionSelectionModalModel + extends FlutterFlowModel { @override void initState(BuildContext context) {} diff --git a/lib/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart b/lib/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart index ed4433d8..a445cc81 100644 --- a/lib/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart +++ b/lib/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart @@ -21,10 +21,12 @@ class OptionSelectionModalWidget extends StatefulWidget { final List? nameListStr; @override - State createState() => _OptionSelectionModalWidgetState(); + State createState() => + _OptionSelectionModalWidgetState(); } -class _OptionSelectionModalWidgetState extends State with TickerProviderStateMixin { +class _OptionSelectionModalWidgetState extends State + with TickerProviderStateMixin { late OptionSelectionModalModel _model; final animationsMap = {}; @@ -90,14 +92,17 @@ class _OptionSelectionModalWidgetState extends State return GestureDetector( onTap: () async { context.pop(); - if (widget.routesListStr![optionsListIndex] == 'scheduleCompleteVisitPage') { + if (widget.routesListStr![optionsListIndex] == + 'scheduleCompleteVisitPage') { // Navegação para a página ScheduleCompleteVisitPage com queryParameters context.go( '/scheduleCompleteVisitPage', extra: { - 'visitStartDateStr': DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.now()), - 'visitEndDateStr': - DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.now().add(const Duration(days: 1))), + 'visitStartDateStr': DateFormat('yyyy-MM-dd HH:mm:ss') + .format(DateTime.now()), + 'visitEndDateStr': DateFormat('yyyy-MM-dd HH:mm:ss') + .format( + DateTime.now().add(const Duration(days: 1))), }, ); } else { @@ -144,20 +149,27 @@ class _OptionSelectionModalWidgetState extends State children: [ Expanded( child: Align( - alignment: const AlignmentDirectional(-1.0, 0.0), + alignment: + const AlignmentDirectional(-1.0, 0.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 0.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 0.0, 0.0), child: Container( width: 30.0, height: 30.0, decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, + color: FlutterFlowTheme.of(context) + .primaryBackground, shape: BoxShape.circle, ), - alignment: const AlignmentDirectional(0.0, 0.0), + alignment: const AlignmentDirectional( + 0.0, 0.0), child: Icon( - widget.iconsListIcon![optionsListIndex]!, - color: FlutterFlowTheme.of(context).accent1, + widget.iconsListIcon![ + optionsListIndex]!, + color: FlutterFlowTheme.of(context) + .accent1, size: 34.0, ), ), @@ -174,16 +186,21 @@ class _OptionSelectionModalWidgetState extends State mainAxisAlignment: MainAxisAlignment.center, children: [ Align( - alignment: const AlignmentDirectional(0.0, 0.0), + alignment: + const AlignmentDirectional(0.0, 0.0), child: Text( widget.nameListStr![optionsListIndex], - style: FlutterFlowTheme.of(context).titleLarge.override( + style: FlutterFlowTheme.of(context) + .titleLarge + .override( fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).primaryText, + color: FlutterFlowTheme.of(context) + .primaryText, fontSize: 14.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Nunito'), ), ), ), diff --git a/lib/components/molecular_components/order_filter_modal/order_filter_modal_model.dart b/lib/components/molecular_components/order_filter_modal/order_filter_modal_model.dart index ec888c47..79362029 100644 --- a/lib/components/molecular_components/order_filter_modal/order_filter_modal_model.dart +++ b/lib/components/molecular_components/order_filter_modal/order_filter_modal_model.dart @@ -15,7 +15,8 @@ class OrderFilterModalModel extends FlutterFlowModel { // State field(s) for CheckboxGroup widget. FormFieldController>? checkboxGroupValueController; List? get checkboxGroupValues => checkboxGroupValueController?.value; - set checkboxGroupValues(List? v) => checkboxGroupValueController?.value = v; + set checkboxGroupValues(List? v) => + checkboxGroupValueController?.value = v; @override void initState(BuildContext context) {} @@ -25,4 +26,4 @@ class OrderFilterModalModel extends FlutterFlowModel { textFieldFocusNode?.dispose(); textController?.dispose(); } -} \ No newline at end of file +} diff --git a/lib/components/molecular_components/order_filter_modal/order_filter_modal_widget.dart b/lib/components/molecular_components/order_filter_modal/order_filter_modal_widget.dart index 1835eb3c..70882191 100644 --- a/lib/components/molecular_components/order_filter_modal/order_filter_modal_widget.dart +++ b/lib/components/molecular_components/order_filter_modal/order_filter_modal_widget.dart @@ -28,22 +28,25 @@ class _OrderFilterModalWidgetState extends State { late Map selected; final List> adresseeTypeOptions = [ { - 'title': FFLocalizations.of(navigatorKey.currentContext!).getVariableText(enText: 'Resident', ptText: 'Morador'), + 'title': FFLocalizations.of(navigatorKey.currentContext!) + .getVariableText(enText: 'Resident', ptText: 'Morador'), 'value': 'MOR' }, { - 'title': FFLocalizations.of(navigatorKey.currentContext!).getVariableText(enText: 'Property', ptText: 'Propriedade'), + 'title': FFLocalizations.of(navigatorKey.currentContext!) + .getVariableText(enText: 'Property', ptText: 'Propriedade'), 'value': 'PRO' }, ]; final List> statusOptions = [ { - 'title': FFLocalizations.of(navigatorKey.currentContext!) - .getVariableText(ptText: 'Aguardando Retirada', enText: 'Waiting for Pickup'), + 'title': FFLocalizations.of(navigatorKey.currentContext!).getVariableText( + ptText: 'Aguardando Retirada', enText: 'Waiting for Pickup'), 'value': 'notPickedUp' }, { - 'title': FFLocalizations.of(navigatorKey.currentContext!).getVariableText(ptText: 'Retirado', enText: 'Picked Up'), + 'title': FFLocalizations.of(navigatorKey.currentContext!) + .getVariableText(ptText: 'Retirado', enText: 'Picked Up'), 'value': 'pickedUp' }, ]; @@ -61,8 +64,12 @@ class _OrderFilterModalWidgetState extends State { _model = createModel(context, () => OrderFilterModalModel()); selected = { - 'adresseeType': widget.defaultAdresseeType == '.*' ? ['MOR', 'PRO'] : [widget.defaultAdresseeType], - 'status': widget.defaultStatus == '.*' ? ['notPickedUp', 'pickedUp'] : [widget.defaultStatus], + 'adresseeType': widget.defaultAdresseeType == '.*' + ? ['MOR', 'PRO'] + : [widget.defaultAdresseeType], + 'status': widget.defaultStatus == '.*' + ? ['notPickedUp', 'pickedUp'] + : [widget.defaultStatus], }; } @@ -92,7 +99,8 @@ class _OrderFilterModalWidgetState extends State { context.pop(filterResult); } - Widget _buildCheckboxListTile(String key, List> options, double fontsize) { + Widget _buildCheckboxListTile( + String key, List> options, double fontsize) { return Column( children: [ Row( @@ -108,7 +116,8 @@ class _OrderFilterModalWidgetState extends State { fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, fontSize: fontsize, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), color: FlutterFlowTheme.of(context).primaryText, ), ), @@ -128,7 +137,8 @@ class _OrderFilterModalWidgetState extends State { fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, letterSpacing: 0.0, fontSize: fontsize, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), color: FlutterFlowTheme.of(context).primaryText, ), ), @@ -156,7 +166,8 @@ class _OrderFilterModalWidgetState extends State { width: 5, color: FlutterFlowTheme.of(context).secondaryText, ), - controlAffinity: ListTileControlAffinity.leading, // Adiciona esta linha + controlAffinity: + ListTileControlAffinity.leading, // Adiciona esta linha ); }, ), @@ -186,18 +197,23 @@ class _OrderFilterModalWidgetState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( - padding: const EdgeInsetsDirectional.fromSTEB(10.0, 10.0, 0.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 10.0, 10.0, 0.0, 10.0), child: Text( - FFLocalizations.of(context).getText('yfj9pd6k'), // Filtros - style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 18.0, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).headlineMediumFamily), - ), + FFLocalizations.of(context) + .getText('yfj9pd6k'), // Filtros + style: + FlutterFlowTheme.of(context).headlineMedium.override( + fontFamily: FlutterFlowTheme.of(context) + .headlineMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 18.0, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .headlineMediumFamily), + ), ), ), ], @@ -209,8 +225,10 @@ class _OrderFilterModalWidgetState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - _buildCheckboxListTile('adresseeType', adresseeTypeOptions, limitedBodyFontSize), - _buildCheckboxListTile('status', statusOptions, limitedBodyFontSize), + _buildCheckboxListTile('adresseeType', + adresseeTypeOptions, limitedBodyFontSize), + _buildCheckboxListTile( + 'status', statusOptions, limitedBodyFontSize), ], ), ), @@ -231,4 +249,4 @@ class _OrderFilterModalWidgetState extends State { ), ); } -} \ No newline at end of file +} diff --git a/lib/components/molecular_components/throw_exception/throw_exception_widget.dart b/lib/components/molecular_components/throw_exception/throw_exception_widget.dart index 981f1db5..20246e26 100644 --- a/lib/components/molecular_components/throw_exception/throw_exception_widget.dart +++ b/lib/components/molecular_components/throw_exception/throw_exception_widget.dart @@ -14,7 +14,8 @@ export 'throw_exception_model.dart'; // ignore: must_be_immutable class ThrowExceptionWidget extends StatefulWidget { - ThrowExceptionWidget({super.key, required this.msg, this.type = EnumThrowException.error}); + ThrowExceptionWidget( + {super.key, required this.msg, this.type = EnumThrowException.error}); final String? msg; EnumThrowException type; @@ -23,7 +24,8 @@ class ThrowExceptionWidget extends StatefulWidget { State createState() => _ThrowExceptionWidgetState(); } -class _ThrowExceptionWidgetState extends State with TickerProviderStateMixin { +class _ThrowExceptionWidgetState extends State + with TickerProviderStateMixin { late ThrowExceptionModel _model; final animationsMap = {}; @@ -52,11 +54,14 @@ class _ThrowExceptionWidgetState extends State with Ticker String _getTitleByType(BuildContext context) { switch (widget.type) { case EnumThrowException.error: - return FFLocalizations.of(context).getVariableText(ptText: "Falha :(", enText: "Fail :("); + return FFLocalizations.of(context) + .getVariableText(ptText: "Falha :(", enText: "Fail :("); case EnumThrowException.warning: - return FFLocalizations.of(context).getVariableText(ptText: "Aviso :O", enText: "Warning :O"); + return FFLocalizations.of(context) + .getVariableText(ptText: "Aviso :O", enText: "Warning :O"); case EnumThrowException.success: - return FFLocalizations.of(context).getVariableText(ptText: "Sucesso ;)", enText: "Success ;)"); + return FFLocalizations.of(context) + .getVariableText(ptText: "Sucesso ;)", enText: "Success ;)"); } } @@ -96,7 +101,8 @@ class _ThrowExceptionWidgetState extends State with Ticker @override Widget build(BuildContext context) { double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); - double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context); + double limitedHeaderFontSize = + LimitedFontSizeUtil.getHeaderFontSize(context); return InkWell( key: const ValueKey('ThrowExceptionWidget'), splashColor: Colors.transparent, @@ -109,7 +115,8 @@ class _ThrowExceptionWidgetState extends State with Ticker child: DecoratedBox( decoration: BoxDecoration( color: FlutterFlowTheme.of(context).primaryBackground, - borderRadius: BorderRadius.circular(20.0), // Ajuste o valor conforme necessário + borderRadius: + BorderRadius.circular(20.0), // Ajuste o valor conforme necessário ), child: SingleChildScrollView( child: Column( @@ -137,25 +144,28 @@ class _ThrowExceptionWidgetState extends State with Ticker Text( _getTitleByType(context), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, fontSize: limitedHeaderFontSize, letterSpacing: 0.0, fontWeight: FontWeight.bold, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(15.0, 10.0, 15.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 15.0, 10.0, 15.0, 0.0), child: Text( valueOrDefault(widget.msg, 'Message Not Found'), overflow: TextOverflow.clip, textAlign: TextAlign.center, style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + 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: limitedBodyFontSize, ), ), diff --git a/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_model.dart b/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_model.dart index 98bb8579..abdac046 100644 --- a/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_model.dart +++ b/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_model.dart @@ -3,7 +3,8 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:flutter/material.dart'; -class VisitorNotFoundComponentModel extends FlutterFlowModel { +class VisitorNotFoundComponentModel + extends FlutterFlowModel { @override void initState(BuildContext context) {} diff --git a/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart b/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart index 7fdc75c7..00261f19 100644 --- a/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart +++ b/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart @@ -13,10 +13,12 @@ class VisitorNotFoundComponentWidget extends StatefulWidget { final String? doc; @override - State createState() => _VisitorNotFoundComponentWidgetState(); + State createState() => + _VisitorNotFoundComponentWidgetState(); } -class _VisitorNotFoundComponentWidgetState extends State { +class _VisitorNotFoundComponentWidgetState + extends State { late VisitorNotFoundComponentModel _model; @override @@ -59,7 +61,8 @@ class _VisitorNotFoundComponentWidgetState extends State context.pop(value)); // Navigator.pop(context, value) }, - text: FFLocalizations.of(context).getVariableText(enText: 'Add', ptText: 'Adicionar'), + text: FFLocalizations.of(context) + .getVariableText(enText: 'Add', ptText: 'Adicionar'), options: FFButtonOptions( height: 30.0, - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + iconPadding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 0.0), color: FlutterFlowTheme.of(context).primary, textStyle: FlutterFlowTheme.of(context).labelSmall.override( - fontFamily: FlutterFlowTheme.of(context).labelSmallFamily, + fontFamily: + FlutterFlowTheme.of(context).labelSmallFamily, color: Colors.white, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelSmallFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelSmallFamily), ), elevation: 3.0, borderSide: const BorderSide( diff --git a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_model.dart b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_model.dart index 11d6aab5..1563d5d5 100644 --- a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_model.dart +++ b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_model.dart @@ -3,7 +3,8 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:flutter/material.dart'; -class BottomArrowLinkedLocalsComponentModel extends FlutterFlowModel { +class BottomArrowLinkedLocalsComponentModel + extends FlutterFlowModel { @override void initState(BuildContext context) {} 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 58be572b..95b1cf40 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 @@ -18,10 +18,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; @@ -39,7 +41,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State BottomArrowLinkedLocalsComponentModel()); + _model = + createModel(context, () => BottomArrowLinkedLocalsComponentModel()); _localsFuture = _fetchLocals(); } @@ -105,10 +108,14 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State _handleError(BuildContext context, String errorMsg) async { + static Future _handleError( + BuildContext context, String errorMsg) async { await DialogUtil.error(context, errorMsg); } @@ -144,8 +152,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 }); } @@ -196,16 +209,21 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State { +class ScheduleVisitDetailModel + extends FlutterFlowModel { late final String devUUID; late final String userUUID; late final String cliUUID; @@ -38,7 +39,8 @@ class ScheduleVisitDetailModel extends FlutterFlowModel initDB() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; } @override diff --git a/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart b/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart index 29f8f48d..82c8fa1f 100644 --- a/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart +++ b/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart @@ -35,7 +35,8 @@ class ScheduleVisitDetailWidget extends StatefulWidget { final String? visitObsStr; @override - State createState() => _ScheduleVisitDetailWidgetState(); + State createState() => + _ScheduleVisitDetailWidgetState(); } class _ScheduleVisitDetailWidgetState extends State { @@ -57,16 +58,19 @@ class _ScheduleVisitDetailWidgetState extends State { _model.textController1 ??= TextEditingController(text: widget.visitTempStr); _model.textFieldFocusNode1 ??= FocusNode(); - _model.textController2 ??= TextEditingController(text: widget.visitStartDate); + _model.textController2 ??= + TextEditingController(text: widget.visitStartDate); _model.textFieldFocusNode2 ??= FocusNode(); _model.textController3 ??= TextEditingController(text: widget.visitEndDate); _model.textFieldFocusNode3 ??= FocusNode(); - _model.textController4 ??= TextEditingController(text: extractDescToStr(widget.visitResonStr!)); + _model.textController4 ??= + TextEditingController(text: extractDescToStr(widget.visitResonStr!)); _model.textFieldFocusNode4 ??= FocusNode(); - _model.textController5 ??= TextEditingController(text: extractDescToStr(widget.visitLevelStr!)); + _model.textController5 ??= + TextEditingController(text: extractDescToStr(widget.visitLevelStr!)); _model.textFieldFocusNode5 ??= FocusNode(); _model.textController6 ??= TextEditingController(text: widget.visitObsStr); @@ -128,11 +132,13 @@ class _ScheduleVisitDetailWidgetState extends State { ), ), child: Visibility( - visible: widget.visitorStrList != null && widget.visitorStrList != '', + visible: widget.visitorStrList != null && + widget.visitorStrList != '', child: Align( alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(15.0, 0.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 15.0, 0.0, 0.0, 0.0), child: FlutterFlowIconButton( borderRadius: 20.0, borderWidth: 1.0, @@ -155,7 +161,8 @@ class _ScheduleVisitDetailWidgetState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( - padding: const EdgeInsetsDirectional.fromSTEB(5.0, 0.0, 5.0, 20.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 5.0, 0.0, 5.0, 20.0), child: SizedBox( width: 100.0, child: ClipRRect( @@ -183,7 +190,8 @@ class _ScheduleVisitDetailWidgetState extends State { Container( decoration: const BoxDecoration(), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 10.0), child: TextFormField( controller: _model.textController1, focusNode: _model.textFieldFocusNode1, @@ -195,19 +203,31 @@ class _ScheduleVisitDetailWidgetState extends State { labelText: FFLocalizations.of(context).getText( '7w4fohoa' /* Encerramento da Visita */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -238,25 +258,32 @@ class _ScheduleVisitDetailWidgetState extends State { borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + 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), ), - validator: _model.textController1Validator.asValidator(context), + validator: _model.textController1Validator + .asValidator(context), ), ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 10.0), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController2, focusNode: _model.textFieldFocusNode2, @@ -265,71 +292,98 @@ class _ScheduleVisitDetailWidgetState extends State { readOnly: true, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getVariableText( + labelText: FFLocalizations.of(context) + .getVariableText( enText: 'Start', ptText: 'Início', ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintText: FFLocalizations.of(context).getText( + hintText: + FFLocalizations.of(context).getText( '0cp1e31d' /* dd/mm/yyyy */, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context) + .accent1, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, + color: FlutterFlowTheme.of(context) + .primary, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of(context).error, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), focusedErrorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of(context).error, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, letterSpacing: 0.0, fontSize: 12, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), textAlign: TextAlign.center, - validator: _model.textController2Validator.asValidator(context), + validator: _model.textController2Validator + .asValidator(context), ), ), ), Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController3, focusNode: _model.textFieldFocusNode3, @@ -338,64 +392,90 @@ class _ScheduleVisitDetailWidgetState extends State { readOnly: true, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( + labelText: + FFLocalizations.of(context).getText( 'abppdgz3' /* Término */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintText: FFLocalizations.of(context).getText( + hintText: + FFLocalizations.of(context).getText( 'kqralft4' /* dd/mm/yyyy */, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context) + .accent1, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, + color: FlutterFlowTheme.of(context) + .primary, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of(context).error, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), focusedErrorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of(context).error, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, letterSpacing: 0.0, fontSize: 12, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), textAlign: TextAlign.center, - validator: _model.textController3Validator.asValidator(context), + validator: _model.textController3Validator + .asValidator(context), ), ), ), @@ -403,14 +483,16 @@ class _ScheduleVisitDetailWidgetState extends State { ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 10.0), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController4, focusNode: _model.textFieldFocusNode4, @@ -419,69 +501,96 @@ class _ScheduleVisitDetailWidgetState extends State { readOnly: true, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( + labelText: + FFLocalizations.of(context).getText( 'xjxhzqqm' /* Motivo da Visita */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintText: FFLocalizations.of(context).getText( + hintText: + FFLocalizations.of(context).getText( '47oezdm6' /* Motivo */, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context) + .accent1, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, + color: FlutterFlowTheme.of(context) + .primary, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of(context).error, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), focusedErrorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of(context).error, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), textAlign: TextAlign.center, - validator: _model.textController4Validator.asValidator(context), + validator: _model.textController4Validator + .asValidator(context), ), ), ), Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController5, focusNode: _model.textFieldFocusNode5, @@ -490,63 +599,89 @@ class _ScheduleVisitDetailWidgetState extends State { readOnly: true, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( + labelText: + FFLocalizations.of(context).getText( '2ujg7u18' /* Nível de Acesso */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintText: FFLocalizations.of(context).getText( + hintText: + FFLocalizations.of(context).getText( '3emmbbfv' /* Nível de Acesso */, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context) + .accent1, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, + color: FlutterFlowTheme.of(context) + .primary, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of(context).error, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), focusedErrorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: + FlutterFlowTheme.of(context).error, width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), textAlign: TextAlign.center, - validator: _model.textController5Validator.asValidator(context), + validator: _model.textController5Validator + .asValidator(context), ), ), ), @@ -556,7 +691,8 @@ class _ScheduleVisitDetailWidgetState extends State { Container( decoration: const BoxDecoration(), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController6, focusNode: _model.textFieldFocusNode6, @@ -568,19 +704,31 @@ class _ScheduleVisitDetailWidgetState extends State { labelText: FFLocalizations.of(context).getText( 'ritce5uw' /* Observações da Visita */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -611,13 +759,18 @@ class _ScheduleVisitDetailWidgetState extends State { borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + 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), ), - validator: _model.textController6Validator.asValidator(context), + validator: _model.textController6Validator + .asValidator(context), ), ), ), @@ -627,10 +780,12 @@ class _ScheduleVisitDetailWidgetState extends State { ), IconButton( onPressed: () async { - _model.postScheduleVisit = await PhpGroup.postScheduleVisitCall.call( + _model.postScheduleVisit = + await PhpGroup.postScheduleVisitCall.call( devDesc: widget.visitObsStr, idVisitante: widget.visitorStrList, - dtInicio: _model.convertDateFormat(widget.visitStartDate ?? ''), + dtInicio: + _model.convertDateFormat(widget.visitStartDate ?? ''), dtFim: _model.convertDateFormat(widget.visitEndDate ?? ''), unica: widget.visitTempStr, idMotivo: extractIdToStr(widget.visitResonStr!), @@ -647,7 +802,8 @@ class _ScheduleVisitDetailWidgetState extends State { final String? msg = PhpGroup.postScheduleVisitCall.errorMsg( (_model.postScheduleVisit?.jsonBody ?? ''), ); - await DialogUtil.error(context, msg!).then((value) => safeSetState(() {})); + await DialogUtil.error(context, msg!) + .then((value) => safeSetState(() {})); } setState(() {}); diff --git a/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_model.dart b/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_model.dart index 87665faa..62331c5d 100644 --- a/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_model.dart +++ b/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_model.dart @@ -4,7 +4,8 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart'; -class UpArrowLinkedLocalsComponentModel extends FlutterFlowModel { +class UpArrowLinkedLocalsComponentModel + extends FlutterFlowModel { late final String devUUID; late final String userUUID; late final String cliUUID; @@ -16,10 +17,14 @@ class UpArrowLinkedLocalsComponentModel extends FlutterFlowModel initDB() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; } @override diff --git a/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_widget.dart b/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_widget.dart index d371a85b..9415e7fc 100644 --- a/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_widget.dart +++ b/lib/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_widget.dart @@ -12,10 +12,12 @@ class UpArrowLinkedLocalsComponentWidget extends StatefulWidget { const UpArrowLinkedLocalsComponentWidget({super.key}); @override - State createState() => _UpArrowLinkedLocalsComponentWidgetState(); + State createState() => + _UpArrowLinkedLocalsComponentWidgetState(); } -class _UpArrowLinkedLocalsComponentWidgetState extends State { +class _UpArrowLinkedLocalsComponentWidgetState + extends State { late UpArrowLinkedLocalsComponentModel _model; @override @@ -105,7 +107,8 @@ class _UpArrowLinkedLocalsComponentWidgetState extends State { @@ -32,9 +33,12 @@ class AccessNotificationModalTemplateComponentModel } Future initDB() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; } @override diff --git a/lib/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart b/lib/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart index edb51dba..652bdfe6 100644 --- a/lib/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart +++ b/lib/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart @@ -41,7 +41,8 @@ class _AccessNotificationModalTemplateComponentWidgetState void initState() { super.initState(); - _model = createModel(context, () => AccessNotificationModalTemplateComponentModel()); + _model = createModel( + context, () => AccessNotificationModalTemplateComponentModel()); _model.textController1 ??= TextEditingController(text: widget.name); _model.textFieldFocusNode1 ??= FocusNode(); @@ -65,9 +66,11 @@ class _AccessNotificationModalTemplateComponentWidgetState @override Widget build(BuildContext context) { - String labelTypeResident = FFLocalizations.of(context).getVariableText(enText: 'Resident', ptText: 'Morador'); + String labelTypeResident = FFLocalizations.of(context) + .getVariableText(enText: 'Resident', ptText: 'Morador'); - String labelTypeVisitor = FFLocalizations.of(context).getVariableText(enText: 'Visitor', ptText: 'Visitante'); + String labelTypeVisitor = FFLocalizations.of(context) + .getVariableText(enText: 'Visitor', ptText: 'Visitante'); return Align( alignment: const AlignmentDirectional(0.0, 0.0), @@ -110,10 +113,13 @@ class _AccessNotificationModalTemplateComponentWidgetState fit: BoxFit.cover, ), ), - ].addToStart(const SizedBox(width: 10.0)).addToEnd(const SizedBox(width: 10.0)), + ] + .addToStart(const SizedBox(width: 10.0)) + .addToEnd(const SizedBox(width: 10.0)), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController1, focusNode: _model.textFieldFocusNode1, @@ -126,19 +132,25 @@ class _AccessNotificationModalTemplateComponentWidgetState labelText: FFLocalizations.of(context).getText( 'dvag09pq' /* Nome */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -150,16 +162,18 @@ class _AccessNotificationModalTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, - validator: _model.textController1Validator.asValidator(context), + validator: + _model.textController1Validator.asValidator(context), ), ), Row( @@ -167,8 +181,10 @@ class _AccessNotificationModalTemplateComponentWidgetState children: [ Expanded( child: TextFormField( - controller: - TextEditingController(text: widget.type == 'O' ? labelTypeResident : labelTypeVisitor), + controller: TextEditingController( + text: widget.type == 'O' + ? labelTypeResident + : labelTypeVisitor), focusNode: _model.textFieldFocusNode2, autofocus: false, textInputAction: TextInputAction.next, @@ -179,19 +195,27 @@ class _AccessNotificationModalTemplateComponentWidgetState labelText: FFLocalizations.of(context).getText( 'h3s0r1he' /* Tipo */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -203,22 +227,28 @@ class _AccessNotificationModalTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, - validator: _model.textController2Validator.asValidator(context), + validator: _model.textController2Validator + .asValidator(context), ), ), - ].addToStart(const SizedBox(width: 24.0)).addToEnd(const SizedBox(width: 24.0)), + ] + .addToStart(const SizedBox(width: 24.0)) + .addToEnd(const SizedBox(width: 24.0)), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController3, focusNode: _model.textFieldFocusNode3, @@ -231,19 +261,25 @@ class _AccessNotificationModalTemplateComponentWidgetState labelText: FFLocalizations.of(context).getText( 'jveeqpdz' /* Acesso */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -255,20 +291,23 @@ class _AccessNotificationModalTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, - validator: _model.textController3Validator.asValidator(context), + validator: + _model.textController3Validator.asValidator(context), ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController4, focusNode: _model.textFieldFocusNode4, @@ -283,18 +322,24 @@ class _AccessNotificationModalTemplateComponentWidgetState enText: 'Access Sector', ptText: 'Setor de Acesso', ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -306,14 +351,16 @@ class _AccessNotificationModalTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), textAlign: TextAlign.start, - validator: _model.textController4Validator.asValidator(context), + validator: + _model.textController4Validator.asValidator(context), ), ), ] diff --git a/lib/components/templates_components/card_item_template_component/card_item_template_component_model.dart b/lib/components/templates_components/card_item_template_component/card_item_template_component_model.dart index aed57244..3f35acf9 100644 --- a/lib/components/templates_components/card_item_template_component/card_item_template_component_model.dart +++ b/lib/components/templates_components/card_item_template_component/card_item_template_component_model.dart @@ -1,8 +1,10 @@ import '/flutter_flow/flutter_flow_util.dart'; -import 'card_item_template_component_widget.dart' show CardItemTemplateComponentWidget; +import 'card_item_template_component_widget.dart' + show CardItemTemplateComponentWidget; import 'package:flutter/material.dart'; -class CardItemTemplateComponentModel extends FlutterFlowModel { +class CardItemTemplateComponentModel + extends FlutterFlowModel { @override void initState(BuildContext context) {} diff --git a/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart b/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart index 9cba811c..129cf635 100644 --- a/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart +++ b/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart @@ -27,10 +27,12 @@ class CardItemTemplateComponentWidget extends StatefulWidget { final Future Function()? onTapCardItemAction; @override - State createState() => _CardItemTemplateComponentWidgetState(); + State createState() => + _CardItemTemplateComponentWidgetState(); } -class _CardItemTemplateComponentWidgetState extends State { +class _CardItemTemplateComponentWidgetState + extends State { late CardItemTemplateComponentModel _model; late LinkedHashMap labelsLinkedHashMap; late List> statusLinkedHashMap; @@ -40,7 +42,9 @@ class _CardItemTemplateComponentWidgetState extends State CardItemTemplateComponentModel()); labelsLinkedHashMap = LinkedHashMap.from(widget.labelsHashMap ?? {}); - statusLinkedHashMap = widget.statusHashMap.map((map) => LinkedHashMap.from(map ?? {})).toList(); + statusLinkedHashMap = widget.statusHashMap + .map((map) => LinkedHashMap.from(map ?? {})) + .toList(); } @override @@ -70,7 +74,8 @@ class _CardItemTemplateComponentWidgetState extends State { +class PassKeyTemplateComponentModel + extends FlutterFlowModel { /// State fields for stateful widgets in this component. final formKey = GlobalKey(); @@ -15,7 +16,8 @@ class PassKeyTemplateComponentModel extends FlutterFlowModel { } Future _initialize() async { - _accessPass = await StorageHelper().get(SecureStorageKey.accessPass.value) ?? ''; + _accessPass = + await StorageHelper().get(SecureStorageKey.accessPass.value) ?? ''; } @override @@ -90,7 +91,8 @@ class _PassKeyTemplateWidgetState extends State { tablet: false, )) Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0), + padding: + const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0), child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, @@ -103,7 +105,8 @@ class _PassKeyTemplateWidgetState extends State { mainAxisSize: MainAxisSize.max, children: [ const Padding( - padding: EdgeInsetsDirectional.fromSTEB(0.0, 12.0, 0.0, 12.0), + padding: EdgeInsetsDirectional.fromSTEB( + 0.0, 12.0, 0.0, 12.0), child: Icon( Icons.arrow_back_rounded, color: Color(0xFF15161E), @@ -111,17 +114,20 @@ class _PassKeyTemplateWidgetState extends State { ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 12.0, 0.0, 0.0, 0.0), child: Text( '', - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: const Color(0xFF15161E), - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), - ), + style: + FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: 'Plus Jakarta Sans', + color: const Color(0xFF15161E), + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), + ), ), ), ], @@ -129,11 +135,13 @@ class _PassKeyTemplateWidgetState extends State { ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), child: Text( FFLocalizations.of(context).getVariableText( enText: 'INSERT PASSWORD', - ptText: _accessPass != '' ? 'ALTERAR SENHA' : 'ADICIONAR SENHA', + ptText: + _accessPass != '' ? 'ALTERAR SENHA' : 'ADICIONAR SENHA', ), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Outfit', @@ -146,17 +154,20 @@ class _PassKeyTemplateWidgetState extends State { ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0), + padding: + const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0), child: Text( FFLocalizations.of(context).getVariableText( - enText: 'Enter your password to continue', ptText: 'Digite sua senha para continuar'), + enText: 'Enter your password to continue', + ptText: 'Digite sua senha para continuar'), style: FlutterFlowTheme.of(context).labelMedium.override( fontFamily: 'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primaryText, fontSize: 14.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: + GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), ), ), ), @@ -166,7 +177,8 @@ class _PassKeyTemplateWidgetState extends State { child: Column( children: [ Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 16.0, 12.0, 16.0, 0.0), child: SizedBox( width: double.infinity, child: TextFormField( @@ -185,29 +197,36 @@ class _PassKeyTemplateWidgetState extends State { obscureText: !_model.keyTextFieldVisibility1, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getVariableText( + labelText: + FFLocalizations.of(context).getVariableText( ptText: 'Senha', enText: 'Password', ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( fontFamily: 'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primaryText, fontSize: 14.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), hintText: FFLocalizations.of(context).getVariableText( ptText: 'Digite a sua senha.....', enText: 'Enter your password.....', ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( fontFamily: 'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primaryText, fontSize: 14.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -238,11 +257,14 @@ class _PassKeyTemplateWidgetState extends State { borderRadius: BorderRadius.circular(12.0), ), filled: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, - contentPadding: const EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 20.0, 24.0), + fillColor: + FlutterFlowTheme.of(context).primaryBackground, + contentPadding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 24.0, 20.0, 24.0), suffixIcon: InkWell( onTap: () => setState( - () => _model.keyTextFieldVisibility1 = !_model.keyTextFieldVisibility1, + () => _model.keyTextFieldVisibility1 = + !_model.keyTextFieldVisibility1, ), focusNode: FocusNode(skipTraversal: true), child: Icon( @@ -260,14 +282,20 @@ class _PassKeyTemplateWidgetState extends State { fontSize: 14.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), maxLength: 4, maxLengthEnforcement: MaxLengthEnforcement.enforced, - buildCounter: (context, {required currentLength, required isFocused, maxLength}) => null, + buildCounter: (context, + {required currentLength, + required isFocused, + maxLength}) => + null, keyboardType: TextInputType.number, cursorColor: FlutterFlowTheme.of(context).primary, - validator: _model.keyTextFieldTextControllerValidator1.asValidator(context), + validator: _model.keyTextFieldTextControllerValidator1 + .asValidator(context), inputFormatters: [ FilteringTextInputFormatter.allow(RegExp('[0-9]')), LengthLimitingTextInputFormatter(4), @@ -281,10 +309,12 @@ class _PassKeyTemplateWidgetState extends State { Align( alignment: const AlignmentDirectional(0.0, 0.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), child: FFButtonWidget( onPressed: () async { - if (_model.formKey.currentState == null || !_model.formKey.currentState!.validate()) { + if (_model.formKey.currentState == null || + !_model.formKey.currentState!.validate()) { return; } await widget.toggleActionStatus?.call( @@ -302,8 +332,10 @@ class _PassKeyTemplateWidgetState extends State { options: FFButtonOptions( width: 270.0, height: 50.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), + 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: const Color(0xFF1AAB5F), textStyle: FlutterFlowTheme.of(context).titleSmall.override( fontFamily: 'Plus Jakarta Sans', @@ -311,7 +343,8 @@ class _PassKeyTemplateWidgetState extends State { fontSize: 16.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), elevation: 3.0, borderSide: const BorderSide( 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 1c77edec..6a4f5cec 100644 --- a/lib/components/templates_components/details_component/details_component_widget.dart +++ b/lib/components/templates_components/details_component/details_component_widget.dart @@ -31,10 +31,13 @@ class DetailsComponentWidget extends StatefulWidget { class _DetailsComponentWidgetState extends State { late DetailsComponentModel _model; - LinkedHashMap get labelsLinkedHashMap => LinkedHashMap.from(widget.labelsHashMap); + LinkedHashMap get labelsLinkedHashMap => + LinkedHashMap.from(widget.labelsHashMap); List> get statusLinkedHashMap => - widget.statusHashMap.map((map) => LinkedHashMap.from(map ?? {})).toList(); + widget.statusHashMap + .map((map) => LinkedHashMap.from(map ?? {})) + .toList(); @override void setState(VoidCallback callback) { @@ -59,7 +62,8 @@ class _DetailsComponentWidgetState extends State { @override Widget build(BuildContext context) { // CachedNetworkImage.evictFromCache(widget.imagePath ?? ''); - final double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); + final double limitedBodyFontSize = + LimitedFontSizeUtil.getBodyFontSize(context); return Container( constraints: BoxConstraints( maxWidth: MediaQuery.of(context).size.width, @@ -94,7 +98,8 @@ class _DetailsComponentWidgetState extends State { SizedBox(height: MediaQuery.of(context).size.height * 0.03), Row( children: statusLinkedHashMap.expand((linkedHashMap) { - return linkedHashMap.entries.map((MapEntry item) { + return linkedHashMap.entries + .map((MapEntry item) { return Expanded( child: Padding( padding: EdgeInsets.symmetric( @@ -116,22 +121,30 @@ class _DetailsComponentWidgetState extends State { filled: true, fillColor: item.value, labelText: item.key, - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: 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, + FlutterFlowTheme.of(context) + .labelMediumFamily, ), fontSize: limitedBodyFontSize, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).info, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).labelMediumFamily, + FlutterFlowTheme.of(context) + .labelMediumFamily, ), fontSize: limitedBodyFontSize, ), @@ -144,7 +157,8 @@ class _DetailsComponentWidgetState extends State { ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).info, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( @@ -155,7 +169,8 @@ class _DetailsComponentWidgetState extends State { textAlign: TextAlign.center, maxLines: null, keyboardType: TextInputType.name, - validator: _model.textController1Validator.asValidator(context), + validator: _model.textController1Validator + .asValidator(context), ), ), ); @@ -175,7 +190,8 @@ class _DetailsComponentWidgetState extends State { readOnly: true, initialValue: '$value', style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( @@ -190,19 +206,26 @@ class _DetailsComponentWidgetState extends State { border: OutlineInputBorder( borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primaryBackground, // Change border color here + color: FlutterFlowTheme.of(context) + .primaryBackground, // Change border color here ), ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).labelMediumFamily, ), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( @@ -212,25 +235,29 @@ class _DetailsComponentWidgetState extends State { enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primaryBackground, // Change border color here + color: FlutterFlowTheme.of(context) + .primaryBackground, // Change border color here ), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primaryBackground, // Change border color here + color: FlutterFlowTheme.of(context) + .primaryBackground, // Change border color here ), ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primaryBackground, // Change border color here + color: FlutterFlowTheme.of(context) + .primaryBackground, // Change border color here ), ), focusedErrorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primaryBackground, // Change border color here + color: FlutterFlowTheme.of(context) + .primaryBackground, // Change border color here ), ), ), diff --git a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_model.dart b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_model.dart index aff803ff..3f9ca6ac 100644 --- a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_model.dart +++ b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_model.dart @@ -2,10 +2,12 @@ import 'package:hub/shared/utils/validator_util.dart'; import '/backend/api_requests/api_calls.dart'; import '/flutter_flow/flutter_flow_util.dart'; -import 'forgot_password_template_component_widget.dart' show ForgotPasswordTemplateComponentWidget; +import 'forgot_password_template_component_widget.dart' + show ForgotPasswordTemplateComponentWidget; import 'package:flutter/material.dart'; -class ForgotPasswordTemplateComponentModel extends FlutterFlowModel { +class ForgotPasswordTemplateComponentModel + extends FlutterFlowModel { /// State fields for stateful widgets in this component. final formKey = GlobalKey(); @@ -13,7 +15,8 @@ class ForgotPasswordTemplateComponentModel extends FlutterFlowModel 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, @@ -97,7 +102,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), @@ -250,23 +277,28 @@ class _ForgotPasswordTemplateComponentWidgetState extends State { + extends FlutterFlowModel< + LiberationHistoryItemDetailsTemplateComponentWidget> { late final String devUUID; late final String userUUID; late final String cliUUID; @@ -27,9 +28,12 @@ class LiberationHistoryItemDetailsTemplateComponentModel void initState(BuildContext context) {} Future initDatabase() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; ; } diff --git a/lib/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_widget.dart b/lib/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_widget.dart index 5ed0fd82..539f36eb 100644 --- a/lib/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_widget.dart +++ b/lib/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_widget.dart @@ -5,7 +5,8 @@ import 'package:hub/components/templates_components/liberation_history_item_deta import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -class LiberationHistoryItemDetailsTemplateComponentWidget extends StatefulWidget { +class LiberationHistoryItemDetailsTemplateComponentWidget + extends StatefulWidget { const LiberationHistoryItemDetailsTemplateComponentWidget({ super.key, required this.name, @@ -39,7 +40,8 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState @override void initState() { super.initState(); - _model = createModel(context, () => LiberationHistoryItemDetailsTemplateComponentModel()); + _model = createModel( + context, () => LiberationHistoryItemDetailsTemplateComponentModel()); _model.textController1 ??= TextEditingController(text: widget.name); _model.textFieldFocusNode1 ??= FocusNode(); @@ -104,10 +106,13 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState fit: BoxFit.cover, ), ), - ].addToStart(const SizedBox(width: 10.0)).addToEnd(const SizedBox(width: 10.0)), + ] + .addToStart(const SizedBox(width: 10.0)) + .addToEnd(const SizedBox(width: 10.0)), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController1, focusNode: _model.textFieldFocusNode1, @@ -120,19 +125,25 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState labelText: FFLocalizations.of(context).getText( 'dmazrriq' /* Nome */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -144,16 +155,18 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, - validator: _model.textController1Validator.asValidator(context), + validator: + _model.textController1Validator.asValidator(context), ), ), Row( @@ -172,19 +185,27 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState labelText: FFLocalizations.of(context).getText( 'xx3ivbr4' /* Tipo */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -196,22 +217,28 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, - validator: _model.textController2Validator.asValidator(context), + validator: _model.textController2Validator + .asValidator(context), ), ), - ].addToStart(const SizedBox(width: 24.0)).addToEnd(const SizedBox(width: 24.0)), + ] + .addToStart(const SizedBox(width: 24.0)) + .addToEnd(const SizedBox(width: 24.0)), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController3, focusNode: _model.textFieldFocusNode3, @@ -224,19 +251,25 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState labelText: FFLocalizations.of(context).getText( 'rhheok7k' /* Acesso */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -248,20 +281,23 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, - validator: _model.textController3Validator.asValidator(context), + validator: + _model.textController3Validator.asValidator(context), ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController4, focusNode: _model.textFieldFocusNode4, @@ -275,18 +311,24 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState labelText: FFLocalizations.of(context).getText( 'w3tciqlv' /* Acionamento */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -298,14 +340,16 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), textAlign: TextAlign.start, - validator: _model.textController4Validator.asValidator(context), + validator: + _model.textController4Validator.asValidator(context), ), ), ] diff --git a/lib/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart b/lib/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart index 2262612b..1039a738 100644 --- a/lib/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart +++ b/lib/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart @@ -37,7 +37,8 @@ class _MessageNotificationModalTemplateComponentWidgetState @override void initState() { super.initState(); - _model = createModel(context, () => MessageNotificationModalTemplateComponentModel()); + _model = createModel( + context, () => MessageNotificationModalTemplateComponentModel()); _model.textController1 ??= TextEditingController(text: widget.message); _model.textFieldFocusNode1 ??= FocusNode(); @@ -59,7 +60,8 @@ class _MessageNotificationModalTemplateComponentWidgetState @override Widget build(BuildContext context) { double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); - double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context); + double limitedSubHeaderFontSize = + LimitedFontSizeUtil.getSubHeaderFontSize(context); return Container( width: MediaQuery.sizeOf(context).width, @@ -79,7 +81,8 @@ class _MessageNotificationModalTemplateComponentWidgetState mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController1, focusNode: _model.textFieldFocusNode1, @@ -94,17 +97,21 @@ class _MessageNotificationModalTemplateComponentWidgetState enText: 'Message', ), labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), fontSize: limitedBodyFontSize, ), hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), fontSize: limitedBodyFontSize, ), enabledBorder: InputBorder.none, @@ -120,7 +127,8 @@ class _MessageNotificationModalTemplateComponentWidgetState fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), fontSize: limitedBodyFontSize, ), textAlign: TextAlign.start, @@ -146,20 +154,26 @@ class _MessageNotificationModalTemplateComponentWidgetState ptText: 'De', enText: 'From', ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), fontSize: limitedBodyFontSize, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), fontSize: limitedBodyFontSize, ), enabledBorder: InputBorder.none, @@ -172,22 +186,27 @@ class _MessageNotificationModalTemplateComponentWidgetState ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, - validator: _model.textController2Validator.asValidator(context), + validator: + _model.textController2Validator.asValidator(context), ), ), - ].addToStart(const SizedBox(width: 24.0)).addToEnd(const SizedBox(width: 24.0)), + ] + .addToStart(const SizedBox(width: 24.0)) + .addToEnd(const SizedBox(width: 24.0)), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController3, focusNode: _model.textFieldFocusNode3, @@ -202,17 +221,21 @@ class _MessageNotificationModalTemplateComponentWidgetState enText: 'To', ), labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), fontSize: limitedBodyFontSize, ), hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), fontSize: limitedBodyFontSize, ), enabledBorder: InputBorder.none, @@ -228,7 +251,8 @@ class _MessageNotificationModalTemplateComponentWidgetState fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), fontSize: limitedBodyFontSize, ), textAlign: TextAlign.start, diff --git a/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart b/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart index 95937bac..4b69ecec 100644 --- a/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart +++ b/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart @@ -7,7 +7,8 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart'; -class ScheduleProvisionalVisitPageModel extends FlutterFlowModel { +class ScheduleProvisionalVisitPageModel + extends FlutterFlowModel { String cliUUID = ''; String devUUID = ''; String userUUID = ''; @@ -21,21 +22,25 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel visitors.add(item); void removeFromVisitors(dynamic item) => visitors.remove(item); void removeAtIndexFromVisitors(int index) => visitors.removeAt(index); - void insertAtIndexInVisitors(int index, dynamic item) => visitors.insert(index, item); - void updateVisitorsAtIndex(int index, Function(dynamic) updateFn) => visitors[index] = updateFn(visitors[index]); + void insertAtIndexInVisitors(int index, dynamic item) => + visitors.insert(index, item); + void updateVisitorsAtIndex(int index, Function(dynamic) updateFn) => + visitors[index] = updateFn(visitors[index]); List docs = []; void addToDocs(String item) => docs.add(item); void removeFromDocs(String item) => docs.remove(item); void removeAtIndexFromDocs(int index) => docs.removeAt(index); void insertAtIndexInDocs(int index, String item) => docs.insert(index, item); - void updateDocsAtIndex(int index, Function(String) updateFn) => docs[index] = updateFn(docs[index]); + void updateDocsAtIndex(int index, Function(String) updateFn) => + docs[index] = updateFn(docs[index]); final formKey = GlobalKey(); FocusNode? personNameFocusNode; TextEditingController? personNameTextController; String? Function(BuildContext, String?)? personNameTextControllerValidator; - String? _personNameTextControllerValidator(BuildContext context, String? val) { + String? _personNameTextControllerValidator( + BuildContext context, String? val) { if (val == null || val.isEmpty) { return FFLocalizations.of(context).getText('3hqg8buh'); } @@ -56,9 +61,11 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel 80) { + if (personNameTextController.text == '' || + personNameTextController.text.length > 80) { return false; } @@ -121,10 +130,12 @@ class ScheduleProvisionalVisitPageModel extends FlutterFlowModel init() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - ownerName = (await StorageHelper().get(KeychainStorageKey.ownerName.value)) ?? ''; - ownerUUID = (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + ownerName = + (await StorageHelper().get(KeychainStorageKey.ownerName.value)) ?? ''; + ownerUUID = + (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? ''; setState?.call(); } } diff --git a/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart b/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart index debd346b..03d84544 100644 --- a/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart +++ b/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart @@ -17,10 +17,12 @@ class ScheduleProvisionalVisitPageWidget extends StatefulWidget { const ScheduleProvisionalVisitPageWidget({super.key}); @override - State createState() => _ScheduleProvisionalVisitPageWidgetState(); + State createState() => + _ScheduleProvisionalVisitPageWidgetState(); } -class _ScheduleProvisionalVisitPageWidgetState extends State { +class _ScheduleProvisionalVisitPageWidgetState + extends State { late ScheduleProvisionalVisitPageModel model; @override @@ -41,8 +43,10 @@ class _ScheduleProvisionalVisitPageWidgetState extends State FocusScope.of(context).unfocus(), @@ -65,18 +69,24 @@ class _ScheduleProvisionalVisitPageWidgetState extends State EasyDebounce.debounce( + controller: + model.personNameTextController, + focusNode: + model.personNameFocusNode, + cursorColor: + FlutterFlowTheme.of(context) + .primary, + onChanged: (_) => + EasyDebounce.debounce( 'model.personNameTextController', const Duration(milliseconds: 500), () => setState(() {}), ), autofocus: false, - textInputAction: TextInputAction.next, + textInputAction: + TextInputAction.next, obscureText: false, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( + labelText: + FFLocalizations.of(context) + .getText( 'wehvxbz4' /* Nome / Apelido do Visitante */, ), - labelStyle: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - fontSize: limitedInputFontSize, - ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), - fontSize: limitedInputFontSize, - ), + labelStyle: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + color: + FlutterFlowTheme.of( + context) + .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + fontSize: + limitedInputFontSize, + ), + hintStyle: + FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .labelMediumFamily, + color: + FlutterFlowTheme.of( + context) + .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .labelMediumFamily), + fontSize: + limitedInputFontSize, + ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).customColor5, + color: FlutterFlowTheme.of( + context) + .customColor5, width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), + borderRadius: + BorderRadius.circular(10.0), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, + color: FlutterFlowTheme.of( + context) + .primary, width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), + borderRadius: + BorderRadius.circular(10.0), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: FlutterFlowTheme.of( + context) + .error, width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), + borderRadius: + BorderRadius.circular(10.0), ), - focusedErrorBorder: OutlineInputBorder( + focusedErrorBorder: + OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, + color: FlutterFlowTheme.of( + context) + .error, width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), + borderRadius: + BorderRadius.circular(10.0), ), suffixIcon: Icon( Icons.person, - color: FlutterFlowTheme.of(context).accent1, + color: + FlutterFlowTheme.of(context) + .accent1, ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + color: FlutterFlowTheme.of( + context) + .primaryText, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - fontSize: limitedInputFontSize, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + fontSize: + limitedInputFontSize, ), textAlign: TextAlign.start, maxLines: null, - validator: model.personNameTextControllerValidator.asValidator(context), + validator: model + .personNameTextControllerValidator + .asValidator(context), ), ), ), @@ -300,17 +412,25 @@ class _ScheduleProvisionalVisitPageWidgetState extends State EasyDebounce.debounce( + controller: + model.dateTimeTextController, + focusNode: + model.dateTimeFocusNode, + cursorColor: + FlutterFlowTheme.of(context) + .primary, + onChanged: (_) => + EasyDebounce.debounce( 'model.dateTimeTextController', - const Duration(milliseconds: 500), + const Duration( + milliseconds: 500), () => setState(() {}), ), readOnly: true, @@ -318,99 +438,179 @@ class _ScheduleProvisionalVisitPageWidgetState extends State { +class QrCodePassKeyTemplateComponentModel + extends FlutterFlowModel { /// State fields for stateful widgets in this component. final formKey = GlobalKey(); @@ -11,7 +13,8 @@ class QrCodePassKeyTemplateComponentModel extends FlutterFlowModel createState() => _QrCodePassKeyTemplateComponentWidgetState(); + State createState() => + _QrCodePassKeyTemplateComponentWidgetState(); } -class _QrCodePassKeyTemplateComponentWidgetState extends State { +class _QrCodePassKeyTemplateComponentWidgetState + extends State { late QrCodePassKeyTemplateComponentModel _model; @override @@ -83,7 +85,8 @@ class _QrCodePassKeyTemplateComponentWidgetState extends State safeSetState( - () => _model.keyTextFieldVisibility = !_model.keyTextFieldVisibility, + () => _model.keyTextFieldVisibility = + !_model.keyTextFieldVisibility, ), focusNode: FocusNode(skipTraversal: true), child: Icon( - _model.keyTextFieldVisibility ? Icons.visibility_outlined : Icons.visibility_off_outlined, + _model.keyTextFieldVisibility + ? Icons.visibility_outlined + : Icons.visibility_off_outlined, color: FlutterFlowTheme.of(context).accent1, size: 22.0, ), @@ -241,16 +270,23 @@ class _QrCodePassKeyTemplateComponentWidgetState extends State null, + buildCounter: (context, + {required currentLength, + required isFocused, + maxLength}) => + null, keyboardType: TextInputType.number, - validator: _model.keyTextFieldTextControllerValidator.asValidator(context), + validator: _model.keyTextFieldTextControllerValidator + .asValidator(context), inputFormatters: [ FilteringTextInputFormatter.allow(RegExp('[0-9]')), LengthLimitingTextInputFormatter(4), @@ -261,10 +297,12 @@ class _QrCodePassKeyTemplateComponentWidgetState extends State { +class RegisiterVistorTemplateComponentModel + extends FlutterFlowModel { Timer? _debounceTimer; late final String devUUID; late final String userUUID; @@ -18,7 +19,8 @@ class RegisiterVistorTemplateComponentModel extends FlutterFlowModel getVisitanteByDocument(String document, BuildContext context) async { + Future getVisitanteByDocument( + String document, BuildContext context) async { final response = await PhpGroup.getVisitorByDocCall.call( documento: document, ); - if (response.jsonBody['visitante']['VTE_ID'] != '0' && response.jsonBody['error'] != 'false') { + if (response.jsonBody['visitante']['VTE_ID'] != '0' && + response.jsonBody['error'] != 'false') { return true; } return false; @@ -90,7 +94,9 @@ class RegisiterVistorTemplateComponentModel extends FlutterFlowModel initializeDatabase() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; ; } diff --git a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart index b1c7d7ad..9202a84e 100644 --- a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart +++ b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart @@ -24,13 +24,16 @@ class RegisiterVistorTemplateComponentWidget extends StatefulWidget { final String source; final String? doc; - const RegisiterVistorTemplateComponentWidget({super.key, required this.source, this.doc}); + const RegisiterVistorTemplateComponentWidget( + {super.key, required this.source, this.doc}); @override - State createState() => _RegisiterVistorTemplateComponentWidgetState(); + State createState() => + _RegisiterVistorTemplateComponentWidgetState(); } -class _RegisiterVistorTemplateComponentWidgetState extends State { +class _RegisiterVistorTemplateComponentWidgetState + extends State { late RegisiterVistorTemplateComponentModel _model; bool _isLoading = false; final scaffoldKey = GlobalKey(); @@ -50,7 +53,8 @@ class _RegisiterVistorTemplateComponentWidgetState extends State.seeded(false); - _model = createModel(context, () => RegisiterVistorTemplateComponentModel()); + _model = + createModel(context, () => RegisiterVistorTemplateComponentModel()); _model.textController1 ??= TextEditingController(); _model.textFieldFocusNode1 ??= FocusNode(); @@ -87,15 +91,19 @@ class _RegisiterVistorTemplateComponentWidgetState extends State( - controller: _model.dropDownValueController ??= FormFieldController(null), + controller: _model.dropDownValueController ??= + FormFieldController(null), options: [ FFLocalizations.of(context).getText( 'n8vddmcq' /* Visitante */, @@ -384,15 +430,20 @@ class _RegisiterVistorTemplateComponentWidgetState extends State setState(() => _model.dropDownValue = val), + onChanged: (val) => + setState(() => _model.dropDownValue = val), width: MediaQuery.sizeOf(context).width * 0.9, // height: 44.0, - textStyle: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + textStyle: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), fontSize: limitedInputFontSize, ), hintText: FFLocalizations.of(context).getVariableText( @@ -408,30 +459,39 @@ class _RegisiterVistorTemplateComponentWidgetState extends State { +class SignInTemplateComponentModel + extends FlutterFlowModel { final formKey = GlobalKey(); final unfocusNode = FocusNode(); FocusNode? emailAddressFocusNode; TextEditingController? emailAddressTextController; String? Function(BuildContext, String?)? emailAddressTextControllerValidator; SignInTemplateComponentModel(); - String? _emailAddressTextControllerValidator(BuildContext context, String? val) { + String? _emailAddressTextControllerValidator( + BuildContext context, String? val) { if (val == null || val.isEmpty) { return FFLocalizations.of(context).getText( 'xhnawzcb' /* Campo é necessário */, diff --git a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart index d339f173..447109c6 100644 --- a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart +++ b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart @@ -28,10 +28,12 @@ class SignInTemplateComponentWidget extends StatefulWidget { final Future Function()? toggleSignUpPage; @override - 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( - borderSide: BorderSide(color: FlutterFlowTheme.of(context).customColor1, width: 0.25), - borderRadius: BorderRadius.circular(12.0), + 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), ), 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), + 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), ), - 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), - child: Icon(_model.passwordVisibility ? Icons.visibility_outlined : Icons.visibility_off_outlined, - color: FlutterFlowTheme.of(context).accent1, size: 24.0), + 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, + 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), ), ), ), @@ -338,73 +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), - 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')), + 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')), 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), - 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, + 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, letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + 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), + borderSide: + const BorderSide( + color: Colors + .transparent, + width: 1.0), + borderRadius: + BorderRadius.circular( + 12.0), ), showLoadingIndicator: false, ), @@ -414,143 +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), - 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'), - ), + 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) + .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), - 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'), - ), + 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: + 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), ), ), ), @@ -560,7 +950,8 @@ class _SignInTemplateComponentWidgetState extends State { +class SignUpTemplateComponentModel + extends FlutterFlowModel { final formKey = GlobalKey(); FocusNode? nameRegisterFormFocusNode; TextEditingController? nameRegisterFormTextController; - String? Function(BuildContext, String?)? nameRegisterFormTextControllerValidator; - String? _nameRegisterFormTextControllerValidator(BuildContext context, String? val) { + String? Function(BuildContext, String?)? + nameRegisterFormTextControllerValidator; + String? _nameRegisterFormTextControllerValidator( + BuildContext context, String? val) { if (val == null || val.isEmpty) { return FFLocalizations.of(context).getText( '3bs10dfq' /* Campo é necessário */, @@ -20,8 +24,10 @@ class SignUpTemplateComponentModel extends FlutterFlowModel createState() => _SignUpTemplateComponentWidgetState(); + State createState() => + _SignUpTemplateComponentWidgetState(); } -class _SignUpTemplateComponentWidgetState extends State with TickerProviderStateMixin { +class _SignUpTemplateComponentWidgetState + extends State with TickerProviderStateMixin { late SignUpTemplateComponentModel _model; final animationsMap = {}; late String _deviceType; @@ -91,7 +94,8 @@ class _SignUpTemplateComponentWidgetState extends State _initialize() async { - _deviceType = (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? ''; + _deviceType = + (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? ''; } @override @@ -107,19 +111,24 @@ class _SignUpTemplateComponentWidgetState extends State('nameTextFormField'), - controller: _model.nameRegisterFormTextController, - focusNode: _model.nameRegisterFormFocusNode, - onChanged: (_) => EasyDebounce.debounce( + key: const ValueKey( + 'nameTextFormField'), + controller: _model + .nameRegisterFormTextController, + focusNode: _model + .nameRegisterFormFocusNode, + onChanged: (_) => + EasyDebounce.debounce( '_model.nameRegisterFormTextController', - const Duration(milliseconds: 500), + const Duration( + milliseconds: 500), () => setState(() {}), ), autofocus: false, - autofillHints: const [AutofillHints.name], + autofillHints: const [ + AutofillHints.name + ], obscureText: false, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( + labelText: + FFLocalizations.of( + context) + .getText( '3corpwhd' /* Nome */, ), - 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( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).error, - fontSize: limitedInputFontSize, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, + fontFamily: + 'Plus Jakarta Sans', + color: + FlutterFlowTheme.of( + context) + .error, + fontSize: + limitedInputFontSize, + fontWeight: + FontWeight.w400, + fontStyle: + FontStyle.normal, ), - 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), ), filled: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, + fillColor: + FlutterFlowTheme.of( + context) + .primaryBackground, suffixIcon: Icon( Icons.person, - 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, + 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'), + fontWeight: + FontWeight.w500, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), - validator: _model.nameRegisterFormTextControllerValidator.asValidator(context), + validator: _model + .nameRegisterFormTextControllerValidator + .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('emailTextFormField'), - controller: _model.emailRegisterFormTextController, - focusNode: _model.emailRegisterFormFocusNode, - onChanged: (_) => EasyDebounce.debounce( + key: const ValueKey( + 'emailTextFormField'), + controller: _model + .emailRegisterFormTextController, + focusNode: _model + .emailRegisterFormFocusNode, + onChanged: (_) => + EasyDebounce.debounce( '_model.emailRegisterFormTextController', - const Duration(milliseconds: 500), + const Duration( + milliseconds: 500), () => setState(() {}), ), autofocus: false, - autofillHints: const [AutofillHints.email], + autofillHints: const [ + AutofillHints.email + ], obscureText: false, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( + labelText: + FFLocalizations.of( + context) + .getText( '80wonb69' /* 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).primaryText, + color: + FlutterFlowTheme.of( + context) + .primaryText, 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( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).error, - fontSize: limitedInputFontSize, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, + fontFamily: + 'Plus Jakarta Sans', + color: + FlutterFlowTheme.of( + context) + .error, + fontSize: + limitedInputFontSize, + fontWeight: + FontWeight.w400, + fontStyle: + FontStyle.normal, ), - 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), ), filled: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, + fillColor: + FlutterFlowTheme.of( + context) + .primaryBackground, 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).customColor1, - fontSize: limitedInputFontSize, + style: FlutterFlowTheme.of( + context) + .bodyLarge + .override( + fontFamily: + 'Plus Jakarta Sans', + color: + FlutterFlowTheme.of( + context) + .customColor1, + 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'), ), - keyboardType: TextInputType.emailAddress, - validator: _model.emailRegisterFormTextControllerValidator.asValidator(context), + keyboardType: TextInputType + .emailAddress, + validator: _model + .emailRegisterFormTextControllerValidator + .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.passwordRegisterFormTextController, - focusNode: _model.passwordRegisterFormFocusNode, - onChanged: (_) => EasyDebounce.debounce( + key: const ValueKey( + 'passwordTextFormField'), + controller: _model + .passwordRegisterFormTextController, + focusNode: _model + .passwordRegisterFormFocusNode, + onChanged: (_) => + EasyDebounce.debounce( '_model.passwordRegisterFormTextController', - const Duration(milliseconds: 500), + const Duration( + milliseconds: 500), () => setState(() {}), ), autofocus: false, - autofillHints: const [AutofillHints.password], - obscureText: !_model.passwordRegisterFormVisibility, + autofillHints: const [ + AutofillHints.password + ], + obscureText: !_model + .passwordRegisterFormVisibility, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( + labelText: + FFLocalizations.of( + context) + .getText( '0firji8l' /* Senha */, ), - 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( - borderSide: const BorderSide( - color: Color(0xFF1AAB5F), + focusedBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + color: + Color(0xFF1AAB5F), width: 0.25, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular( + 12.0), ), - errorBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: Color(0xFFFF5963), + errorBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + color: + Color(0xFFFF5963), width: 0.25, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular( + 12.0), ), errorStyle: TextStyle( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).error, - fontSize: limitedInputFontSize, - fontWeight: FontWeight.w400, - fontStyle: FontStyle.normal, + fontFamily: + 'Plus Jakarta Sans', + color: + FlutterFlowTheme.of( + context) + .error, + fontSize: + limitedInputFontSize, + fontWeight: + FontWeight.w400, + fontStyle: + FontStyle.normal, ), - focusedErrorBorder: OutlineInputBorder( - borderSide: const BorderSide( - color: Color(0xFFFF5963), + focusedErrorBorder: + OutlineInputBorder( + borderSide: + const BorderSide( + color: + Color(0xFFFF5963), width: 0.25, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular( + 12.0), ), filled: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, + fillColor: + FlutterFlowTheme.of( + context) + .primaryBackground, suffixIcon: InkWell( - key: const ValueKey('passwordVisibilitySuffixIcon'), + key: const ValueKey< + String>( + 'passwordVisibilitySuffixIcon'), onTap: () => setState( - () => _model.passwordRegisterFormVisibility = !_model.passwordRegisterFormVisibility, + () => _model + .passwordRegisterFormVisibility = + !_model + .passwordRegisterFormVisibility, ), - focusNode: FocusNode(skipTraversal: true), + focusNode: FocusNode( + skipTraversal: true), child: Icon( - _model.passwordRegisterFormVisibility ? Icons.visibility_outlined : Icons.visibility_off_outlined, - color: FlutterFlowTheme.of(context).accent1, + _model.passwordRegisterFormVisibility + ? 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, + 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'), + fontWeight: + FontWeight.w500, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), - validator: _model.passwordRegisterFormTextControllerValidator.asValidator(context), + validator: _model + .passwordRegisterFormTextControllerValidator + .asValidator(context), ), ), ), @@ -475,53 +728,86 @@ class _SignUpTemplateComponentWidgetState extends State('SubmitButtonWidget'), + key: const ValueKey( + 'SubmitButtonWidget'), onPressed: isFormInvalid() ? null : () async { var shouldSetState = false; - _model.register = await AuthenticationService.signUp( + _model.register = + await AuthenticationService + .signUp( context, - email: _model.emailRegisterFormTextController.text, - name: _model.nameRegisterFormTextController.text, - passwd: _model.passwordRegisterFormTextController.text, + email: _model + .emailRegisterFormTextController + .text, + name: _model + .nameRegisterFormTextController + .text, + passwd: _model + .passwordRegisterFormTextController + .text, device: _deviceType, ); shouldSetState = true; if (_model.register == true) - await widget.toggleSignInPage?.call(); + await widget + .toggleSignInPage + ?.call(); else { - if (shouldSetState) setState(() {}); + if (shouldSetState) + setState(() {}); return; } - if (shouldSetState) setState(() {}); + if (shouldSetState) + setState(() {}); }, - text: FFLocalizations.of(context).getText( + text: FFLocalizations.of(context) + .getText( 'rnvdwzei' /* Cadastrar-se */, ), options: FFButtonOptions( width: double.infinity, height: 44.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).accent1, - textStyle: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).secondaryText, - fontSize: limitedInputFontSize, + 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) + .accent1, + textStyle: FlutterFlowTheme.of( + context) + .titleSmall + .override( + fontFamily: + 'Plus Jakarta Sans', + color: FlutterFlowTheme.of( + context) + .secondaryText, + fontSize: + limitedInputFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + 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, + borderRadius: + BorderRadius.circular(12.0), + disabledColor: + FlutterFlowTheme.of(context) + .customColor5, disabledTextColor: Colors.white, ), showLoadingIndicator: true, @@ -530,46 +816,81 @@ class _SignUpTemplateComponentWidgetState extends State('toggleSignInPage'), + key: const ValueKey( + 'toggleSignInPage'), splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, - onTap: () async => await widget.toggleSignInPage?.call(), + onTap: () async => await widget + .toggleSignInPage + ?.call(), 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( 'a9smhn5b' /* Você já tem uma conta? */, ), style: TextStyle( - color: FlutterFlowTheme.of(context).primaryText, - fontSize: limitedInputFontSize, + color: FlutterFlowTheme.of( + context) + .primaryText, + fontSize: + limitedInputFontSize, ), ), TextSpan( - text: FFLocalizations.of(context).getText( + text: FFLocalizations.of( + context) + .getText( '09xv5ctc' /* Clique aqui */, ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primary, - fontSize: limitedInputFontSize, + style: FlutterFlowTheme.of( + context) + .bodyMedium + .override( + fontFamily: + 'Plus Jakarta Sans', + color: + FlutterFlowTheme.of( + context) + .primary, + fontSize: + limitedInputFontSize, letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + fontWeight: + FontWeight.w600, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), ) ], - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - ), + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + ), ), ), ), @@ -579,7 +900,8 @@ class _SignUpTemplateComponentWidgetState extends State { } Future initializeDatabase() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; ; } diff --git a/lib/components/templates_components/view_visit_detail/view_visit_detail_widget.dart b/lib/components/templates_components/view_visit_detail/view_visit_detail_widget.dart index ead69613..fbbd960a 100644 --- a/lib/components/templates_components/view_visit_detail/view_visit_detail_widget.dart +++ b/lib/components/templates_components/view_visit_detail/view_visit_detail_widget.dart @@ -85,20 +85,23 @@ class _ViewVisitDetailWidgetState extends State { // } // }); - _model.textController1 = - TextEditingController(text: widget.visitTempStr == 'null' ? '' : widget.visitTempStr ?? ''); + _model.textController1 = TextEditingController( + text: widget.visitTempStr == 'null' ? '' : widget.visitTempStr ?? ''); _model.textFieldFocusNode1 ??= FocusNode(); - _model.textController2 ??= TextEditingController(text: widget.visitStartDate); + _model.textController2 ??= + TextEditingController(text: widget.visitStartDate); _model.textFieldFocusNode2 ??= FocusNode(); _model.textController3 ??= TextEditingController(text: widget.visitEndDate); _model.textFieldFocusNode3 ??= FocusNode(); - _model.textController4 ??= TextEditingController(text: widget.visitReasonStr); + _model.textController4 ??= + TextEditingController(text: widget.visitReasonStr); _model.textFieldFocusNode4 ??= FocusNode(); - _model.textController5 ??= TextEditingController(text: widget.visitLevelStr); + _model.textController5 ??= + TextEditingController(text: widget.visitLevelStr); _model.textFieldFocusNode5 ??= FocusNode(); _model.textController6 ??= TextEditingController(text: widget.visitObsStr); @@ -114,7 +117,8 @@ class _ViewVisitDetailWidgetState extends State { @override Widget build(BuildContext context) { - var filteredVisitorJsonList = findVisitorById(widget.visitorJsonList, widget.visitIdStr) ?? 'null'; + var filteredVisitorJsonList = + findVisitorById(widget.visitorJsonList, widget.visitIdStr) ?? 'null'; return Padding( padding: const EdgeInsetsDirectional.fromSTEB(0.0, 200.0, 0.0, 0.0), @@ -150,7 +154,8 @@ class _ViewVisitDetailWidgetState extends State { child: Align( alignment: const AlignmentDirectional(1.0, 0.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(15.0, 0.0, 15.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 15.0, 0.0, 15.0, 0.0), child: FlutterFlowIconButton( borderRadius: 20.0, borderWidth: 1.0, @@ -179,7 +184,8 @@ class _ViewVisitDetailWidgetState extends State { Align( alignment: const AlignmentDirectional(1.0, -1.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 20.0, 20.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 20.0, 20.0), child: Container( width: 100.0, decoration: const BoxDecoration(), @@ -219,8 +225,10 @@ class _ViewVisitDetailWidgetState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(100.0), child: CachedNetworkImage( - fadeInDuration: const Duration(milliseconds: 500), - fadeOutDuration: const Duration(milliseconds: 500), + fadeInDuration: + const Duration(milliseconds: 500), + fadeOutDuration: + const Duration(milliseconds: 500), imageUrl: valueOrDefault( widget.visitorImgPath, 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', @@ -239,7 +247,8 @@ class _ViewVisitDetailWidgetState extends State { Container( decoration: const BoxDecoration(), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 10.0), child: TextFormField( controller: _model.textController1, focusNode: _model.textFieldFocusNode1, @@ -253,19 +262,27 @@ class _ViewVisitDetailWidgetState extends State { labelText: FFLocalizations.of(context).getText( '9yu35pzg' /* Encerramento da Visita */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -297,24 +314,29 @@ class _ViewVisitDetailWidgetState extends State { ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), - validator: _model.textController1Validator.asValidator(context), + validator: _model.textController1Validator + .asValidator(context), ), ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 10.0), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController2, focusNode: _model.textFieldFocusNode2, @@ -328,22 +350,34 @@ class _ViewVisitDetailWidgetState extends State { labelText: FFLocalizations.of(context).getText( 'aj6scczp' /* Início */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), hintText: FFLocalizations.of(context).getText( 'ub084nhy' /* dd/mm/yyyy */, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -374,20 +408,27 @@ class _ViewVisitDetailWidgetState extends State { borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + 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), ), textAlign: TextAlign.center, - validator: _model.textController2Validator.asValidator(context), + validator: _model.textController2Validator + .asValidator(context), ), ), ), Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController3, focusNode: _model.textFieldFocusNode3, @@ -401,22 +442,34 @@ class _ViewVisitDetailWidgetState extends State { labelText: FFLocalizations.of(context).getText( 'rvi5z7wg' /* Término */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), hintText: FFLocalizations.of(context).getText( 'ixs67mrz' /* dd/mm/yyyy */, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -447,14 +500,20 @@ class _ViewVisitDetailWidgetState extends State { borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + 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), ), textAlign: TextAlign.center, - validator: _model.textController3Validator.asValidator(context), + validator: _model.textController3Validator + .asValidator(context), ), ), ), @@ -462,14 +521,16 @@ class _ViewVisitDetailWidgetState extends State { ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 10.0), child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController4, focusNode: _model.textFieldFocusNode4, @@ -483,22 +544,34 @@ class _ViewVisitDetailWidgetState extends State { labelText: FFLocalizations.of(context).getText( 'yxilg7ek' /* Motivo da Visita */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), hintText: FFLocalizations.of(context).getText( 'ypeydbem' /* Motivo */, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -529,20 +602,27 @@ class _ViewVisitDetailWidgetState extends State { borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + 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), ), textAlign: TextAlign.center, - validator: _model.textController4Validator.asValidator(context), + validator: _model.textController4Validator + .asValidator(context), ), ), ), Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController5, focusNode: _model.textFieldFocusNode5, @@ -556,22 +636,34 @@ class _ViewVisitDetailWidgetState extends State { labelText: FFLocalizations.of(context).getText( 'dgr3pk3a' /* Nível de Acesso */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), hintText: FFLocalizations.of(context).getText( 'rs3d4gb8' /* Nível de Acesso */, ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -602,14 +694,20 @@ class _ViewVisitDetailWidgetState extends State { borderRadius: BorderRadius.circular(8.0), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + 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), ), textAlign: TextAlign.center, - validator: _model.textController5Validator.asValidator(context), + validator: _model.textController5Validator + .asValidator(context), ), ), ), @@ -619,7 +717,8 @@ class _ViewVisitDetailWidgetState extends State { Container( decoration: const BoxDecoration(), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController6, focusNode: _model.textFieldFocusNode6, @@ -633,19 +732,27 @@ class _ViewVisitDetailWidgetState extends State { labelText: FFLocalizations.of(context).getText( 'lppn9rxa' /* Observações da Visita */, ), - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( @@ -677,12 +784,15 @@ class _ViewVisitDetailWidgetState extends State { ), ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, letterSpacing: 0.0, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), - validator: _model.textController6Validator.asValidator(context), + validator: _model.textController6Validator + .asValidator(context), ), ), ), @@ -707,7 +817,8 @@ class _ViewVisitDetailWidgetState extends State { size: 24.0, ), onPressed: () async { - _model.deleteVisit = await PhpGroup.deleteVisitCall.call( + _model.deleteVisit = + await PhpGroup.deleteVisitCall.call( idVisita: widget.visitIdStr, ); @@ -717,7 +828,8 @@ class _ViewVisitDetailWidgetState extends State { false) { context.pop(); } else { - final error = await DialogUtil.errorDefault(context); + final error = + await DialogUtil.errorDefault(context); await showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent, diff --git a/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_model.dart b/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_model.dart index c7143f06..7cd079db 100644 --- a/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_model.dart +++ b/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_model.dart @@ -5,7 +5,8 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:flutter/material.dart'; -class VisitDetailsModalTemplateComponentModel extends FlutterFlowModel { +class VisitDetailsModalTemplateComponentModel + extends FlutterFlowModel { /// Local state fields for this component. Color statusColor = const Color(0xff000000); @@ -20,7 +21,8 @@ class VisitDetailsModalTemplateComponentModel extends FlutterFlowModel ViewVisitDetailModel()); - scheduleVisitDetailModel = createModel(context, () => ScheduleVisitDetailModel()); + scheduleVisitDetailModel = + createModel(context, () => ScheduleVisitDetailModel()); } @override diff --git a/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart b/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart index b6e63072..a5e922e8 100644 --- a/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart +++ b/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart @@ -41,10 +41,12 @@ class VisitDetailsModalTemplateComponentWidget extends StatefulWidget { final Color? visitStatusColor; @override - State createState() => _VisitDetailsModalTemplateComponentWidgetState(); + State createState() => + _VisitDetailsModalTemplateComponentWidgetState(); } -class _VisitDetailsModalTemplateComponentWidgetState extends State { +class _VisitDetailsModalTemplateComponentWidgetState + extends State { late VisitDetailsModalTemplateComponentModel _model; @override @@ -56,7 +58,8 @@ class _VisitDetailsModalTemplateComponentWidgetState extends State VisitDetailsModalTemplateComponentModel()); + _model = + createModel(context, () => VisitDetailsModalTemplateComponentModel()); } @override diff --git a/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_model.dart b/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_model.dart index ee7ec7cf..d0f79706 100644 --- a/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_model.dart +++ b/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_model.dart @@ -1,8 +1,10 @@ import '/flutter_flow/flutter_flow_util.dart'; -import 'visitor_details_modal_template_component_widget.dart' show VisitorDetailsModalTemplateComponentWidget; +import 'visitor_details_modal_template_component_widget.dart' + show VisitorDetailsModalTemplateComponentWidget; import 'package:flutter/material.dart'; -class VisitorDetailsModalTemplateComponentModel extends FlutterFlowModel { +class VisitorDetailsModalTemplateComponentModel + extends FlutterFlowModel { @override void initState(BuildContext context) {} diff --git a/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart b/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart index fcd55d7b..98309e51 100644 --- a/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart +++ b/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart @@ -25,10 +25,12 @@ class VisitorDetailsModalTemplateComponentWidget extends StatefulWidget { final String? visitorEmail; @override - State createState() => _VisitorDetailsModalTemplateComponentWidgetState(); + State createState() => + _VisitorDetailsModalTemplateComponentWidgetState(); } -class _VisitorDetailsModalTemplateComponentWidgetState extends State { +class _VisitorDetailsModalTemplateComponentWidgetState + extends State { late VisitorDetailsModalTemplateComponentModel _model; @override @@ -40,7 +42,8 @@ class _VisitorDetailsModalTemplateComponentWidgetState extends State VisitorDetailsModalTemplateComponentModel()); + _model = + createModel(context, () => VisitorDetailsModalTemplateComponentModel()); } @override @@ -82,7 +85,8 @@ class _VisitorDetailsModalTemplateComponentWidgetState extends State { +class VisitorSearchModalTemplateComponentModel + extends FlutterFlowModel { late final String devUUID; late final String userUUID; late final String cliUUID; @@ -14,15 +15,18 @@ class VisitorSearchModalTemplateComponentModel extends FlutterFlowModel visitors.add(item); void removeFromVisitors(dynamic item) => visitors.remove(item); void removeAtIndexFromVisitors(int index) => visitors.removeAt(index); - void insertAtIndexInVisitors(int index, dynamic item) => visitors.insert(index, item); - void updateVisitorsAtIndex(int index, Function(dynamic) updateFn) => visitors[index] = updateFn(visitors[index]); + void insertAtIndexInVisitors(int index, dynamic item) => + visitors.insert(index, item); + void updateVisitorsAtIndex(int index, Function(dynamic) updateFn) => + visitors[index] = updateFn(visitors[index]); List docs = []; void addToDocs(String item) => docs.add(item); void removeFromDocs(String item) => docs.remove(item); void removeAtIndexFromDocs(int index) => docs.removeAt(index); void insertAtIndexInDocs(int index, String item) => docs.insert(index, item); - void updateDocsAtIndex(int index, Function(String) updateFn) => docs[index] = updateFn(docs[index]); + void updateDocsAtIndex(int index, Function(String) updateFn) => + docs[index] = updateFn(docs[index]); FocusNode? textFieldFocusNode; TextEditingController? textController; @@ -35,9 +39,12 @@ class VisitorSearchModalTemplateComponentModel extends FlutterFlowModel initDatabase() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; ; } diff --git a/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart b/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart index 6c3ea0f2..c7dfd15e 100644 --- a/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart +++ b/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart @@ -27,10 +27,12 @@ class VisitorSearchModalTemplateComponentWidget extends StatefulWidget { final Future Function(List? docsParam)? getDocs; @override - State createState() => _VisitorSearchModalTemplateComponentWidgetState(); + State createState() => + _VisitorSearchModalTemplateComponentWidgetState(); } -class _VisitorSearchModalTemplateComponentWidgetState extends State +class _VisitorSearchModalTemplateComponentWidgetState + extends State with TickerProviderStateMixin { late VisitorSearchModalTemplateComponentModel _model; @@ -42,7 +44,8 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State VisitorSearchModalTemplateComponentModel()); + _model = + createModel(context, () => VisitorSearchModalTemplateComponentModel()); _model.textController ??= TextEditingController(); _model.textFieldFocusNode ??= FocusNode(); @@ -57,9 +60,12 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State e).toList(); @@ -202,7 +224,8 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State( - getJsonField(visitorItem, r'''$.VTE_NOME''')?.toString(), + getJsonField(visitorItem, + r'''$.VTE_NOME''') + ?.toString(), 'NOT FOUND', ), - style: FlutterFlowTheme.of(context).bodyLarge.override( - fontFamily: FlutterFlowTheme.of(context).bodyLargeFamily, + style: FlutterFlowTheme.of( + context) + .bodyLarge + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyLargeFamily, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyLargeFamily), - fontSize: limitedBodyFontSize, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyLargeFamily), + fontSize: + limitedBodyFontSize, ), ), ), @@ -264,9 +310,13 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State 0 - ? () async => await addVisitor(context).whenComplete(safeSetState(() {})) + ? () async => await addVisitor(context) + .whenComplete(safeSetState(() {})) : () async => await sendVisitors(context), text: MediaQuery.of(context).viewInsets.bottom > 0 ? FFLocalizations.of(context).getVariableText( @@ -312,18 +364,23 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State addVisitor(BuildContext context) async { safeSetState(() { _model.textController?.text = _model.textController.text; - _model.textController?.selection = TextSelection.collapsed(offset: _model.textController!.text.length); + _model.textController?.selection = + TextSelection.collapsed(offset: _model.textController!.text.length); }); - _model.getVisitorByDoc = - await PhpGroup.getVisitorByDocCall.call(documento: _model.textController.text.replaceFirst(RegExp(r'^0+'), '')); + _model.getVisitorByDoc = await PhpGroup.getVisitorByDocCall.call( + documento: _model.textController.text.replaceFirst(RegExp(r'^0+'), '')); - if (PhpGroup.getVisitorByDocCall.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) != '0' && - PhpGroup.getVisitorByDocCall.error((_model.getVisitorByDoc?.jsonBody ?? '')) == false && - PhpGroup.getVisitorByDocCall.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) != null) { - String newDoc = _model.textController.text.replaceFirst(RegExp(r'^0+'), ''); + if (PhpGroup.getVisitorByDocCall + .vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) != + '0' && + PhpGroup.getVisitorByDocCall + .error((_model.getVisitorByDoc?.jsonBody ?? '')) == + false && + PhpGroup.getVisitorByDocCall + .vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) != + null) { + String newDoc = + _model.textController.text.replaceFirst(RegExp(r'^0+'), ''); bool existDoc = _model.docs.contains(newDoc); if (existDoc == false) { - _model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante((_model.getVisitorByDoc?.jsonBody ?? ''))); + _model.addToVisitors(PhpGroup.getVisitorByDocCall + .visitante((_model.getVisitorByDoc?.jsonBody ?? ''))); safeSetState(() {}); - _model.addToDocs(_model.textController.text.replaceFirst(RegExp(r'^0+'), '')); + _model.addToDocs( + _model.textController.text.replaceFirst(RegExp(r'^0+'), '')); safeSetState(() {}); } else if (existDoc == true) { ToastUtil.showToast( - message: FFLocalizations.of(context) - .getVariableText(ptText: 'Visitante já adicionado!', enText: 'Visitor already added!'), + message: FFLocalizations.of(context).getVariableText( + ptText: 'Visitante já adicionado!', + enText: 'Visitor already added!'), gravity: ToastGravity.TOP, backgroundColor: Colors.red, fontSize: LimitedFontSizeUtil.getBodyFontSize(context)); @@ -377,7 +445,8 @@ class _VisitorSearchModalTemplateComponentWidgetState extends State safeSetState(() { diff --git a/lib/components/templates_components/welcome_template_component/welcome_template_component_model.dart b/lib/components/templates_components/welcome_template_component/welcome_template_component_model.dart index 8a23ea35..17ea3047 100644 --- a/lib/components/templates_components/welcome_template_component/welcome_template_component_model.dart +++ b/lib/components/templates_components/welcome_template_component/welcome_template_component_model.dart @@ -1,8 +1,10 @@ import '/flutter_flow/flutter_flow_util.dart'; -import 'welcome_template_component_widget.dart' show WelcomeTemplateComponentWidget; +import 'welcome_template_component_widget.dart' + show WelcomeTemplateComponentWidget; import 'package:flutter/material.dart'; -class WelcomeTemplateComponentModel extends FlutterFlowModel { +class WelcomeTemplateComponentModel + extends FlutterFlowModel { @override void initState(BuildContext context) {} diff --git a/lib/components/templates_components/welcome_template_component/welcome_template_component_widget.dart b/lib/components/templates_components/welcome_template_component/welcome_template_component_widget.dart index b46eb07d..ee0d982d 100644 --- a/lib/components/templates_components/welcome_template_component/welcome_template_component_widget.dart +++ b/lib/components/templates_components/welcome_template_component/welcome_template_component_widget.dart @@ -23,10 +23,13 @@ class WelcomeTemplateComponentWidget extends StatefulWidget { final Future Function()? toggleSignInPage; @override - State createState() => _WelcomeTemplateComponentWidgetState(); + State createState() => + _WelcomeTemplateComponentWidgetState(); } -class _WelcomeTemplateComponentWidgetState extends State with TickerProviderStateMixin { +class _WelcomeTemplateComponentWidgetState + extends State + with TickerProviderStateMixin { late WelcomeTemplateComponentModel _model; final animationsMap = {}; @@ -87,8 +90,10 @@ class _WelcomeTemplateComponentWidgetState extends State('toggleSignInPage'), + key: const ValueKey( + 'toggleSignInPage'), onPressed: () async { await widget.toggleSignInPage?.call(); }, - text: FFLocalizations.of(context).getText('dynet730' /* Entrar */), + text: FFLocalizations.of(context) + .getText('dynet730' /* Entrar */), options: FFButtonOptions( width: double.infinity, height: 44.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( + 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, + color: + FlutterFlowTheme.of(context) + .info, fontSize: limitedInputFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), elevation: 3.0, borderSide: const BorderSide( color: Colors.transparent, width: 1.0, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular(12.0), ), 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'), + key: const ValueKey( + 'toggleSignUpPage'), onPressed: () async { await widget.toggleSignUpPage?.call(); }, - text: FFLocalizations.of(context).getText( + text: + FFLocalizations.of(context).getText( 'hha60cg7' /* Cadastrar */, ), options: FFButtonOptions( width: double.infinity, height: 44.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( + 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).primaryBackground, + color: + FlutterFlowTheme.of(context) + .primaryBackground, fontSize: limitedInputFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), elevation: 3.0, borderSide: const BorderSide( color: Colors.transparent, width: 1.0, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular(12.0), ), showLoadingIndicator: false, ), @@ -250,39 +297,59 @@ class _WelcomeTemplateComponentWidgetState extends State('toggleSignInPage'), + key: const ValueKey( + 'toggleSignInPage'), onPressed: () async { - await widget.toggleSignInPage?.call(); + await widget.toggleSignInPage + ?.call(); }, - text: FFLocalizations.of(context).getText( + text: FFLocalizations.of(context) + .getText( 'zvtay8ee' /* Entrar */, ), options: FFButtonOptions( width: double.infinity, height: 44.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, + 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: 16.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), elevation: 3.0, borderSide: const BorderSide( color: Colors.transparent, width: 1.0, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular(12.0), ), showLoadingIndicator: false, ), @@ -290,35 +357,54 @@ class _WelcomeTemplateComponentWidgetState extends State('toggleSignUpPage'), + key: const ValueKey( + 'toggleSignUpPage'), onPressed: () async { - await widget.toggleSignUpPage?.call(); + await widget.toggleSignUpPage + ?.call(); }, - text: FFLocalizations.of(context).getText( + text: FFLocalizations.of(context) + .getText( 'o6zob50a' /* Cadastrar */, ), options: FFButtonOptions( width: double.infinity, height: 44.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, + 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: 16.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + 'Plus Jakarta Sans'), ), elevation: 3.0, borderSide: const BorderSide( color: Colors.transparent, width: 1.0, ), - borderRadius: BorderRadius.circular(12.0), + borderRadius: + BorderRadius.circular(12.0), ), showLoadingIndicator: false, ), @@ -333,7 +419,8 @@ class _WelcomeTemplateComponentWidgetState extends State { requestFn: requestFn, ); void clearAccessHistoryCache() => _accessHistoryManager.clear(); - void clearAccessHistoryCacheKey(String? uniqueKey) => _accessHistoryManager.clearRequest(uniqueKey); + void clearAccessHistoryCacheKey(String? uniqueKey) => + _accessHistoryManager.clearRequest(uniqueKey); @override void initState(BuildContext context) { @@ -32,9 +33,12 @@ class AcessHistoryPageModel extends FlutterFlowModel { } Future initDatabase() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; } @override diff --git a/lib/features/history/presentation/blocs/provisional_history_bloc.dart b/lib/features/history/presentation/blocs/provisional_history_bloc.dart index 2601bb51..b5354bcf 100644 --- a/lib/features/history/presentation/blocs/provisional_history_bloc.dart +++ b/lib/features/history/presentation/blocs/provisional_history_bloc.dart @@ -34,8 +34,11 @@ class ProvisionalHistoryStateBloc { } } -class ProvisionalHistoryBloc extends Bloc { - ProvisionalHistoryBloc() : super(ProvisionalHistoryStateBloc(devUUID: '', userUUID: '', cliUUID: '')) { +class ProvisionalHistoryBloc + extends Bloc { + ProvisionalHistoryBloc() + : super(ProvisionalHistoryStateBloc( + devUUID: '', userUUID: '', cliUUID: '')) { on(_onLoadProvisionalHistory); } @@ -44,9 +47,16 @@ class ProvisionalHistoryBloc extends Bloc emit, ) async { emit(state.copyWith(isLoading: true)); - final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - emit(state.copyWith(devUUID: devUUID, userUUID: userUUID, cliUUID: cliUUID, isLoading: false)); + final devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + emit(state.copyWith( + devUUID: devUUID, + userUUID: userUUID, + cliUUID: cliUUID, + isLoading: false)); } } diff --git a/lib/features/history/presentation/pages/acess_history_page_widget.dart b/lib/features/history/presentation/pages/acess_history_page_widget.dart index 81501e99..1acaefd6 100644 --- a/lib/features/history/presentation/pages/acess_history_page_widget.dart +++ b/lib/features/history/presentation/pages/acess_history_page_widget.dart @@ -41,7 +41,8 @@ class _AccessHistoryState extends State { late Future _accessFuture; List _accessWrap = []; - _AccessHistoryState(Map opt) : selectedTypeSubject = BehaviorSubject.seeded(opt) { + _AccessHistoryState(Map opt) + : selectedTypeSubject = BehaviorSubject.seeded(opt) { selectedTypeSubject.listen((value) {}); } @@ -53,7 +54,8 @@ class _AccessHistoryState extends State { _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMoreAccess(); } }); @@ -113,7 +115,8 @@ class _AccessHistoryState extends State { color: theme.primaryText, fontSize: 16.0, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), + useGoogleFonts: + GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), ), ); } @@ -127,37 +130,40 @@ class _AccessHistoryState extends State { child: IconButton( icon: const Icon(Icons.filter_list), onPressed: () async { - final Map? selectedFilter = await showModalBottomSheet>( - isScrollControlled: true, - backgroundColor: Colors.transparent, - context: context, - builder: (context) { - return GestureDetector( - onTap: () => Navigator.of(context).pop(), - child: Container( - color: Colors.transparent, - child: GestureDetector( - onTap: () {}, - child: FilterWidget( - defaultSelections: selectedTypeSubject.value, - filterOptions: { - 'personType': [ - { - 'title': FFLocalizations.of(context).getText('zok7lu4w'), - 'value': 'E', + final Map? selectedFilter = + await showModalBottomSheet>( + isScrollControlled: true, + backgroundColor: Colors.transparent, + context: context, + builder: (context) { + return GestureDetector( + onTap: () => Navigator.of(context).pop(), + child: Container( + color: Colors.transparent, + child: GestureDetector( + onTap: () {}, + child: FilterWidget( + defaultSelections: selectedTypeSubject.value, + filterOptions: { + 'personType': [ + { + 'title': FFLocalizations.of(context) + .getText('zok7lu4w'), + 'value': 'E', + }, + { + 'title': FFLocalizations.of(context) + .getText('oonqk812'), + 'value': 'O', + }, + ], }, - { - 'title': FFLocalizations.of(context).getText('oonqk812'), - 'value': 'O', - }, - ], - }, - filterTitles: {'personType': ''}, + filterTitles: {'personType': ''}, + ), + ), ), - ), - ), - ); - }); + ); + }); if (selectedFilter != null) { _updateAccessHistoryAction(selectedFilter); @@ -200,7 +206,8 @@ class _AccessHistoryState extends State { final List accessHistory = response.jsonBody['acessos'] ?? []; List filteredAccess = accessHistory.where((item) { - final personTypeMatches = _personType == '.*' || item["PES_TIPO"].toString() == _personType; + final personTypeMatches = + _personType == '.*' || item["PES_TIPO"].toString() == _personType; return personTypeMatches; }).toList(); @@ -233,7 +240,8 @@ class _AccessHistoryState extends State { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."), + FFLocalizations.of(context).getVariableText( + ptText: "Não há mais dados.", enText: "No more data."), style: TextStyle( color: Colors.white, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), @@ -257,7 +265,9 @@ class _AccessHistoryState extends State { children: [ Center( child: Text( - FFLocalizations.of(context).getVariableText(ptText: "Nenhum histórico encontrado!", enText: "No history found!"), + FFLocalizations.of(context).getVariableText( + ptText: "Nenhum histórico encontrado!", + enText: "No history found!"), )), ], ), @@ -297,7 +307,8 @@ class _AccessHistoryState extends State { return FutureBuilder( future: _accessFuture, builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting && _accessWrap.isEmpty) { + if (snapshot.connectionState == ConnectionState.waiting && + _accessWrap.isEmpty) { return Center( child: SizedBox( width: 50.0, @@ -310,7 +321,9 @@ class _AccessHistoryState extends State { ); } else if (snapshot.hasError) { return Center( - child: Text(FFLocalizations.of(context).getVariableText(ptText: "Falha ao efetuar operação!", enText: "Failed to perform operation!")), + child: Text(FFLocalizations.of(context).getVariableText( + ptText: "Falha ao efetuar operação!", + enText: "Failed to perform operation!")), ); } @@ -328,7 +341,8 @@ class _AccessHistoryState extends State { ); } - Widget _accessHistoryCardMoleculeWidget(BuildContext context, dynamic accessHistoryItem) { + Widget _accessHistoryCardMoleculeWidget( + BuildContext context, dynamic accessHistoryItem) { return CardItemTemplateComponentWidget( imagePath: 'https://freaccess.com.br/freaccess/getImage.php?cliID=${_model.cliUUID}&atividade=getFoto&Documento=${accessHistoryItem['PES_ID'] ?? ''}&tipo=${accessHistoryItem['PES_TIPO'] ?? ''}', diff --git a/lib/features/history/presentation/pages/provisional_history_page.dart b/lib/features/history/presentation/pages/provisional_history_page.dart index bca19aec..b894f13a 100644 --- a/lib/features/history/presentation/pages/provisional_history_page.dart +++ b/lib/features/history/presentation/pages/provisional_history_page.dart @@ -20,7 +20,8 @@ import 'package:rxdart/rxdart.dart'; // ignore: must_be_immutable class ProvisionalHistoryPage extends StatefulWidget { Map opt; - ProvisionalHistoryPage({super.key, Map? opt}) : opt = opt ?? const {'AGP_STATUS': '.*'}; + ProvisionalHistoryPage({super.key, Map? opt}) + : opt = opt ?? const {'AGP_STATUS': '.*'}; @override State createState() => ProvisionalHistoryState(opt); } @@ -40,7 +41,8 @@ class ProvisionalHistoryState extends State { late Future future; List wrap = []; - ProvisionalHistoryState(Map opt) : selectedTypeSubject = BehaviorSubject.seeded(opt) { + ProvisionalHistoryState(Map opt) + : selectedTypeSubject = BehaviorSubject.seeded(opt) { selectedTypeSubject.listen((value) {}); } @@ -50,7 +52,8 @@ class ProvisionalHistoryState extends State { future = fetchHistoryService(); _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMore(); } }); @@ -112,7 +115,8 @@ class ProvisionalHistoryState extends State { color: theme.primaryText, fontSize: 16.0, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), + useGoogleFonts: + GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), ), ); } @@ -126,57 +130,62 @@ class ProvisionalHistoryState extends State { child: IconButton( icon: const Icon(Icons.filter_list), onPressed: () async { - final Map? selectedFilter = await showModalBottomSheet>( - isScrollControlled: true, - backgroundColor: Colors.transparent, - context: context, - builder: (context) { - return GestureDetector( - onTap: () => Navigator.of(context).pop(), - child: Container( - color: Colors.transparent, - child: GestureDetector( - onTap: () {}, - child: FilterWidget( - defaultSelections: selectedTypeSubject.value, - filterOptions: { - 'AGP_STATUS': [ - { - 'title': FFLocalizations.of(context).getVariableText( - ptText: 'Ativo', - enText: 'Active', - ), - 'value': 'AT', + final Map? selectedFilter = + await showModalBottomSheet>( + isScrollControlled: true, + backgroundColor: Colors.transparent, + context: context, + builder: (context) { + return GestureDetector( + onTap: () => Navigator.of(context).pop(), + child: Container( + color: Colors.transparent, + child: GestureDetector( + onTap: () {}, + child: FilterWidget( + defaultSelections: selectedTypeSubject.value, + filterOptions: { + 'AGP_STATUS': [ + { + 'title': FFLocalizations.of(context) + .getVariableText( + ptText: 'Ativo', + enText: 'Active', + ), + 'value': 'AT', + }, + { + 'title': FFLocalizations.of(context) + .getVariableText( + ptText: 'Convidado', + enText: 'Guest', + ), + 'value': 'CO', + }, + { + 'title': FFLocalizations.of(context) + .getVariableText( + ptText: 'Inativo', + enText: 'Inactive', + ), + 'value': 'IN', + }, + { + 'title': FFLocalizations.of(context) + .getVariableText( + ptText: 'Aguardando Aprovação', + enText: 'Awaiting Approval', + ), + 'value': 'AA', + }, + ], }, - { - 'title': FFLocalizations.of(context).getVariableText( - ptText: 'Convidado', - enText: 'Guest', - ), - 'value': 'CO', - }, - { - 'title': FFLocalizations.of(context).getVariableText( - ptText: 'Inativo', - enText: 'Inactive', - ), - 'value': 'IN', - }, - { - 'title': FFLocalizations.of(context).getVariableText( - ptText: 'Aguardando Aprovação', - enText: 'Awaiting Approval', - ), - 'value': 'AA', - }, - ], - }, - filterTitles: {'AGP_STATUS': ''}, + filterTitles: {'AGP_STATUS': ''}, + ), + ), ), - ), - ), - ); - }); + ); + }); if (selectedFilter != null) { _updateHistoryAction(selectedFilter); @@ -210,9 +219,11 @@ class ProvisionalHistoryState extends State { Future fetchHistoryService() async { try { setState(() => _loading = true); - var response = await PhpGroup.getProvSchedules(_pageNumber.toString(), status); + var response = + await PhpGroup.getProvSchedules(_pageNumber.toString(), status); - final List history = response.jsonBody['agendamento']['value'] ?? []; + final List history = + response.jsonBody['agendamento']['value'] ?? []; if (history.isNotEmpty) { setState(() { @@ -251,7 +262,9 @@ class ProvisionalHistoryState extends State { children: [ Center( child: Text( - FFLocalizations.of(context).getVariableText(ptText: "Nenhum histórico encontrado!", enText: "No history found!"), + FFLocalizations.of(context).getVariableText( + ptText: "Nenhum histórico encontrado!", + enText: "No history found!"), )), ], ), @@ -291,7 +304,8 @@ class ProvisionalHistoryState extends State { return FutureBuilder( future: future, builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting && wrap.isEmpty) { + if (snapshot.connectionState == ConnectionState.waiting && + wrap.isEmpty) { return Center( child: SizedBox( width: 50.0, @@ -304,7 +318,9 @@ class ProvisionalHistoryState extends State { ); } else if (snapshot.hasError) { return Center( - child: Text(FFLocalizations.of(context).getVariableText(ptText: "Falha ao efetuar operação!", enText: "Failed to perform operation!")), + child: Text(FFLocalizations.of(context).getVariableText( + ptText: "Falha ao efetuar operação!", + enText: "Failed to perform operation!")), ); } @@ -338,7 +354,8 @@ class ProvisionalHistoryState extends State { ); } - Map _buildLabelsHashMap(BuildContext context, dynamic historyItem) { + Map _buildLabelsHashMap( + BuildContext context, dynamic historyItem) { return { FFLocalizations.of(context).getVariableText( ptText: 'Nome:', @@ -370,7 +387,8 @@ class ProvisionalHistoryState extends State { return "${dateTime.day.toString().padLeft(2, '0')}/${dateTime.month.toString().padLeft(2, '0')}/${dateTime.year} ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}"; } - List> _buildStatusHashMap(BuildContext context, dynamic historyItem) { + List> _buildStatusHashMap( + BuildContext context, dynamic historyItem) { return [ { FFLocalizations.of(context).getVariableText( diff --git a/lib/features/history/presentation/widgets/access_filter_modal.dart b/lib/features/history/presentation/widgets/access_filter_modal.dart index 85a5ecbb..1346fe8b 100644 --- a/lib/features/history/presentation/widgets/access_filter_modal.dart +++ b/lib/features/history/presentation/widgets/access_filter_modal.dart @@ -20,7 +20,8 @@ class AccessFilterModel extends FlutterFlowModel { // State field(s) for CheckboxGroup widget. FormFieldController>? checkboxGroupValueController; List? get checkboxGroupValues => checkboxGroupValueController?.value; - set checkboxGroupValues(List? v) => checkboxGroupValueController?.value = v; + set checkboxGroupValues(List? v) => + checkboxGroupValueController?.value = v; @override void initState(BuildContext context) {} @@ -71,8 +72,12 @@ class _AccessFilterState extends State { _model.textFieldFocusNode ??= FocusNode(); selected = { - 'personType': widget.defaultPersonType == '.*' ? ['E', 'O'] : [widget.defaultPersonType], - 'accessType': widget.defaultAccessType == '.*' ? ['0', '1'] : [widget.defaultAccessType], + 'personType': widget.defaultPersonType == '.*' + ? ['E', 'O'] + : [widget.defaultPersonType], + 'accessType': widget.defaultAccessType == '.*' + ? ['0', '1'] + : [widget.defaultAccessType], 'search': '.*', }; } @@ -81,7 +86,9 @@ class _AccessFilterState extends State { Map filterResult = { 'personType': '', 'accessType': '', - 'search': _model.textController?.text == '' ? '.*' : _model.textController!.text.toLowerCase(), + 'search': _model.textController?.text == '' + ? '.*' + : _model.textController!.text.toLowerCase(), }; if (selected['personType']!.isEmpty) { @@ -104,7 +111,8 @@ class _AccessFilterState extends State { context.pop(filterResult); } - Widget _buildCheckboxListTile(String key, List> options, double fontsize) { + Widget _buildCheckboxListTile( + String key, List> options, double fontsize) { double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context); return Column( children: [ @@ -121,7 +129,8 @@ class _AccessFilterState extends State { fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, fontSize: limitedInputFontSize, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), color: FlutterFlowTheme.of(context).primaryText, ), ), @@ -141,7 +150,8 @@ class _AccessFilterState extends State { fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, letterSpacing: 0.0, fontSize: limitedInputFontSize, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), color: FlutterFlowTheme.of(context).primaryText, ), ), @@ -168,7 +178,8 @@ class _AccessFilterState extends State { width: 5, color: FlutterFlowTheme.of(context).secondaryText, ), - controlAffinity: ListTileControlAffinity.leading, // Adiciona esta linha + controlAffinity: + ListTileControlAffinity.leading, // Adiciona esta linha ); }, ), @@ -211,16 +222,24 @@ class _AccessFilterState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( - padding: const EdgeInsetsDirectional.fromSTEB(10.0, 10.0, 0.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 10.0, 10.0, 0.0, 10.0), child: Text( - FFLocalizations.of(context).getText('yfj9pd6k'), // Filtros - style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily, + FFLocalizations.of(context) + .getText('yfj9pd6k'), // Filtros + style: FlutterFlowTheme.of(context) + .headlineMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .headlineMediumFamily, color: FlutterFlowTheme.of(context).primaryText, - fontSize: LimitedFontSizeUtil.getHeaderFontSize(context), + fontSize: + LimitedFontSizeUtil.getHeaderFontSize(context), letterSpacing: 0.0, fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).headlineMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .headlineMediumFamily), ), ), ), @@ -233,7 +252,8 @@ class _AccessFilterState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - _buildCheckboxListTile('personType', personTypeOptions, 14), + _buildCheckboxListTile( + 'personType', personTypeOptions, 14), ], ), ), @@ -247,12 +267,15 @@ class _AccessFilterState extends State { ), child: Text(FFLocalizations.of(context).getText('88kshkph'), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).info, - fontSize: LimitedFontSizeUtil.getInputFontSize(context), + fontSize: + LimitedFontSizeUtil.getInputFontSize(context), letterSpacing: 0.0, fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), )), ), ], diff --git a/lib/features/history/presentation/widgets/provisional_filter_modal.dart b/lib/features/history/presentation/widgets/provisional_filter_modal.dart index c06612ab..44d0f538 100644 --- a/lib/features/history/presentation/widgets/provisional_filter_modal.dart +++ b/lib/features/history/presentation/widgets/provisional_filter_modal.dart @@ -17,7 +17,8 @@ class FilterModel extends FlutterFlowModel { bool? checkboxValue2; FormFieldController>? checkboxGroupValueController; List? get checkboxGroupValues => checkboxGroupValueController?.value; - set checkboxGroupValues(List? v) => checkboxGroupValueController?.value = v; + set checkboxGroupValues(List? v) => + checkboxGroupValueController?.value = v; @override void initState(BuildContext context) {} @@ -69,11 +70,15 @@ class _FilterWidgetState extends State { void _applyFilter() { Map filterResult = { - 'search': _model.textController?.text == '' ? '.*' : _model.textController!.text.toLowerCase(), + 'search': _model.textController?.text == '' + ? '.*' + : _model.textController!.text.toLowerCase(), }; widget.filterOptions.forEach((key, options) { - filterResult[key] = selected[key]!.isEmpty || selected[key]!.length < 1 ? '.*' : selected[key]!; + filterResult[key] = selected[key]!.isEmpty || selected[key]!.length < 1 + ? '.*' + : selected[key]!; }); setState(() { // Update the state with the new filter result @@ -82,7 +87,8 @@ class _FilterWidgetState extends State { context.pop(filterResult); } - Widget _buildCheckboxListTile(String key, List> options, double fontsize) { + Widget _buildCheckboxListTile( + String key, List> options, double fontsize) { double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context); return Column( children: [ @@ -99,7 +105,8 @@ class _FilterWidgetState extends State { fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, fontSize: limitedInputFontSize, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), color: FlutterFlowTheme.of(context).primaryText, ), ), @@ -119,7 +126,8 @@ class _FilterWidgetState extends State { fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, letterSpacing: 0.0, fontSize: limitedInputFontSize, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), color: FlutterFlowTheme.of(context).primaryText, ), ), @@ -175,19 +183,26 @@ class _FilterWidgetState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( - padding: const EdgeInsetsDirectional.fromSTEB(10.0, 10.0, 0.0, 10.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 10.0, 10.0, 0.0, 10.0), child: Text( FFLocalizations.of(context).getVariableText( ptText: 'Filtros', enText: 'Filters', ), - style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily, + style: FlutterFlowTheme.of(context) + .headlineMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .headlineMediumFamily, color: FlutterFlowTheme.of(context).primaryText, - fontSize: LimitedFontSizeUtil.getHeaderFontSize(context), + fontSize: + LimitedFontSizeUtil.getHeaderFontSize(context), letterSpacing: 0.0, fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).headlineMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .headlineMediumFamily), ), ), ), @@ -200,7 +215,8 @@ class _FilterWidgetState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: widget.filterOptions.keys.map((key) { - return _buildCheckboxListTile(key, widget.filterOptions[key]!, 14); + return _buildCheckboxListTile( + key, widget.filterOptions[key]!, 14); }).toList(), ), ), @@ -218,12 +234,15 @@ class _FilterWidgetState extends State { enText: 'Apply', ), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, color: FlutterFlowTheme.of(context).info, - fontSize: LimitedFontSizeUtil.getInputFontSize(context), + fontSize: + LimitedFontSizeUtil.getInputFontSize(context), letterSpacing: 0.0, fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), )), ), ], diff --git a/lib/features/home/data/data_sources/index.dart b/lib/features/home/data/data_sources/index.dart index e69de29b..8b137891 100644 --- a/lib/features/home/data/data_sources/index.dart +++ b/lib/features/home/data/data_sources/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/home/data/models/index.dart b/lib/features/home/data/models/index.dart index e69de29b..8b137891 100644 --- a/lib/features/home/data/models/index.dart +++ b/lib/features/home/data/models/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/home/data/repositories/index.dart b/lib/features/home/data/repositories/index.dart index e69de29b..8b137891 100644 --- a/lib/features/home/data/repositories/index.dart +++ b/lib/features/home/data/repositories/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/home/domain/entities/index.dart b/lib/features/home/domain/entities/index.dart index e69de29b..8b137891 100644 --- a/lib/features/home/domain/entities/index.dart +++ b/lib/features/home/domain/entities/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/home/domain/respositories/index.dart b/lib/features/home/domain/respositories/index.dart index e69de29b..8b137891 100644 --- a/lib/features/home/domain/respositories/index.dart +++ b/lib/features/home/domain/respositories/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/home/domain/usecases/index.dart b/lib/features/home/domain/usecases/index.dart index e69de29b..8b137891 100644 --- a/lib/features/home/domain/usecases/index.dart +++ b/lib/features/home/domain/usecases/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/home/presentation/blocs/home_bloc.dart b/lib/features/home/presentation/blocs/home_bloc.dart index 5829df5f..bfa06a48 100644 --- a/lib/features/home/presentation/blocs/home_bloc.dart +++ b/lib/features/home/presentation/blocs/home_bloc.dart @@ -1,4 +1,3 @@ - import 'dart:async'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -10,20 +9,25 @@ import 'index.dart'; class HomeBloc extends Bloc { late StreamSubscription _completer; - + HomeBloc() : super(HomeState()) { on(_onHomeEvent); _completer = LocalsRepositoryImpl.license.stream.listen((v) { add(HomeEvent()); }); - } + } - Future _onHomeEvent(HomeEvent event, Emitter emit) async { - final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - final userName = (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? ''; - final userEmail = (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; + Future _onHomeEvent(HomeEvent event, Emitter emit) async { + final devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final userName = + (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? ''; + final userEmail = + (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; emit(state.copyWith( devUUID: devUUID, @@ -34,5 +38,3 @@ class HomeBloc extends Bloc { )); } } - - diff --git a/lib/features/home/presentation/pages/about_system.dart b/lib/features/home/presentation/pages/about_system.dart index a9d0ddb6..26fb1b72 100644 --- a/lib/features/home/presentation/pages/about_system.dart +++ b/lib/features/home/presentation/pages/about_system.dart @@ -54,7 +54,8 @@ class _AboutSystemPageState extends State { ); } - PreferredSizeWidget _buildAppBar(BuildContext context, FlutterFlowTheme theme) { + PreferredSizeWidget _buildAppBar( + BuildContext context, FlutterFlowTheme theme) { return AppBar( backgroundColor: theme.primaryBackground, automaticallyImplyLeading: false, @@ -91,7 +92,8 @@ class _AboutSystemPageState extends State { color: theme.primaryText, fontSize: 16.0, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), + useGoogleFonts: + GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), ), ); } @@ -148,7 +150,8 @@ class _AboutSystemPageState extends State { color: theme.primaryText, fontSize: 16.0, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), + useGoogleFonts: + GoogleFonts.asMap().containsKey(theme.headlineMediumFamily), ), ); } diff --git a/lib/features/home/presentation/pages/home_page.dart b/lib/features/home/presentation/pages/home_page.dart index 64442d3d..2dad8027 100644 --- a/lib/features/home/presentation/pages/home_page.dart +++ b/lib/features/home/presentation/pages/home_page.dart @@ -17,7 +17,8 @@ class HomePageWidget extends StatefulWidget { State createState() => _HomePageWidgetState(); } -class _HomePageWidgetState extends State with WidgetsBindingObserver { +class _HomePageWidgetState extends State + with WidgetsBindingObserver { final scaffoldKey = GlobalKey(); @override @@ -97,7 +98,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/home/presentation/widgets/drawer_widget.dart b/lib/features/home/presentation/widgets/drawer_widget.dart index f221d183..7e709275 100644 --- a/lib/features/home/presentation/widgets/drawer_widget.dart +++ b/lib/features/home/presentation/widgets/drawer_widget.dart @@ -28,7 +28,8 @@ class DrawerWidget extends StatelessWidget { } else if (!snapshot.hasData || snapshot.data! == false) { return Center( child: Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).size.height / 10), + padding: + EdgeInsets.only(top: MediaQuery.of(context).size.height / 10), child: CircularProgressIndicator( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primary, @@ -93,9 +94,11 @@ class DrawerWidget extends StatelessWidget { height: 80.0, fit: BoxFit.cover, alignment: Alignment.center, - placeholder: (context, url) => Image.asset('assets/images/person.jpg'), + placeholder: (context, url) => + Image.asset('assets/images/person.jpg'), errorListener: (_) => Image.asset('assets/images/person.jpg'), - errorWidget: (_, __, ___) => Image.asset('assets/images/person.jpg'), + errorWidget: (_, __, ___) => + Image.asset('assets/images/person.jpg'), ), ), ), @@ -142,7 +145,8 @@ class DrawerWidget extends StatelessWidget { return Padding( padding: const EdgeInsets.symmetric(vertical: 10.0), child: TextFormField( - controller: TextEditingController(), // Replace with appropriate controller + controller: + TextEditingController(), // Replace with appropriate controller focusNode: FocusNode(), // Replace with appropriate focus node autofocus: false, obscureText: false, diff --git a/lib/features/home/presentation/widgets/index.dart b/lib/features/home/presentation/widgets/index.dart index e69de29b..8b137891 100644 --- a/lib/features/home/presentation/widgets/index.dart +++ b/lib/features/home/presentation/widgets/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/property/data/data_sources/index.dart b/lib/features/property/data/data_sources/index.dart index e69de29b..8b137891 100644 --- a/lib/features/property/data/data_sources/index.dart +++ b/lib/features/property/data/data_sources/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/property/data/models/index.dart b/lib/features/property/data/models/index.dart index e69de29b..8b137891 100644 --- a/lib/features/property/data/models/index.dart +++ b/lib/features/property/data/models/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/property/data/repositories/index.dart b/lib/features/property/data/repositories/index.dart index e69de29b..8b137891 100644 --- a/lib/features/property/data/repositories/index.dart +++ b/lib/features/property/data/repositories/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/property/domain/entities/index.dart b/lib/features/property/domain/entities/index.dart index e69de29b..8b137891 100644 --- a/lib/features/property/domain/entities/index.dart +++ b/lib/features/property/domain/entities/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/property/domain/respositories/index.dart b/lib/features/property/domain/respositories/index.dart index e69de29b..8b137891 100644 --- a/lib/features/property/domain/respositories/index.dart +++ b/lib/features/property/domain/respositories/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/property/domain/usecases/index.dart b/lib/features/property/domain/usecases/index.dart index e69de29b..8b137891 100644 --- a/lib/features/property/domain/usecases/index.dart +++ b/lib/features/property/domain/usecases/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/property/presentation/blocs/index.dart b/lib/features/property/presentation/blocs/index.dart index e69de29b..8b137891 100644 --- a/lib/features/property/presentation/blocs/index.dart +++ b/lib/features/property/presentation/blocs/index.dart @@ -0,0 +1 @@ + diff --git a/lib/features/property/presentation/pages/about_property_screen.dart b/lib/features/property/presentation/pages/about_property_screen.dart index 7560cc25..8b63a474 100644 --- a/lib/features/property/presentation/pages/about_property_screen.dart +++ b/lib/features/property/presentation/pages/about_property_screen.dart @@ -40,7 +40,8 @@ class AboutPropertyPage extends StatefulWidget { State createState() => _AboutPropertyPageState(); } -class _AboutPropertyPageState extends State with SingleTickerProviderStateMixin { +class _AboutPropertyPageState extends State + with SingleTickerProviderStateMixin { late AboutPropertyModel _model; @override @@ -62,11 +63,15 @@ class _AboutPropertyPageState extends State with SingleTicker @override Widget build(BuildContext context) { - return Scaffold(appBar: _buildAppBar(context), backgroundColor: FlutterFlowTheme.of(context).primaryBackground, body: _buildBody(context)); + return Scaffold( + appBar: _buildAppBar(context), + backgroundColor: FlutterFlowTheme.of(context).primaryBackground, + body: _buildBody(context)); } PreferredSizeWidget _buildAppBar(BuildContext context) { - final String title = FFLocalizations.of(context).getVariableText(ptText: "Sobre a Propriedade", enText: "About the Property"); + final String title = FFLocalizations.of(context).getVariableText( + ptText: "Sobre a Propriedade", enText: "About the Property"); return AppBarUtil( title: title, onBackButtonPressed: () => context.pop(), diff --git a/lib/features/property/presentation/widgets/index.dart b/lib/features/property/presentation/widgets/index.dart index e69de29b..8b137891 100644 --- a/lib/features/property/presentation/widgets/index.dart +++ b/lib/features/property/presentation/widgets/index.dart @@ -0,0 +1 @@ + diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index df4c0669..ac64bcb6 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -1,7 +1,8 @@ // File generated by FlutterFire CLI. // ignore_for_file: type=lint import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; -import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; /// Default [FirebaseOptions] for use with your Firebase apps. /// @@ -72,8 +73,10 @@ class DefaultFirebaseOptions { projectId: 'accessmoblie-da839', databaseURL: 'https://accessmoblie-da839.firebaseio.com', storageBucket: 'accessmoblie-da839.appspot.com', - androidClientId: '187064172787-7et0qu5p2qtmisvqgndn3kfi1b7u9ifl.apps.googleusercontent.com', - iosClientId: '187064172787-c5gs7fvp78om9r7dofkjn2qmpumkuvig.apps.googleusercontent.com', + androidClientId: + '187064172787-7et0qu5p2qtmisvqgndn3kfi1b7u9ifl.apps.googleusercontent.com', + iosClientId: + '187064172787-c5gs7fvp78om9r7dofkjn2qmpumkuvig.apps.googleusercontent.com', iosBundleId: 'br.com.freaccess.hub', ); } diff --git a/lib/flutter_flow/custom_functions.dart b/lib/flutter_flow/custom_functions.dart index 155966e4..231eef12 100644 --- a/lib/flutter_flow/custom_functions.dart +++ b/lib/flutter_flow/custom_functions.dart @@ -42,7 +42,10 @@ Future> stringToMap(String v) async { throw FormatException('Invalid key-value pair: $part of $v'); } final key = keyValue[0].trim(); - final value = keyValue.sublist(1).join(':').trim(); // Join the remaining parts to handle DateTime correctly + final value = keyValue + .sublist(1) + .join(':') + .trim(); // Join the remaining parts to handle DateTime correctly return MapEntry(key, value); }), )); diff --git a/lib/flutter_flow/custom_icons.dart b/lib/flutter_flow/custom_icons.dart index 92ede9d6..52991086 100644 --- a/lib/flutter_flow/custom_icons.dart +++ b/lib/flutter_flow/custom_icons.dart @@ -14,7 +14,8 @@ class FFIcons { static const IconData kvector1 = IconData(0xe902, fontFamily: _iconsFamily); // menu - static const IconData kiconFastPass = IconData(0xe900, fontFamily: _menuFamily); + static const IconData kiconFastPass = + IconData(0xe900, fontFamily: _menuFamily); static const IconData kvector2 = IconData(0xe905, fontFamily: _menuFamily); static const IconData kvector3 = IconData(0xe906, fontFamily: _menuFamily); } diff --git a/lib/flutter_flow/flutter_flow_animations.dart b/lib/flutter_flow/flutter_flow_animations.dart index 6f897e25..486179ca 100644 --- a/lib/flutter_flow/flutter_flow_animations.dart +++ b/lib/flutter_flow/flutter_flow_animations.dart @@ -51,8 +51,12 @@ extension AnimatedWidgetExtension on Widget { return Animate( effects: animationInfo.effects, child: this, - onPlay: (controller) => animationInfo.loop ? controller.repeat(reverse: animationInfo.reverse) : null, - onComplete: (controller) => !animationInfo.loop && animationInfo.reverse ? controller.reverse() : null, + onPlay: (controller) => animationInfo.loop + ? controller.repeat(reverse: animationInfo.reverse) + : null, + onComplete: (controller) => !animationInfo.loop && animationInfo.reverse + ? controller.reverse() + : null, ); } @@ -63,7 +67,11 @@ extension AnimatedWidgetExtension on Widget { }) { animationInfo.maybeUpdateEffects(effects); return hasBeenTriggered || animationInfo.applyInitialState - ? Animate(controller: animationInfo.controller, autoPlay: false, effects: animationInfo.effects, child: this) + ? Animate( + controller: animationInfo.controller, + autoPlay: false, + effects: animationInfo.effects, + child: this) : this; } } diff --git a/lib/flutter_flow/flutter_flow_button_tabbar.dart b/lib/flutter_flow/flutter_flow_button_tabbar.dart index d8860120..e4cd78cc 100644 --- a/lib/flutter_flow/flutter_flow_button_tabbar.dart +++ b/lib/flutter_flow/flutter_flow_button_tabbar.dart @@ -8,7 +8,8 @@ import 'package:flutter/rendering.dart'; const double _kTabHeight = 46.0; -typedef _LayoutCallback = void Function(List xOffsets, TextDirection textDirection, double width); +typedef _LayoutCallback = void Function( + List xOffsets, TextDirection textDirection, double width); class _TabLabelBarRenderer extends RenderFlex { _TabLabelBarRenderer({ @@ -33,7 +34,8 @@ class _TabLabelBarRenderer extends RenderFlex { RenderBox? child = firstChild; final List xOffsets = []; while (child != null) { - final FlexParentData childParentData = child.parentData! as FlexParentData; + final FlexParentData childParentData = + child.parentData! as FlexParentData; xOffsets.add(childParentData.offset.dx); assert(child.parentData == childParentData); child = childParentData.nextSibling; @@ -82,7 +84,8 @@ class _TabLabelBar extends Flex { } @override - void updateRenderObject(BuildContext context, _TabLabelBarRenderer renderObject) { + void updateRenderObject( + BuildContext context, _TabLabelBarRenderer renderObject) { super.updateRenderObject(context, renderObject); renderObject.onPerformLayout = onPerformLayout; } @@ -133,7 +136,8 @@ class _IndicatorPainter extends CustomPainter { assert(_currentTabOffsets!.isNotEmpty); assert(tabIndex >= 0); assert(tabIndex <= maxTabIndex); - return (_currentTabOffsets![tabIndex] + _currentTabOffsets![tabIndex + 1]) / 2.0; + return (_currentTabOffsets![tabIndex] + _currentTabOffsets![tabIndex + 1]) / + 2.0; } @override @@ -188,10 +192,12 @@ class _TabBarScrollPosition extends ScrollPositionWithSingleContext { // ballistic scroll activity. if (!_viewportDimensionWasNonZero || _needsPixelsCorrection) { _needsPixelsCorrection = false; - correctPixels(tabBar._initialScrollOffset(viewportDimension, minScrollExtent, maxScrollExtent)); + correctPixels(tabBar._initialScrollOffset( + viewportDimension, minScrollExtent, maxScrollExtent)); result = false; } - return super.applyContentDimensions(minScrollExtent, maxScrollExtent) && result; + return super.applyContentDimensions(minScrollExtent, maxScrollExtent) && + result; } void markNeedsPixelsCorrection() { @@ -207,7 +213,8 @@ class _TabBarScrollController extends ScrollController { final _FlutterFlowButtonTabBarState tabBar; @override - ScrollPosition createScrollPosition(ScrollPhysics physics, ScrollContext context, ScrollPosition? oldPosition) { + ScrollPosition createScrollPosition(ScrollPhysics physics, + ScrollContext context, ScrollPosition? oldPosition) { return _TabBarScrollPosition( physics: physics, context: context, @@ -218,7 +225,8 @@ class _TabBarScrollController extends ScrollController { } /// A Flutterflow Design widget that displays a horizontal row of tabs. -class FlutterFlowButtonTabBar extends StatefulWidget implements PreferredSizeWidget { +class FlutterFlowButtonTabBar extends StatefulWidget + implements PreferredSizeWidget { /// The [tabs] argument must not be null and its length must match the [controller]'s /// [TabController.length]. /// @@ -352,14 +360,17 @@ class FlutterFlowButtonTabBar extends StatefulWidget implements PreferredSizeWid maxHeight = math.max(itemHeight, maxHeight); } } - return Size.fromHeight(maxHeight + labelPadding.vertical + buttonMargin.vertical); + return Size.fromHeight( + maxHeight + labelPadding.vertical + buttonMargin.vertical); } @override - State createState() => _FlutterFlowButtonTabBarState(); + State createState() => + _FlutterFlowButtonTabBarState(); } -class _FlutterFlowButtonTabBarState extends State with TickerProviderStateMixin { +class _FlutterFlowButtonTabBarState extends State + with TickerProviderStateMixin { ScrollController? _scrollController; TabController? _controller; _IndicatorPainter? _indicatorPainter; @@ -383,7 +394,8 @@ class _FlutterFlowButtonTabBarState extends State with /// The animation duration is 2/3 of the tab scroll animation duration in /// Material design (kTabScrollDuration). - _animationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 200)); + _animationController = AnimationController( + vsync: this, duration: const Duration(milliseconds: 200)); // so the buttons start in their "final" state (color) _animationController @@ -401,7 +413,8 @@ class _FlutterFlowButtonTabBarState extends State with bool get _controllerIsValid => _controller?.animation != null; void _updateTabController() { - final TabController? newController = widget.controller ?? DefaultTabController.maybeOf(context); + final TabController? newController = + widget.controller ?? DefaultTabController.maybeOf(context); assert(() { if (newController == null) { throw FlutterError( @@ -486,7 +499,8 @@ class _FlutterFlowButtonTabBarState extends State with int get maxTabIndex => _indicatorPainter!.maxTabIndex; - double _tabScrollOffset(int index, double viewportWidth, double minExtent, double maxExtent) { + double _tabScrollOffset( + int index, double viewportWidth, double minExtent, double maxExtent) { if (!widget.isScrollable) { return 0.0; } @@ -502,27 +516,34 @@ class _FlutterFlowButtonTabBarState extends State with break; } - return clampDouble(tabCenter + paddingStart - viewportWidth / 2.0, minExtent, maxExtent); + return clampDouble( + tabCenter + paddingStart - viewportWidth / 2.0, minExtent, maxExtent); } double _tabCenteredScrollOffset(int index) { final ScrollPosition position = _scrollController!.position; - return _tabScrollOffset(index, position.viewportDimension, position.minScrollExtent, position.maxScrollExtent); + return _tabScrollOffset(index, position.viewportDimension, + position.minScrollExtent, position.maxScrollExtent); } - double _initialScrollOffset(double viewportWidth, double minExtent, double maxExtent) { + double _initialScrollOffset( + double viewportWidth, double minExtent, double maxExtent) { return _tabScrollOffset(_currentIndex, viewportWidth, minExtent, maxExtent); } void _scrollToCurrentIndex() { final double offset = _tabCenteredScrollOffset(_currentIndex); - _scrollController!.animateTo(offset, duration: kTabScrollDuration, curve: Curves.ease); + _scrollController! + .animateTo(offset, duration: kTabScrollDuration, curve: Curves.ease); } void _scrollToControllerValue() { - final double? leadingPosition = _currentIndex > 0 ? _tabCenteredScrollOffset(_currentIndex - 1) : null; + final double? leadingPosition = + _currentIndex > 0 ? _tabCenteredScrollOffset(_currentIndex - 1) : null; final double middlePosition = _tabCenteredScrollOffset(_currentIndex); - final double? trailingPosition = _currentIndex < maxTabIndex ? _tabCenteredScrollOffset(_currentIndex + 1) : null; + final double? trailingPosition = _currentIndex < maxTabIndex + ? _tabCenteredScrollOffset(_currentIndex + 1) + : null; final double index = _controller!.index.toDouble(); final double value = _controller!.animation!.value; @@ -534,9 +555,13 @@ class _FlutterFlowButtonTabBarState extends State with } else if (value == index) { offset = middlePosition; } else if (value < index) { - offset = leadingPosition == null ? middlePosition : lerpDouble(middlePosition, leadingPosition, index - value)!; + offset = leadingPosition == null + ? middlePosition + : lerpDouble(middlePosition, leadingPosition, index - value)!; } else { - offset = trailingPosition == null ? middlePosition : lerpDouble(middlePosition, trailingPosition, value - index)!; + offset = trailingPosition == null + ? middlePosition + : lerpDouble(middlePosition, trailingPosition, value - index)!; } _scrollController!.jumpTo(offset); @@ -574,7 +599,8 @@ class _FlutterFlowButtonTabBarState extends State with } // Called each time layout completes. - void _saveTabOffsets(List tabOffsets, TextDirection textDirection, double width) { + void _saveTabOffsets( + List tabOffsets, TextDirection textDirection, double width) { _tabStripWidth = width; _indicatorPainter?.saveTabOffsets(tabOffsets, textDirection); } @@ -598,34 +624,52 @@ class _FlutterFlowButtonTabBarState extends State with } final TextStyle? textStyle = TextStyle.lerp( - (widget.unselectedLabelStyle ?? tabBarTheme.labelStyle ?? DefaultTextStyle.of(context).style).copyWith( + (widget.unselectedLabelStyle ?? + tabBarTheme.labelStyle ?? + DefaultTextStyle.of(context).style) + .copyWith( color: widget.unselectedLabelColor, ), - (widget.labelStyle ?? tabBarTheme.labelStyle ?? DefaultTextStyle.of(context).style).copyWith( + (widget.labelStyle ?? + tabBarTheme.labelStyle ?? + DefaultTextStyle.of(context).style) + .copyWith( color: widget.labelColor, ), animationValue); - final Color? textColor = Color.lerp(widget.unselectedLabelColor, widget.labelColor, animationValue); + final Color? textColor = Color.lerp( + widget.unselectedLabelColor, widget.labelColor, animationValue); - final Color? borderColor = Color.lerp(widget.unselectedBorderColor, widget.borderColor, animationValue); + final Color? borderColor = Color.lerp( + widget.unselectedBorderColor, widget.borderColor, animationValue); BoxDecoration? boxDecoration = BoxDecoration.lerp( BoxDecoration( - color: widget.unselectedDecoration?.color ?? widget.unselectedBackgroundColor ?? Colors.transparent, + color: widget.unselectedDecoration?.color ?? + widget.unselectedBackgroundColor ?? + Colors.transparent, boxShadow: widget.unselectedDecoration?.boxShadow, gradient: widget.unselectedDecoration?.gradient, - borderRadius: widget.useToggleButtonStyle ? null : BorderRadius.circular(widget.borderRadius), + borderRadius: widget.useToggleButtonStyle + ? null + : BorderRadius.circular(widget.borderRadius), ), BoxDecoration( - color: widget.decoration?.color ?? widget.backgroundColor ?? Colors.transparent, + color: widget.decoration?.color ?? + widget.backgroundColor ?? + Colors.transparent, boxShadow: widget.decoration?.boxShadow, gradient: widget.decoration?.gradient, - borderRadius: widget.useToggleButtonStyle ? null : BorderRadius.circular(widget.borderRadius), + borderRadius: widget.useToggleButtonStyle + ? null + : BorderRadius.circular(widget.borderRadius), ), animationValue); - if (widget.useToggleButtonStyle && widget.borderWidth > 0 && boxDecoration != null) { + if (widget.useToggleButtonStyle && + widget.borderWidth > 0 && + boxDecoration != null) { if (index == 0) { boxDecoration = boxDecoration.copyWith( border: Border( @@ -659,11 +703,13 @@ class _FlutterFlowButtonTabBarState extends State with return Padding( key: _tabKeys[index], // padding for the buttons - padding: widget.useToggleButtonStyle ? EdgeInsets.zero : widget.buttonMargin, + padding: + widget.useToggleButtonStyle ? EdgeInsets.zero : widget.buttonMargin, child: TextButton( onPressed: () => _handleTap(index), style: ButtonStyle( - elevation: WidgetStateProperty.all(widget.useToggleButtonStyle ? 0 : widget.elevation), + elevation: WidgetStateProperty.all( + widget.useToggleButtonStyle ? 0 : widget.elevation), /// give a pretty small minimum size minimumSize: WidgetStateProperty.all(const Size(10, 10)), @@ -729,11 +775,14 @@ class _FlutterFlowButtonTabBarState extends State with if (_controller!.length == 0) { return Container( - height: _kTabHeight + widget.labelPadding.vertical + widget.buttonMargin.vertical, + height: _kTabHeight + + widget.labelPadding.vertical + + widget.buttonMargin.vertical, ); } - final List wrappedTabs = List.generate(widget.tabs.length, (int index) { + final List wrappedTabs = + List.generate(widget.tabs.length, (int index) { return _buildStyledTab(widget.tabs[index], index); }); diff --git a/lib/flutter_flow/flutter_flow_checkbox_group.dart b/lib/flutter_flow/flutter_flow_checkbox_group.dart index 8f367952..c8714df5 100644 --- a/lib/flutter_flow/flutter_flow_checkbox_group.dart +++ b/lib/flutter_flow/flutter_flow_checkbox_group.dart @@ -37,7 +37,8 @@ class FlutterFlowCheckboxGroup extends StatefulWidget { final TextStyle? unselectedTextStyle; @override - State createState() => _FlutterFlowCheckboxGroupState(); + State createState() => + _FlutterFlowCheckboxGroupState(); } class _FlutterFlowCheckboxGroupState extends State { @@ -85,7 +86,8 @@ class _FlutterFlowCheckboxGroupState extends State { itemBuilder: (context, index) { final option = widget.options[index]; final selected = selectedValues.contains(option); - final unselectedTextStyle = widget.unselectedTextStyle ?? widget.textStyle; + final unselectedTextStyle = + widget.unselectedTextStyle ?? widget.textStyle; return Theme( data: ThemeData(unselectedWidgetColor: widget.checkboxBorderColor), child: Padding( @@ -99,7 +101,9 @@ class _FlutterFlowCheckboxGroupState extends State { if (isSelected == null) { return; } - isSelected ? checkboxValues.add(option) : checkboxValues.remove(option); + isSelected + ? checkboxValues.add(option) + : checkboxValues.remove(option); widget.controller.value = List.from(checkboxValues); setState(() {}); } @@ -107,7 +111,8 @@ class _FlutterFlowCheckboxGroupState extends State { activeColor: widget.activeColor, checkColor: widget.checkColor, shape: RoundedRectangleBorder( - borderRadius: widget.checkboxBorderRadius ?? BorderRadius.zero, + borderRadius: + widget.checkboxBorderRadius ?? BorderRadius.zero, ), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, visualDensity: VisualDensity.compact, @@ -117,7 +122,8 @@ class _FlutterFlowCheckboxGroupState extends State { padding: widget.labelPadding ?? EdgeInsets.zero, child: Text( widget.options[index], - style: selected ? widget.textStyle : unselectedTextStyle, + style: + selected ? widget.textStyle : unselectedTextStyle, ), ), ), diff --git a/lib/flutter_flow/flutter_flow_drop_down.dart b/lib/flutter_flow/flutter_flow_drop_down.dart index 3988efa6..c82ebb61 100644 --- a/lib/flutter_flow/flutter_flow_drop_down.dart +++ b/lib/flutter_flow/flutter_flow_drop_down.dart @@ -86,10 +86,13 @@ class FlutterFlowDropDown extends StatefulWidget { class _FlutterFlowDropDownState extends State> { bool get isMultiSelect => widget.isMultiSelect; FormFieldController get controller => widget.controller!; - FormFieldController?> get multiSelectController => widget.multiSelectController!; + FormFieldController?> get multiSelectController => + widget.multiSelectController!; T? get currentValue { - final value = isMultiSelect ? multiSelectController.value?.firstOrNull : controller.value; + final value = isMultiSelect + ? multiSelectController.value?.firstOrNull + : controller.value; return widget.options.contains(value) ? value : null; } @@ -97,14 +100,17 @@ class _FlutterFlowDropDownState extends State> { if (!isMultiSelect || multiSelectController.value == null) { return {}; } - return widget.options.toSet().intersection(multiSelectController.value!.toSet()); + return widget.options + .toSet() + .intersection(multiSelectController.value!.toSet()); } Map get optionLabels => Map.fromEntries( widget.options.asMap().entries.map( (option) => MapEntry( option.value, - widget.optionLabels == null || widget.optionLabels!.length < option.key + 1 + widget.optionLabels == null || + widget.optionLabels!.length < option.key + 1 ? option.value.toString() : widget.optionLabels![option.key], ), @@ -123,7 +129,8 @@ class _FlutterFlowDropDownState extends State> { void initState() { super.initState(); if (isMultiSelect) { - _listener = () => widget.onMultiSelectChanged!(multiSelectController.value); + _listener = + () => widget.onMultiSelectChanged!(multiSelectController.value); multiSelectController.addListener(_listener); } else { _listener = () => widget.onChanged!(controller.value); @@ -158,16 +165,22 @@ class _FlutterFlowDropDownState extends State> { ), child: Padding( padding: _useDropdown2() ? EdgeInsets.zero : widget.margin, - child: widget.hidesUnderline ? DropdownButtonHideUnderline(child: dropdownWidget) : dropdownWidget, + child: widget.hidesUnderline + ? DropdownButtonHideUnderline(child: dropdownWidget) + : dropdownWidget, ), ), ); } bool _useDropdown2() => - widget.isMultiSelect || widget.isSearchable || !widget.isOverButton || widget.maxHeight != null; + widget.isMultiSelect || + widget.isSearchable || + !widget.isOverButton || + widget.maxHeight != null; - Widget _buildDropdownWidget() => _useDropdown2() ? _buildDropdown() : _buildLegacyDropdown(); + Widget _buildDropdownWidget() => + _useDropdown2() ? _buildDropdown() : _buildLegacyDropdown(); Widget _buildLegacyDropdown() { return DropdownButtonFormField( @@ -181,14 +194,20 @@ class _FlutterFlowDropDownState extends State> { dropdownColor: widget.fillColor, focusColor: Colors.transparent, decoration: InputDecoration( - labelText: widget.labelText == null || widget.labelText!.isEmpty ? null : widget.labelText, + labelText: widget.labelText == null || widget.labelText!.isEmpty + ? null + : widget.labelText, labelStyle: widget.labelTextStyle, - border: widget.hidesUnderline ? InputBorder.none : const UnderlineInputBorder(), + border: widget.hidesUnderline + ? InputBorder.none + : const UnderlineInputBorder(), ), ); } - Text? _createHintText() => widget.hintText != null ? Text(widget.hintText!, style: widget.textStyle) : null; + Text? _createHintText() => widget.hintText != null + ? Text(widget.hintText!, style: widget.textStyle) + : null; List> _createMenuItems() => widget.options .map( @@ -209,11 +228,14 @@ class _FlutterFlowDropDownState extends State> { enabled: false, child: StatefulBuilder( builder: (context, menuSetState) { - final isSelected = multiSelectController.value?.contains(item) ?? false; + final isSelected = + multiSelectController.value?.contains(item) ?? false; return InkWell( onTap: () { multiSelectController.value ??= []; - isSelected ? multiSelectController.value!.remove(item) : multiSelectController.value!.add(item); + isSelected + ? multiSelectController.value!.remove(item) + : multiSelectController.value!.add(item); multiSelectController.update(); // This rebuilds the StatefulWidget to update the button's text. setState(() {}); @@ -246,9 +268,11 @@ class _FlutterFlowDropDownState extends State> { .toList(); Widget _buildDropdown() { - final overlayColor = WidgetStateProperty.resolveWith( - (states) => states.contains(WidgetState.focused) ? Colors.transparent : null); - final iconStyleData = widget.icon != null ? IconStyleData(icon: widget.icon!) : const IconStyleData(); + final overlayColor = WidgetStateProperty.resolveWith((states) => + states.contains(WidgetState.focused) ? Colors.transparent : null); + final iconStyleData = widget.icon != null + ? IconStyleData(icon: widget.icon!) + : const IconStyleData(); return DropdownButton2( value: currentValue, hint: _createHintText(), @@ -274,14 +298,19 @@ class _FlutterFlowDropDownState extends State> { maxHeight: widget.maxHeight, padding: EdgeInsets.zero, ), - onChanged: widget.disabled ? null : (isMultiSelect ? (_) {} : (val) => widget.controller!.value = val), + onChanged: widget.disabled + ? null + : (isMultiSelect ? (_) {} : (val) => widget.controller!.value = val), isExpanded: true, selectedItemBuilder: (context) => widget.options .map((item) => Align( alignment: AlignmentDirectional.centerStart, child: Text( isMultiSelect - ? currentValues.where((v) => optionLabels.containsKey(v)).map((v) => optionLabels[v]).join(', ') + ? currentValues + .where((v) => optionLabels.containsKey(v)) + .map((v) => optionLabels[v]) + .join(', ') : optionLabels[item]!, style: widget.textStyle, maxLines: 1, @@ -321,7 +350,9 @@ class _FlutterFlowDropDownState extends State> { ), ), searchMatchFn: (item, searchValue) { - return (optionLabels[item.value] ?? '').toLowerCase().contains(searchValue.toLowerCase()); + return (optionLabels[item.value] ?? '') + .toLowerCase() + .contains(searchValue.toLowerCase()); }, ) : null, diff --git a/lib/flutter_flow/flutter_flow_icon_button.dart b/lib/flutter_flow/flutter_flow_icon_button.dart index 69e35057..6e77c8a0 100644 --- a/lib/flutter_flow/flutter_flow_icon_button.dart +++ b/lib/flutter_flow/flutter_flow_icon_button.dart @@ -90,10 +90,12 @@ class _FlutterFlowIconButtonState extends State { ), iconColor: WidgetStateProperty.resolveWith( (states) { - if (states.contains(WidgetState.disabled) && widget.disabledIconColor != null) { + if (states.contains(WidgetState.disabled) && + widget.disabledIconColor != null) { return widget.disabledIconColor; } - if (states.contains(WidgetState.hovered) && widget.hoverIconColor != null) { + if (states.contains(WidgetState.hovered) && + widget.hoverIconColor != null) { return widget.hoverIconColor; } return iconColor; @@ -101,10 +103,12 @@ class _FlutterFlowIconButtonState extends State { ), backgroundColor: WidgetStateProperty.resolveWith( (states) { - if (states.contains(WidgetState.disabled) && widget.disabledColor != null) { + if (states.contains(WidgetState.disabled) && + widget.disabledColor != null) { return widget.disabledColor; } - if (states.contains(WidgetState.hovered) && widget.hoverColor != null) { + if (states.contains(WidgetState.hovered) && + widget.hoverColor != null) { return widget.hoverColor; } diff --git a/lib/flutter_flow/flutter_flow_model.dart b/lib/flutter_flow/flutter_flow_model.dart index f5b7af2e..5a1225da 100644 --- a/lib/flutter_flow/flutter_flow_model.dart +++ b/lib/flutter_flow/flutter_flow_model.dart @@ -111,7 +111,8 @@ class FlutterFlowDynamicModels { } S? getValueAtIndex(int index, S? Function(T) getValue) { - final uniqueKey = _childrenIndexes.entries.firstWhereOrNull((e) => e.value == index)?.key; + final uniqueKey = + _childrenIndexes.entries.firstWhereOrNull((e) => e.value == index)?.key; return getValueForKey(uniqueKey, getValue); } @@ -161,5 +162,6 @@ T? _getDefaultValue() { } extension TextValidationExtensions on String? Function(BuildContext, String?)? { - String? Function(String?)? asValidator(BuildContext context) => this != null ? (val) => this!(context, val) : null; + String? Function(String?)? asValidator(BuildContext context) => + this != null ? (val) => this!(context, val) : null; } diff --git a/lib/flutter_flow/flutter_flow_theme.dart b/lib/flutter_flow/flutter_flow_theme.dart index d6607aea..d178b517 100644 --- a/lib/flutter_flow/flutter_flow_theme.dart +++ b/lib/flutter_flow/flutter_flow_theme.dart @@ -28,7 +28,8 @@ DeviceSize getDeviceSize(BuildContext context) { abstract class FlutterFlowTheme { static DeviceSize deviceSize = DeviceSize.mobile; - static Future initialize() async => _prefs = await SharedPreferences.getInstance(); + static Future initialize() async => + _prefs = await SharedPreferences.getInstance(); static ThemeMode get themeMode { final darkMode = _prefs?.getBool(kThemeModeKey); return darkMode == null @@ -38,11 +39,14 @@ abstract class FlutterFlowTheme { : ThemeMode.light; } - static void saveThemeMode(ThemeMode mode) => - mode == ThemeMode.system ? _prefs?.remove(kThemeModeKey) : _prefs?.setBool(kThemeModeKey, mode == ThemeMode.dark); + static void saveThemeMode(ThemeMode mode) => mode == ThemeMode.system + ? _prefs?.remove(kThemeModeKey) + : _prefs?.setBool(kThemeModeKey, mode == ThemeMode.dark); static FlutterFlowTheme of(BuildContext context) { // deviceSize = getDeviceSize(context); - return Theme.of(context).brightness == Brightness.dark ? DarkModeTheme() : LightModeTheme(); + return Theme.of(context).brightness == Brightness.dark + ? DarkModeTheme() + : LightModeTheme(); } @Deprecated('Use primary instead') diff --git a/lib/flutter_flow/flutter_flow_util.dart b/lib/flutter_flow/flutter_flow_util.dart index 5f27409a..a4773c37 100644 --- a/lib/flutter_flow/flutter_flow_util.dart +++ b/lib/flutter_flow/flutter_flow_util.dart @@ -68,7 +68,8 @@ Theme wrapInMaterialDatePickerTheme( required double iconSize, }) { final baseTheme = Theme.of(context); - final dateTimeMaterialStateForegroundColor = WidgetStateProperty.resolveWith((states) { + final dateTimeMaterialStateForegroundColor = + WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.disabled)) { return pickerForegroundColor.withOpacity(0.60); } @@ -81,7 +82,8 @@ Theme wrapInMaterialDatePickerTheme( return null; }); - final dateTimeMaterialStateBackgroundColor = WidgetStateProperty.resolveWith((states) { + final dateTimeMaterialStateBackgroundColor = + WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.selected)) { return selectedDateTimeBackgroundColor; } @@ -150,7 +152,8 @@ Theme wrapInMaterialDatePickerTheme( if (states.contains(WidgetState.hovered)) { return actionButtonForegroundColor.withOpacity(0.04); } - if (states.contains(WidgetState.focused) || states.contains(WidgetState.pressed)) { + if (states.contains(WidgetState.focused) || + states.contains(WidgetState.pressed)) { return actionButtonForegroundColor.withOpacity(0.12); } return null; @@ -255,7 +258,8 @@ Theme wrapInMaterialTimePickerTheme( if (states.contains(WidgetState.hovered)) { return actionButtonForegroundColor.withOpacity(0.04); } - if (states.contains(WidgetState.focused) || states.contains(WidgetState.pressed)) { + if (states.contains(WidgetState.focused) || + states.contains(WidgetState.pressed)) { return actionButtonForegroundColor.withOpacity(0.12); } return null; @@ -267,7 +271,9 @@ Theme wrapInMaterialTimePickerTheme( hourMinuteTextColor: pickerForegroundColor, dialHandColor: selectedDateTimeBackgroundColor, dialTextColor: WidgetStateColor.resolveWith((states) => - states.contains(WidgetState.selected) ? selectedDateTimeForegroundColor : pickerDialForegroundColor), + states.contains(WidgetState.selected) + ? selectedDateTimeForegroundColor + : pickerDialForegroundColor), dayPeriodBorderSide: BorderSide( color: pickerForegroundColor, ), @@ -276,9 +282,13 @@ Theme wrapInMaterialTimePickerTheme( fontSize: limitedFontSize, ), dayPeriodTextColor: WidgetStateColor.resolveWith((states) => - states.contains(WidgetState.selected) ? selectedDateTimeForegroundColor : pickerForegroundColor), - dayPeriodColor: WidgetStateColor.resolveWith( - (states) => states.contains(WidgetState.selected) ? selectedDateTimeBackgroundColor : Colors.transparent), + states.contains(WidgetState.selected) + ? selectedDateTimeForegroundColor + : pickerForegroundColor), + dayPeriodColor: WidgetStateColor.resolveWith((states) => + states.contains(WidgetState.selected) + ? selectedDateTimeBackgroundColor + : Colors.transparent), entryModeIconColor: pickerForegroundColor, ), ), @@ -361,7 +371,8 @@ String formatNumber( break; case FormatType.custom: final hasLocale = locale != null && locale.isNotEmpty; - formattedValue = NumberFormat(format, hasLocale ? locale : null).format(value); + formattedValue = + NumberFormat(format, hasLocale ? locale : null).format(value); } if (formattedValue.isEmpty) { @@ -369,7 +380,9 @@ String formatNumber( } if (currency != null) { - final currencySymbol = currency.isNotEmpty ? currency : NumberFormat.simpleCurrency().format(0.0).substring(0, 1); + final currencySymbol = currency.isNotEmpty + ? currency + : NumberFormat.simpleCurrency().format(0.0).substring(0, 1); formattedValue = '$currencySymbol$formattedValue'; } @@ -427,7 +440,9 @@ dynamic getJsonField( } final value = field.first.value; if (isForList) { - return value is! Iterable ? [value] : (value is List ? value : value.toList()); + return value is! Iterable + ? [value] + : (value is List ? value : value.toList()); } return value; } @@ -448,7 +463,8 @@ bool get isWeb => kIsWeb; const kBreakpointSmall = 479.0; const kBreakpointMedium = 767.0; const kBreakpointLarge = 991.0; -bool isMobileWidth(BuildContext context) => MediaQuery.sizeOf(context).width < kBreakpointSmall; +bool isMobileWidth(BuildContext context) => + MediaQuery.sizeOf(context).width < kBreakpointSmall; bool responsiveVisibility({ required BuildContext context, bool phone = true, @@ -481,21 +497,28 @@ extension FFTextEditingControllerExt on TextEditingController? { } extension IterableExt on Iterable { - List sortedList({S Function(T)? keyOf, bool desc = false}) { - final sortedAscending = toList()..sort(keyOf == null ? null : ((a, b) => keyOf(a).compareTo(keyOf(b)))); + List sortedList( + {S Function(T)? keyOf, bool desc = false}) { + final sortedAscending = toList() + ..sort(keyOf == null ? null : ((a, b) => keyOf(a).compareTo(keyOf(b)))); if (desc) { return sortedAscending.reversed.toList(); } return sortedAscending; } - List mapIndexed(S Function(int, T) func) => - toList().asMap().map((index, value) => MapEntry(index, func(index, value))).values.toList(); + List mapIndexed(S Function(int, T) func) => toList() + .asMap() + .map((index, value) => MapEntry(index, func(index, value))) + .values + .toList(); } -void setAppLanguage(BuildContext context, String language) => App.of(context).setLocale(language); +void setAppLanguage(BuildContext context, String language) => + App.of(context).setLocale(language); -void setDarkModeSetting(BuildContext context, ThemeMode themeMode) => App.of(context).setThemeMode(themeMode); +void setDarkModeSetting(BuildContext context, ThemeMode themeMode) => + App.of(context).setThemeMode(themeMode); void showSnackbar( BuildContext context, @@ -530,7 +553,9 @@ void showSnackbar( ], ), duration: Duration(seconds: duration), - backgroundColor: error ? FlutterFlowTheme.of(context).error : FlutterFlowTheme.of(context).success, + backgroundColor: error + ? FlutterFlowTheme.of(context).error + : FlutterFlowTheme.of(context).success, behavior: SnackBarBehavior.floating, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), @@ -539,7 +564,8 @@ void showSnackbar( ); } -void showAlertDialog(BuildContext context, String title, String content, Future Function() action) { +void showAlertDialog(BuildContext context, String title, String content, + Future Function() action) { double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context); double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context); @@ -550,12 +576,16 @@ void showAlertDialog(BuildContext context, String title, String content, Future< return AlertDialog( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, title: Text(title, - style: TextStyle(color: FlutterFlowTheme.of(context).primaryText, fontSize: limitedHeaderFontSize), + style: TextStyle( + color: FlutterFlowTheme.of(context).primaryText, + fontSize: limitedHeaderFontSize), textAlign: TextAlign.center), content: Padding( padding: const EdgeInsets.all(8.0), child: Text(content, - style: TextStyle(color: FlutterFlowTheme.of(context).primaryText, fontSize: limitedBodyFontSize)), + style: TextStyle( + color: FlutterFlowTheme.of(context).primaryText, + fontSize: limitedBodyFontSize)), ), actions: [ Row( @@ -568,8 +598,9 @@ void showAlertDialog(BuildContext context, String title, String content, Future< width: MediaQuery.of(context).size.width * 0.3, height: 50, color: FlutterFlowTheme.of(context).primaryBackground, - textStyle: - TextStyle(color: FlutterFlowTheme.of(context).primaryText, fontSize: limitedInputFontSize), + textStyle: TextStyle( + color: FlutterFlowTheme.of(context).primaryText, + fontSize: limitedInputFontSize), borderSide: BorderSide( color: FlutterFlowTheme.of(context).primaryBackground, width: 1, @@ -592,8 +623,9 @@ void showAlertDialog(BuildContext context, String title, String content, Future< height: 50, color: FlutterFlowTheme.of(context).primaryBackground, elevation: 0, - textStyle: - TextStyle(color: FlutterFlowTheme.of(context).primaryText, fontSize: limitedInputFontSize), + textStyle: TextStyle( + color: FlutterFlowTheme.of(context).primaryText, + fontSize: limitedInputFontSize), splashColor: const Color.fromARGB(255, 129, 129, 129), borderSide: BorderSide( color: FlutterFlowTheme.of(context).primaryBackground, @@ -615,7 +647,9 @@ void showAlertDialog(BuildContext context, String title, String content, Future< extension FFStringExt on String { String maybeHandleOverflow({int? maxChars, String replacement = ''}) => - maxChars != null && length > maxChars ? replaceRange(maxChars, null, replacement) : this; + maxChars != null && length > maxChars + ? replaceRange(maxChars, null, replacement) + : this; } extension ListFilterExt on Iterable { @@ -624,13 +658,16 @@ extension ListFilterExt on Iterable { extension MapFilterExtensions on Map { Map get withoutNulls => Map.fromEntries( - entries.where((e) => e.value != null).map((e) => MapEntry(e.key, e.value as T)), + entries + .where((e) => e.value != null) + .map((e) => MapEntry(e.key, e.value as T)), ); } extension MapListContainsExt on List { - bool containsMap(dynamic map) => - map is Map ? any((e) => e is Map && const DeepCollectionEquality().equals(e, map)) : contains(map); + bool containsMap(dynamic map) => map is Map + ? any((e) => e is Map && const DeepCollectionEquality().equals(e, map)) + : contains(map); } extension ListDivideExt on Iterable { @@ -638,17 +675,23 @@ extension ListDivideExt on Iterable { List divide(Widget t, {bool Function(int)? filterFn}) => isEmpty ? [] - : (enumerate.map((e) => [e.value, if (filterFn == null || filterFn(e.key)) t]).expand((i) => i).toList() + : (enumerate + .map((e) => [e.value, if (filterFn == null || filterFn(e.key)) t]) + .expand((i) => i) + .toList() ..removeLast()); List around(Widget t) => addToStart(t).addToEnd(t); - List addToStart(Widget t) => enumerate.map((e) => e.value).toList()..insert(0, t); + List addToStart(Widget t) => + enumerate.map((e) => e.value).toList()..insert(0, t); - List addToEnd(Widget t) => enumerate.map((e) => e.value).toList()..add(t); + List addToEnd(Widget t) => + enumerate.map((e) => e.value).toList()..add(t); List paddingTopEach(double val) => - map((w) => Padding(padding: EdgeInsets.only(top: val), child: w)).toList(); + map((w) => Padding(padding: EdgeInsets.only(top: val), child: w)) + .toList(); } extension StatefulWidgetExtensions on State { diff --git a/lib/flutter_flow/flutter_flow_widgets.dart b/lib/flutter_flow/flutter_flow_widgets.dart index 1071e2af..6845d783 100644 --- a/lib/flutter_flow/flutter_flow_widgets.dart +++ b/lib/flutter_flow/flutter_flow_widgets.dart @@ -74,13 +74,16 @@ class _FFButtonWidgetState extends State { bool loading = false; int get maxLines => widget.options.maxLines ?? 1; - String? get text => widget.options.textStyle?.fontSize == 0 ? null : widget.text; + String? get text => + widget.options.textStyle?.fontSize == 0 ? null : widget.text; @override Widget build(BuildContext context) { Widget textWidget = loading ? SizedBox( - width: widget.options.width == null ? _getTextWidth(text, widget.options.textStyle, maxLines) : null, + width: widget.options.width == null + ? _getTextWidth(text, widget.options.textStyle, maxLines) + : null, child: Center( child: SizedBox( width: 23, @@ -95,7 +98,8 @@ class _FFButtonWidgetState extends State { ) : Text( text ?? '', - style: text == null ? null : widget.options.textStyle?.withoutColor(), + style: + text == null ? null : widget.options.textStyle?.withoutColor(), textAlign: widget.options.textAlign, maxLines: maxLines, overflow: TextOverflow.ellipsis, @@ -122,24 +126,29 @@ class _FFButtonWidgetState extends State { ButtonStyle style = ButtonStyle( shape: WidgetStateProperty.resolveWith( (states) { - if (states.contains(WidgetState.hovered) && widget.options.hoverBorderSide != null) { + if (states.contains(WidgetState.hovered) && + widget.options.hoverBorderSide != null) { return RoundedRectangleBorder( - borderRadius: widget.options.borderRadius ?? BorderRadius.circular(8), + borderRadius: + widget.options.borderRadius ?? BorderRadius.circular(8), side: widget.options.hoverBorderSide!, ); } return RoundedRectangleBorder( - borderRadius: widget.options.borderRadius ?? BorderRadius.circular(8), + borderRadius: + widget.options.borderRadius ?? BorderRadius.circular(8), side: widget.options.borderSide ?? BorderSide.none, ); }, ), foregroundColor: WidgetStateProperty.resolveWith( (states) { - if (states.contains(WidgetState.disabled) && widget.options.disabledTextColor != null) { + if (states.contains(WidgetState.disabled) && + widget.options.disabledTextColor != null) { return widget.options.disabledTextColor; } - if (states.contains(WidgetState.hovered) && widget.options.hoverTextColor != null) { + if (states.contains(WidgetState.hovered) && + widget.options.hoverTextColor != null) { return widget.options.hoverTextColor; } return widget.options.textStyle?.color ?? Colors.white; @@ -147,10 +156,12 @@ class _FFButtonWidgetState extends State { ), backgroundColor: WidgetStateProperty.resolveWith( (states) { - if (states.contains(WidgetState.disabled) && widget.options.disabledColor != null) { + if (states.contains(WidgetState.disabled) && + widget.options.disabledColor != null) { return widget.options.disabledColor; } - if (states.contains(WidgetState.hovered) && widget.options.hoverColor != null) { + if (states.contains(WidgetState.hovered) && + widget.options.hoverColor != null) { return widget.options.hoverColor; } return widget.options.color; @@ -162,11 +173,12 @@ class _FFButtonWidgetState extends State { } return widget.options.hoverColor == null ? null : Colors.transparent; }), - padding: WidgetStateProperty.all( - widget.options.padding ?? const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0)), + padding: WidgetStateProperty.all(widget.options.padding ?? + const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0)), elevation: WidgetStateProperty.resolveWith( (states) { - if (states.contains(WidgetState.hovered) && widget.options.hoverElevation != null) { + if (states.contains(WidgetState.hovered) && + widget.options.hoverElevation != null) { return widget.options.hoverElevation!; } return widget.options.elevation ?? 2.0; @@ -190,7 +202,8 @@ class _FFButtonWidgetState extends State { border: Border.fromBorderSide( widget.options.borderSide ?? BorderSide.none, ), - borderRadius: widget.options.borderRadius ?? BorderRadius.circular(8), + borderRadius: + widget.options.borderRadius ?? BorderRadius.circular(8), ), child: IconButton( splashRadius: 1.0, @@ -263,12 +276,13 @@ extension _WithoutColorExtension on TextStyle { } // Slightly hacky method of getting the layout width of the provided text. -double? _getTextWidth(String? text, TextStyle? style, int maxLines) => text != null - ? (TextPainter( - text: TextSpan(text: text, style: style), - textDirection: TextDirection.ltr, - maxLines: maxLines, - )..layout()) - .size - .width - : null; +double? _getTextWidth(String? text, TextStyle? style, int maxLines) => + text != null + ? (TextPainter( + text: TextSpan(text: text, style: style), + textDirection: TextDirection.ltr, + maxLines: maxLines, + )..layout()) + .size + .width + : null; diff --git a/lib/flutter_flow/form_field_controller.dart b/lib/flutter_flow/form_field_controller.dart index b8d79ccb..b8020e3b 100644 --- a/lib/flutter_flow/form_field_controller.dart +++ b/lib/flutter_flow/form_field_controller.dart @@ -15,7 +15,8 @@ class FormFieldController extends ValueNotifier { class FormListFieldController extends FormFieldController> { final List? _initialListValue; - FormListFieldController(super.initialValue) : _initialListValue = List.from(initialValue ?? []); + FormListFieldController(super.initialValue) + : _initialListValue = List.from(initialValue ?? []); @override void reset() => value = List.from(_initialListValue ?? []); diff --git a/lib/flutter_flow/internationalization.dart b/lib/flutter_flow/internationalization.dart index a7fd9712..ffb64dcd 100644 --- a/lib/flutter_flow/internationalization.dart +++ b/lib/flutter_flow/internationalization.dart @@ -9,13 +9,16 @@ class FFLocalizations { final Locale locale; - static FFLocalizations of(BuildContext context) => Localizations.of(context, FFLocalizations)!; + static FFLocalizations of(BuildContext context) => + Localizations.of(context, FFLocalizations)!; static List languages() => ['pt', 'en']; static late SharedPreferences _prefs; - static Future initialize() async => _prefs = await SharedPreferences.getInstance(); - static Future storeLocale(String locale) => _prefs.setString(_kLocaleStorageKey, locale); + static Future initialize() async => + _prefs = await SharedPreferences.getInstance(); + static Future storeLocale(String locale) => + _prefs.setString(_kLocaleStorageKey, locale); static Locale? getStoredLocale() { final locale = _prefs.getString(_kLocaleStorageKey); return locale != null && locale.isNotEmpty ? createLocale(locale) : null; @@ -23,10 +26,15 @@ class FFLocalizations { String get languageCode => locale.toString(); String? get languageShortCode => - _languagesWithShortCode.contains(locale.toString()) ? '${locale.toString()}_short' : null; - int get languageIndex => languages().contains(languageCode) ? languages().indexOf(languageCode) : 0; + _languagesWithShortCode.contains(locale.toString()) + ? '${locale.toString()}_short' + : null; + int get languageIndex => languages().contains(languageCode) + ? languages().indexOf(languageCode) + : 0; - String getText(String key) => (kTranslationsMap[key] ?? {})[locale.toString()] ?? ''; + String getText(String key) => + (kTranslationsMap[key] ?? {})[locale.toString()] ?? ''; String getVariableText({ String? ptText = '', @@ -75,12 +83,15 @@ class FFLocalizationsDelegate extends LocalizationsDelegate { bool isSupported(Locale locale) { final language = locale.toString(); return FFLocalizations.languages().contains( - language.endsWith('_') ? language.substring(0, language.length - 1) : language, + language.endsWith('_') + ? language.substring(0, language.length - 1) + : language, ); } @override - Future load(Locale locale) => SynchronousFuture(FFLocalizations(locale)); + Future load(Locale locale) => + SynchronousFuture(FFLocalizations(locale)); @override bool shouldReload(FFLocalizationsDelegate old) => false; @@ -1051,8 +1062,10 @@ final kTranslationsMap = >>[ 'en': 'FORGOT YOUR PASSWORD?', }, 'wu2f7yzo': { - 'pt': 'Não se preucupe nós vamos te ajudar, digite o email cadastrado no aplicativo e clique em enviar.', - 'en': 'Don\'t worry, we will help you, enter the email registered in the application and click send.', + 'pt': + 'Não se preucupe nós vamos te ajudar, digite o email cadastrado no aplicativo e clique em enviar.', + 'en': + 'Don\'t worry, we will help you, enter the email registered in the application and click send.', }, 'mtz8l7ft': { 'pt': 'E-mail', @@ -1167,8 +1180,10 @@ final kTranslationsMap = >>[ 'en': 'ENTER YOUR PASSWORD', }, 'ujodm2ci': { - 'pt': 'Para gerar o QR Code digite a senha cadastrada no aplicativo e clique em enviar.', - 'en': 'To generate the QR Code, enter the password registered in the application and click send.', + 'pt': + 'Para gerar o QR Code digite a senha cadastrada no aplicativo e clique em enviar.', + 'en': + 'To generate the QR Code, enter the password registered in the application and click send.', }, 'rfqrdet7': { 'pt': 'Senha', diff --git a/lib/flutter_flow/keep_alive_wrapper.dart b/lib/flutter_flow/keep_alive_wrapper.dart index 464ba0ca..286bde09 100644 --- a/lib/flutter_flow/keep_alive_wrapper.dart +++ b/lib/flutter_flow/keep_alive_wrapper.dart @@ -12,7 +12,8 @@ class KeepAliveWidgetWrapper extends StatefulWidget { State createState() => _KeepAliveWidgetWrapperState(); } -class _KeepAliveWidgetWrapperState extends State with AutomaticKeepAliveClientMixin { +class _KeepAliveWidgetWrapperState extends State + with AutomaticKeepAliveClientMixin { @override bool get wantKeepAlive => true; diff --git a/lib/flutter_flow/lat_lng.dart b/lib/flutter_flow/lat_lng.dart index 88ef1eae..9e7b8ea8 100644 --- a/lib/flutter_flow/lat_lng.dart +++ b/lib/flutter_flow/lat_lng.dart @@ -12,5 +12,8 @@ class LatLng { int get hashCode => latitude.hashCode + longitude.hashCode; @override - bool operator ==(other) => other is LatLng && latitude == other.latitude && longitude == other.longitude; + bool operator ==(other) => + other is LatLng && + latitude == other.latitude && + longitude == other.longitude; } diff --git a/lib/flutter_flow/nav/nav.dart b/lib/flutter_flow/nav/nav.dart index ae2e56c4..6072e7ed 100644 --- a/lib/flutter_flow/nav/nav.dart +++ b/lib/flutter_flow/nav/nav.dart @@ -92,10 +92,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 haveUserUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value))?.isNotEmpty ?? false; - final bool haveDevUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value))?.isNotEmpty ?? false; + 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(KeychainStorageKey.userUUID.value)) + ?.isNotEmpty ?? + false; + final bool haveDevUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) + ?.isNotEmpty ?? + false; if (isLogged && haveDevUUID && haveUserUUID) { return haveLocal @@ -105,17 +115,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 { @@ -139,8 +152,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: UniqueKey(), @@ -157,7 +172,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( @@ -171,39 +187,115 @@ 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), ); }), - FFRoute(name: 'petsOnThePropertyPage', path: '/petsOnThePropertyPage', builder: (context, params) => Scaffold(body: const PetsHistoryScreen(isApp: true))), - FFRoute(name: 'vehiclesOnThePropertyPage', path: '/vehiclesOnThePropertyPage', builder: (context, params) => const VehicleOnTheProperty()), - FFRoute(name: 'receptionPage', path: '/receptionPage', builder: (context, params) => const ReceptionPageWidget()), - FFRoute(name: 'messageHistoryPage', path: '/messageHistoryPage', builder: (context, params) => const MessageHistoryPageWidget()), - FFRoute(name: 'registerVisitorPage', path: '/registerVisitorPage', builder: (context, params) => const RegisterVisitorPageWidget()), - FFRoute(name: 'scheduleCompleteVisitPage', path: '/scheduleCompleteVisitPage', builder: (context, params) => const ScheduleCompleteVisitPageWidget()), - FFRoute(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: 'preferencesSettings', path: '/preferencesSettings', builder: (context, params) => PreferencesPageWidget()), - FFRoute(name: 'aboutProperty', path: '/aboutProperty', builder: (context, params) => AboutPropertyPage()), - FFRoute(name: 'residentsOnThePropertyPage', path: '/residentsOnThePropertyPage', builder: (context, params) => ResidentsOnTheProperty()), - FFRoute(name: 'visitsOnThePropertyPage', path: '/visitsOnThePropertyPage', builder: (context, params) => VisitsOnTheProperty()), - FFRoute(name: 'peopleOnThePropertyPage', path: '/peopleOnThePropertyPage', builder: (context, params) => PeopleOnThePropertyPage()), + FFRoute( + name: 'petsOnThePropertyPage', + path: '/petsOnThePropertyPage', + builder: (context, params) => + Scaffold(body: const PetsHistoryScreen(isApp: true))), + FFRoute( + name: 'vehiclesOnThePropertyPage', + path: '/vehiclesOnThePropertyPage', + builder: (context, params) => const VehicleOnTheProperty()), + FFRoute( + name: 'receptionPage', + path: '/receptionPage', + builder: (context, params) => const ReceptionPageWidget()), + FFRoute( + name: 'messageHistoryPage', + path: '/messageHistoryPage', + builder: (context, params) => const MessageHistoryPageWidget()), + FFRoute( + name: 'registerVisitorPage', + path: '/registerVisitorPage', + builder: (context, params) => const RegisterVisitorPageWidget()), + FFRoute( + name: 'scheduleCompleteVisitPage', + path: '/scheduleCompleteVisitPage', + builder: (context, params) => + const ScheduleCompleteVisitPageWidget()), + FFRoute( + 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: 'preferencesSettings', + path: '/preferencesSettings', + builder: (context, params) => PreferencesPageWidget()), + FFRoute( + name: 'aboutProperty', + path: '/aboutProperty', + builder: (context, params) => AboutPropertyPage()), + FFRoute( + name: 'residentsOnThePropertyPage', + path: '/residentsOnThePropertyPage', + builder: (context, params) => ResidentsOnTheProperty()), + FFRoute( + name: 'visitsOnThePropertyPage', + path: '/visitsOnThePropertyPage', + builder: (context, params) => VisitsOnTheProperty()), + FFRoute( + name: 'peopleOnThePropertyPage', + path: '/peopleOnThePropertyPage', + builder: (context, params) => PeopleOnThePropertyPage()), FFRoute( name: 'acessHistoryPage', path: '/acessHistoryPage', - builder: (context, params) => AccessHistoryScreen(opt: const {'personType': '.*', 'accessType': '.*', 'search': '.*'})), - FFRoute(name: 'provisionalHistoryPage', path: '/provisionalHistoryPage', builder: (context, params) => ProvisionalHistoryPage()), - FFRoute(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 WelcomePageWidget()), - 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()), + builder: (context, params) => AccessHistoryScreen(opt: const { + 'personType': '.*', + 'accessType': '.*', + 'search': '.*' + })), + FFRoute( + name: 'provisionalHistoryPage', + path: '/provisionalHistoryPage', + builder: (context, params) => ProvisionalHistoryPage()), + FFRoute( + 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 WelcomePageWidget()), + 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', @@ -219,7 +311,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!)), ); } @@ -233,18 +327,23 @@ 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) ..addAll(extraMap); - TransitionInfo get transitionInfo => extraMap.containsKey(kTransitionInfoKey) ? extraMap[kTransitionInfoKey] as TransitionInfo : TransitionInfo.appDefault(); + TransitionInfo get transitionInfo => extraMap.containsKey(kTransitionInfoKey) + ? extraMap[kTransitionInfoKey] as TransitionInfo + : TransitionInfo.appDefault(); } 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(); } } @@ -256,13 +355,18 @@ class FFParameters { final Map Function(String)> asyncParams; 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; + 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; 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; @@ -272,12 +376,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); } } @@ -317,13 +424,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); }, @@ -344,7 +454,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 { @@ -356,8 +467,11 @@ 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}) => Provider.value(value: RootPageContext(true, errorRoute), child: child); + static Widget wrap(Widget child, {String? errorRoute}) => + Provider.value(value: RootPageContext(true, errorRoute), child: child); } diff --git a/lib/flutter_flow/nav/serialization_util.dart b/lib/flutter_flow/nav/serialization_util.dart index 18018306..5be44705 100644 --- a/lib/flutter_flow/nav/serialization_util.dart +++ b/lib/flutter_flow/nav/serialization_util.dart @@ -27,7 +27,8 @@ String placeToString(FFPlace place) => jsonEncode({ 'zipCode': place.zipCode, }); -String uploadedFileToString(FFUploadedFile uploadedFile) => uploadedFile.serialize(); +String uploadedFileToString(FFUploadedFile uploadedFile) => + uploadedFile.serialize(); String? serializeParam( dynamic param, @@ -136,7 +137,8 @@ FFPlace placeFromString(String placeStr) { ); } -FFUploadedFile uploadedFileFromString(String uploadedFileStr) => FFUploadedFile.deserialize(uploadedFileStr); +FFUploadedFile uploadedFileFromString(String uploadedFileStr) => + FFUploadedFile.deserialize(uploadedFileStr); enum ParamType { int, @@ -196,7 +198,9 @@ dynamic deserializeParam( return param == 'true'; case ParamType.DateTime: final milliseconds = int.tryParse(param); - return milliseconds != null ? DateTime.fromMillisecondsSinceEpoch(milliseconds) : null; + return milliseconds != null + ? DateTime.fromMillisecondsSinceEpoch(milliseconds) + : null; case ParamType.DateTimeRange: return dateTimeRangeFromString(param); case ParamType.LatLng: diff --git a/lib/flutter_flow/permissions_util.dart b/lib/flutter_flow/permissions_util.dart index 31c0ad28..08009e6e 100644 --- a/lib/flutter_flow/permissions_util.dart +++ b/lib/flutter_flow/permissions_util.dart @@ -13,4 +13,5 @@ Future getPermissionStatus(Permission setting) async { return kPermissionStateToBool[status]!; } -Future requestPermission(Permission setting) async => await setting.request(); +Future requestPermission(Permission setting) async => + await setting.request(); diff --git a/lib/flutter_flow/random_data_util.dart b/lib/flutter_flow/random_data_util.dart index c3e508f7..6599e5a6 100644 --- a/lib/flutter_flow/random_data_util.dart +++ b/lib/flutter_flow/random_data_util.dart @@ -29,14 +29,16 @@ String randomString( if (digits) { chars += '0123456789'; } - return List.generate(randomInteger(minLength, maxLength), (index) => chars[_random.nextInt(chars.length)]).join(); + return List.generate(randomInteger(minLength, maxLength), + (index) => chars[_random.nextInt(chars.length)]).join(); } // Random date between 1970 and 2025. DateTime randomDate() { // Random max must be in range 0 < max <= 2^32. // So we have to generate the time in seconds and then convert to milliseconds. - return DateTime.fromMillisecondsSinceEpoch(randomInteger(0, 1735689600) * 1000); + return DateTime.fromMillisecondsSinceEpoch( + randomInteger(0, 1735689600) * 1000); } String randomImageUrl(int width, int height) { @@ -44,5 +46,6 @@ String randomImageUrl(int width, int height) { } Color randomColor() { - return Color.fromARGB(255, _random.nextInt(255), _random.nextInt(255), _random.nextInt(255)); + return Color.fromARGB( + 255, _random.nextInt(255), _random.nextInt(255), _random.nextInt(255)); } diff --git a/lib/flutter_flow/request_manager.dart b/lib/flutter_flow/request_manager.dart index d130fb08..f26ed03b 100644 --- a/lib/flutter_flow/request_manager.dart +++ b/lib/flutter_flow/request_manager.dart @@ -24,7 +24,8 @@ class FutureRequestManager { } // Remove the first cached result if we have reached the specified limit, // since we will be adding another. - if (!_requests.containsKey(uniqueQueryKey) && _requests.length >= cacheLimit) { + if (!_requests.containsKey(uniqueQueryKey) && + _requests.length >= cacheLimit) { _requests.remove(_requests.keys.first); } // Return the cached query result or set it to the new value. @@ -68,8 +69,9 @@ class StreamRequestManager { // Create a subscription that stores the latest result in the behavior subject. final streamSubject = BehaviorSubject(); - _requestSubscriptions[uniqueQueryKey] = - requestFn().asBroadcastStream().listen((result) => streamSubject.add(result)); + _requestSubscriptions[uniqueQueryKey] = requestFn() + .asBroadcastStream() + .listen((result) => streamSubject.add(result)); _streamSubjects[uniqueQueryKey] = streamSubject; return streamSubject.stream; @@ -87,4 +89,5 @@ class StreamRequestManager { }.forEach(clearRequest); } -String _requestKey(String? key) => key == null || key.isEmpty ? '__DEFAULT_KEY__' : key; +String _requestKey(String? key) => + key == null || key.isEmpty ? '__DEFAULT_KEY__' : key; diff --git a/lib/flutter_flow/upload_data.dart b/lib/flutter_flow/upload_data.dart index de53d20f..55bccc25 100644 --- a/lib/flutter_flow/upload_data.dart +++ b/lib/flutter_flow/upload_data.dart @@ -66,7 +66,9 @@ Future?> selectMediaWithSourceBottomSheetandFaceDetection({ enableLandmarks: true, ), ); - createUploadMediaListTile(String label, MediaSource mediaSource, IconData icon) => ListTile( + createUploadMediaListTile( + String label, MediaSource mediaSource, IconData icon) => + ListTile( title: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -109,12 +111,15 @@ Future?> selectMediaWithSourceBottomSheetandFaceDetection({ padding: const EdgeInsets.fromLTRB(0, 8, 0, 0), child: ListTile( title: Text( - FFLocalizations.of(context) - .getVariableText(ptText: "Escolha uma das opções", enText: "Choose one of the options"), + FFLocalizations.of(context).getVariableText( + ptText: "Escolha uma das opções", + enText: "Choose one of the options"), textAlign: TextAlign.center, style: GoogleFonts.getFont( pickerFontFamily, - color: FlutterFlowTheme.of(context).primaryText.withOpacity(0.65), + color: FlutterFlowTheme.of(context) + .primaryText + .withOpacity(0.65), fontWeight: FontWeight.w500, fontSize: 14, ), @@ -130,35 +135,40 @@ Future?> selectMediaWithSourceBottomSheetandFaceDetection({ if (allowPhoto && allowVideo) ...[ Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context) - .getVariableText(ptText: "Galeria (Foto)", enText: "Gallery (Photo)"), + FFLocalizations.of(context).getVariableText( + ptText: "Galeria (Foto)", + enText: "Gallery (Photo)"), MediaSource.photoGallery, Icons.camera), ), Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context) - .getVariableText(ptText: "Galeria (Video)", enText: "Gallery (Video)"), + FFLocalizations.of(context).getVariableText( + ptText: "Galeria (Video)", + enText: "Gallery (Video)"), MediaSource.videoGallery, Icons.videocam), ) ] else if (allowPhoto) Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context).getVariableText(ptText: "Galeria", enText: "Gallery"), + FFLocalizations.of(context).getVariableText( + ptText: "Galeria", enText: "Gallery"), MediaSource.photoGallery, Icons.photo)) else Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context).getVariableText(ptText: "Galeria", enText: "Gallery"), + FFLocalizations.of(context).getVariableText( + ptText: "Galeria", enText: "Gallery"), MediaSource.videoGallery, Icons.videocam), ), if (!kIsWeb) ...[ Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context).getVariableText(ptText: "Camera", enText: "Camera"), + FFLocalizations.of(context).getVariableText( + ptText: "Camera", enText: "Camera"), MediaSource.camera, Icons.camera_alt), ) @@ -177,8 +187,8 @@ Future?> selectMediaWithSourceBottomSheetandFaceDetection({ maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: imageQuality, - isVideo: - mediaSource == MediaSource.videoGallery || (mediaSource == MediaSource.camera && allowVideo && !allowPhoto), + isVideo: mediaSource == MediaSource.videoGallery || + (mediaSource == MediaSource.camera && allowVideo && !allowPhoto), mediaSource: mediaSource, includeDimensions: includeDimensions, includeBlurHash: includeBlurHash, @@ -193,14 +203,16 @@ Future?> selectMediaWithSourceBottomSheetandFaceDetection({ final inputImage = InputImage.fromFilePath(media.filePath!); final faces = await faceDetector.processImage(inputImage); if (faces.isEmpty) { - final String message = FFLocalizations.of(context) - .getVariableText(ptText: "Nenhuma face detectada na imagem", enText: "No face detected in the image"); + final String message = FFLocalizations.of(context).getVariableText( + ptText: "Nenhuma face detectada na imagem", + enText: "No face detected in the image"); await DialogUtil.error(context, message); return null; } if (faces.length > 1) { final String message = FFLocalizations.of(context).getVariableText( - ptText: "Mais de uma face detectada na imagem", enText: "More than one face detected in the image"); + ptText: "Mais de uma face detectada na imagem", + enText: "More than one face detected in the image"); await DialogUtil.error(context, message); return null; } @@ -223,7 +235,9 @@ Future?> selectMediaWithSourceBottomSheet({ bool includeDimensions = false, bool includeBlurHash = false, }) async { - createUploadMediaListTile(String label, MediaSource mediaSource, IconData icon) => ListTile( + createUploadMediaListTile( + String label, MediaSource mediaSource, IconData icon) => + ListTile( title: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -267,12 +281,15 @@ Future?> selectMediaWithSourceBottomSheet({ padding: const EdgeInsets.fromLTRB(0, 8, 0, 0), child: ListTile( title: Text( - FFLocalizations.of(context) - .getVariableText(ptText: "Escolha uma das opções", enText: "Choose one of the options"), + FFLocalizations.of(context).getVariableText( + ptText: "Escolha uma das opções", + enText: "Choose one of the options"), textAlign: TextAlign.center, style: GoogleFonts.getFont( pickerFontFamily, - color: FlutterFlowTheme.of(context).primaryText.withOpacity(0.65), + color: FlutterFlowTheme.of(context) + .primaryText + .withOpacity(0.65), fontWeight: FontWeight.w500, fontSize: 14, ), @@ -288,35 +305,40 @@ Future?> selectMediaWithSourceBottomSheet({ if (allowPhoto && allowVideo) ...[ Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context) - .getVariableText(ptText: "Galeria (Foto)", enText: "Gallery (Photo)"), + FFLocalizations.of(context).getVariableText( + ptText: "Galeria (Foto)", + enText: "Gallery (Photo)"), MediaSource.photoGallery, Icons.camera), ), Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context) - .getVariableText(ptText: "Galeria (Video)", enText: "Gallery (Video)"), + FFLocalizations.of(context).getVariableText( + ptText: "Galeria (Video)", + enText: "Gallery (Video)"), MediaSource.videoGallery, Icons.videocam), ) ] else if (allowPhoto) Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context).getVariableText(ptText: "Galeria", enText: "Gallery"), + FFLocalizations.of(context).getVariableText( + ptText: "Galeria", enText: "Gallery"), MediaSource.photoGallery, Icons.photo)) else Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context).getVariableText(ptText: "Galeria", enText: "Gallery"), + FFLocalizations.of(context).getVariableText( + ptText: "Galeria", enText: "Gallery"), MediaSource.videoGallery, Icons.videocam), ), if (!kIsWeb) ...[ Expanded( child: createUploadMediaListTile( - FFLocalizations.of(context).getVariableText(ptText: "Camera", enText: "Camera"), + FFLocalizations.of(context).getVariableText( + ptText: "Camera", enText: "Camera"), MediaSource.camera, Icons.camera_alt), ) @@ -335,8 +357,8 @@ Future?> selectMediaWithSourceBottomSheet({ maxWidth: maxWidth, maxHeight: maxHeight, imageQuality: imageQuality, - isVideo: - mediaSource == MediaSource.videoGallery || (mediaSource == MediaSource.camera && allowVideo && !allowPhoto), + isVideo: mediaSource == MediaSource.videoGallery || + (mediaSource == MediaSource.camera && allowVideo && !allowPhoto), mediaSource: mediaSource, includeDimensions: includeDimensions, includeBlurHash: includeBlurHash, @@ -386,7 +408,9 @@ Future?> selectMedia({ })); } - final source = mediaSource == MediaSource.camera ? ImageSource.camera : ImageSource.gallery; + final source = mediaSource == MediaSource.camera + ? ImageSource.camera + : ImageSource.gallery; final pickedMediaFuture = isVideo ? picker.pickVideo(source: source) : picker.pickImage( @@ -457,7 +481,8 @@ Future?> selectFiles({ return Future.wait(pickedFiles.files.asMap().entries.map((e) async { final index = e.key; final file = e.value; - final storagePath = _getStoragePath(storageFolderPath, file.name, false, index); + final storagePath = + _getStoragePath(storageFolderPath, file.name, false, index); return SelectedFile( storagePath: storagePath, filePath: isWeb ? null : file.path, @@ -554,7 +579,8 @@ void showUploadMessage( padding: const EdgeInsetsDirectional.only(end: 10.0), child: CircularProgressIndicator( valueColor: Theme.of(context).brightness == Brightness.dark - ? AlwaysStoppedAnimation(FlutterFlowTheme.of(context).info) + ? AlwaysStoppedAnimation( + FlutterFlowTheme.of(context).info) : null, ), ), @@ -572,10 +598,12 @@ void showUploadMessage( topRight: Radius.circular(15), ), ), - duration: showLoading ? const Duration(days: 1) : const Duration(seconds: 4), + duration: + showLoading ? const Duration(days: 1) : const Duration(seconds: 4), ), ); } -String? _removeTrailingSlash(String? path) => - path != null && path.endsWith('/') ? path.substring(0, path.length - 1) : path; +String? _removeTrailingSlash(String? path) => path != null && path.endsWith('/') + ? path.substring(0, path.length - 1) + : path; diff --git a/lib/main.dart b/lib/main.dart index 00c6e724..454daa68 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -33,7 +33,10 @@ Future _foregroundHandlerMessage(RemoteMessage message) async { } if (!Platform.isIOS) { - NotificationService.show(title: message.notification!.title!, body: message.notification!.body!, payload: Map.from(message.data)); + NotificationService.show( + title: message.notification!.title!, + body: message.notification!.body!, + payload: Map.from(message.data)); } } @@ -50,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 { @@ -92,7 +96,8 @@ class _AppState extends State { }), ), ); - final Iterable>? localizationsDelegates = const [ + final Iterable>? localizationsDelegates = + const [ FFLocalizationsDelegate(), GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -134,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 { diff --git a/lib/pages/delivery_schedule_page/delivery_schedule_widget.dart b/lib/pages/delivery_schedule_page/delivery_schedule_widget.dart index 148a4220..43872127 100644 --- a/lib/pages/delivery_schedule_page/delivery_schedule_widget.dart +++ b/lib/pages/delivery_schedule_page/delivery_schedule_widget.dart @@ -50,7 +50,8 @@ class _DeliveryScheduleState extends State { }, ), title: Text( - FFLocalizations.of(context).getVariableText(enText: 'Delivery Schedule', ptText: 'Agendar Entregas'), + FFLocalizations.of(context).getVariableText( + enText: 'Delivery Schedule', ptText: 'Agendar Entregas'), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, @@ -64,6 +65,7 @@ class _DeliveryScheduleState extends State { centerTitle: true, elevation: 0.0, ), - body: const SafeArea(top: true, child: ScheduleProvisionalVisitPageWidget())); + body: const SafeArea( + top: true, child: ScheduleProvisionalVisitPageWidget())); } } diff --git a/lib/pages/fast_pass_page/fast_pass_page_widget.dart b/lib/pages/fast_pass_page/fast_pass_page_widget.dart index 31bb70eb..532f37ed 100644 --- a/lib/pages/fast_pass_page/fast_pass_page_widget.dart +++ b/lib/pages/fast_pass_page/fast_pass_page_widget.dart @@ -25,11 +25,16 @@ class _FastPassPageWidgetState extends State { late InAppWebViewController _controllerIOS; Future> initVariables() async { - final email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; - final name = (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? ''; - final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final email = + (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; + final name = + (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? ''; + final devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const createdAt = '0000-00-00 00:00:00'; final url = 'https://hub.freaccess.com.br/hub/fast-pass/$cliUUID'; final freUserData = @@ -55,10 +60,12 @@ class _FastPassPageWidgetState extends State { builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) { + } else if (snapshot.hasError || + !snapshot.hasData || + snapshot.data!.isEmpty) { return Center( - child: Text(FFLocalizations.of(context) - .getVariableText(enText: 'Unexpected error', ptText: 'Erro inesperado'))); + child: Text(FFLocalizations.of(context).getVariableText( + enText: 'Unexpected error', ptText: 'Erro inesperado'))); } else { final data = snapshot.data!; final url = data['url']!; @@ -84,9 +91,14 @@ class _FastPassPageWidgetState extends State { ), onWebViewCreated: (controller) async => _controllerIOS = controller, onLoadStop: (controller, url) async { - await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-token', '\"$userUUID\"')"); - await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-user-data', '$freUserData')"); - await controller.evaluateJavascript(source: "window.localStorage.setItem('enableBackButton', 'true')"); + await controller.evaluateJavascript( + source: + "window.localStorage.setItem('fre-token', '\"$userUUID\"')"); + await controller.evaluateJavascript( + source: + "window.localStorage.setItem('fre-user-data', '$freUserData')"); + await controller.evaluateJavascript( + source: "window.localStorage.setItem('enableBackButton', 'true')"); }, onUpdateVisitedHistory: (controller, uri, isVisited) { if (uri.toString().contains('/hub/home')) context.pop(); @@ -104,16 +116,21 @@ class _FastPassPageWidgetState extends State { ..setNavigationDelegate( NavigationDelegate( onPageStarted: (String url) { - final String token = "localStorage.setItem('fre-token', '\"$userUUID\"');"; - final String data = "localStorage.setItem('fre-user-data', '$freUserData');"; - const String backNavigation = "localStorage.setItem('enableBackButton', 'true');"; + final String token = + "localStorage.setItem('fre-token', '\"$userUUID\"');"; + final String data = + "localStorage.setItem('fre-user-data', '$freUserData');"; + const String backNavigation = + "localStorage.setItem('enableBackButton', 'true');"; _controllerAndroid.runJavaScript(token); _controllerAndroid.runJavaScript(data); _controllerAndroid.runJavaScript(backNavigation); }, onPageFinished: (String url) { - bool isDarkMode = SchedulerBinding.instance.platformDispatcher.platformBrightness == Brightness.dark; + bool isDarkMode = SchedulerBinding + .instance.platformDispatcher.platformBrightness == + Brightness.dark; if (isDarkMode) { _controllerAndroid.runJavaScript(WebviewUtil.jsEnableDarkMode); diff --git a/lib/pages/forgot_password_page/forgot_password_model.dart b/lib/pages/forgot_password_page/forgot_password_model.dart index 56580cac..dc6cab21 100644 --- a/lib/pages/forgot_password_page/forgot_password_model.dart +++ b/lib/pages/forgot_password_page/forgot_password_model.dart @@ -10,8 +10,10 @@ class ForgotPasswordScreenModel extends FlutterFlowModel { FocusNode? passwordRegisterFormFocusNode; TextEditingController? passwordRegisterFormTextController; late bool passwordRegisterFormVisibility; - String? Function(BuildContext, String?)? passwordRegisterFormTextControllerValidator; - String? _passwordRegisterFormTextControllerValidator(BuildContext context, String? val) { + String? Function(BuildContext, String?)? + passwordRegisterFormTextControllerValidator; + String? _passwordRegisterFormTextControllerValidator( + BuildContext context, String? val) { if (val == null || val.isEmpty) { return FFLocalizations.of(context).getVariableText( ptText: 'Campo é necessário', @@ -29,8 +31,10 @@ class ForgotPasswordScreenModel extends FlutterFlowModel { FocusNode? passwordConfirmFormFocusNode; TextEditingController? passwordConfirmFormTextController; late bool passwordConfirmFormVisibility; - String? Function(BuildContext, String?)? passwordConfirmFormTextControllerValidator; - String? _passwordConfirmFormTextControllerValidator(BuildContext context, String? val) { + String? Function(BuildContext, String?)? + passwordConfirmFormTextControllerValidator; + String? _passwordConfirmFormTextControllerValidator( + BuildContext context, String? val) { if (val == null || val.isEmpty) { return FFLocalizations.of(context).getVariableText( ptText: 'Campo é necessário', @@ -66,9 +70,11 @@ class ForgotPasswordScreenModel extends FlutterFlowModel { @override void initState(BuildContext context) { passwordRegisterFormVisibility = false; - passwordRegisterFormTextControllerValidator = _passwordRegisterFormTextControllerValidator; + passwordRegisterFormTextControllerValidator = + _passwordRegisterFormTextControllerValidator; passwordConfirmFormVisibility = false; - passwordConfirmFormTextControllerValidator = _passwordConfirmFormTextControllerValidator; + passwordConfirmFormTextControllerValidator = + _passwordConfirmFormTextControllerValidator; } @override diff --git a/lib/pages/forgot_password_page/forgot_password_screen.dart b/lib/pages/forgot_password_page/forgot_password_screen.dart index d63d2017..eed0de3a 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 '../../shared/services/authentication/authentication_service.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 = {}; @@ -147,7 +149,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), @@ -156,7 +159,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, @@ -170,21 +174,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), ), ), ), @@ -200,32 +208,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() @@ -247,16 +265,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, @@ -304,22 +328,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, @@ -329,7 +359,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, ), @@ -340,7 +372,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/liberation_history/liberation_history_model.dart b/lib/pages/liberation_history/liberation_history_model.dart index 8c016069..614fca97 100644 --- a/lib/pages/liberation_history/liberation_history_model.dart +++ b/lib/pages/liberation_history/liberation_history_model.dart @@ -28,7 +28,8 @@ class LiberationHistoryModel extends FlutterFlowModel { requestFn: requestFn, ); void clearGetLiberationsCache() => _getLiberationsManager.clear(); - void clearGetLiberationsCacheKey(String? uniqueKey) => _getLiberationsManager.clearRequest(uniqueKey); + void clearGetLiberationsCacheKey(String? uniqueKey) => + _getLiberationsManager.clearRequest(uniqueKey); @override void initState(BuildContext context) { @@ -36,9 +37,12 @@ class LiberationHistoryModel extends FlutterFlowModel { } Future init() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; } Future answersRequest( diff --git a/lib/pages/liberation_history/liberation_history_widget.dart b/lib/pages/liberation_history/liberation_history_widget.dart index 4eba3c0a..3b26d363 100644 --- a/lib/pages/liberation_history/liberation_history_widget.dart +++ b/lib/pages/liberation_history/liberation_history_widget.dart @@ -19,7 +19,8 @@ class LiberationHistoryWidget extends StatefulWidget { const LiberationHistoryWidget({super.key}); @override - State createState() => _LiberationHistoryWidgetState(); + State createState() => + _LiberationHistoryWidgetState(); } class _LiberationHistoryWidgetState extends State { @@ -54,12 +55,15 @@ class _LiberationHistoryWidgetState extends State { Map _labelsHashMap(dynamic request, bool details) { return Map.from({ - '${FFLocalizations.of(context).getVariableText(ptText: 'Nome', enText: 'Name')}:': request['VTE_NOME'], + '${FFLocalizations.of(context).getVariableText(ptText: 'Nome', enText: 'Name')}:': + request['VTE_NOME'], '${FFLocalizations.of(context).getVariableText(ptText: 'Dt. Envio', enText: 'Date Send')}:': request['NOT_DTENVIO'] != null - ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', request['NOT_DTENVIO']) + ? ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', request['NOT_DTENVIO']) : '', - '${FFLocalizations.of(context).getVariableText(ptText: 'Motivo', enText: 'Reason')}:': request['NOT_MOTIVO'], + '${FFLocalizations.of(context).getVariableText(ptText: 'Motivo', enText: 'Reason')}:': + request['NOT_MOTIVO'], if (details == true) '${FFLocalizations.of(context).getVariableText(ptText: 'Mensagem', enText: 'Message')}:': request['NOT_MSGENVIO'], @@ -69,14 +73,17 @@ class _LiberationHistoryWidgetState extends State { Map _statusHashMap(dynamic request) { return Map.from({ if (request['NOT_STATUS'] == 'L') - FFLocalizations.of(context).getVariableText(ptText: 'Finalizado', enText: 'Finished'): - FlutterFlowTheme.of(context).success + FFLocalizations.of(context).getVariableText( + ptText: 'Finalizado', + enText: 'Finished'): FlutterFlowTheme.of(context).success else if (request['NOT_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: 'Ativo', enText: 'Active'): - FlutterFlowTheme.of(context).warning + FFLocalizations.of(context).getVariableText( + ptText: 'Ativo', + enText: 'Active'): FlutterFlowTheme.of(context).warning }); } @@ -142,13 +149,16 @@ class _LiberationHistoryWidgetState extends State { mainAxisSize: MainAxisSize.max, children: [ Center( - child: Text(FFLocalizations.of(context) - .getVariableText(ptText: "Nenhuma solicitação encontrada!", enText: "No requests found")), + child: Text(FFLocalizations.of(context).getVariableText( + ptText: "Nenhuma solicitação encontrada!", + enText: "No requests found")), ) ], ), ) - else if (_hasData == true && _loading == false && _requestWrap.isNotEmpty) + else if (_hasData == true && + _loading == false && + _requestWrap.isNotEmpty) Expanded(child: _listItems(context)), if (_loading == true) Container( @@ -205,7 +215,8 @@ class _LiberationHistoryWidgetState extends State { buttons: [ if (liberationHistoryItem['NOT_STATUS'] == 'S') FFButtonWidget( - text: FFLocalizations.of(context).getVariableText(ptText: "Aceitar", enText: "Accept"), + text: FFLocalizations.of(context) + .getVariableText(ptText: "Aceitar", enText: "Accept"), options: FFButtonOptions( width: 130, height: 40, @@ -260,7 +271,8 @@ class _LiberationHistoryWidgetState extends State { ), if (liberationHistoryItem['NOT_STATUS'] == 'S') FFButtonWidget( - text: FFLocalizations.of(context).getVariableText(ptText: "Bloquear", enText: "Block"), + text: FFLocalizations.of(context) + .getVariableText(ptText: "Bloquear", enText: "Block"), options: FFButtonOptions( width: 130, height: 40, @@ -343,7 +355,8 @@ class _LiberationHistoryWidgetState extends State { return null; } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Solicitações", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Solicitações", e, s); setState(() { _hasData = false; _loading = false; @@ -356,7 +369,8 @@ class _LiberationHistoryWidgetState extends State { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."), + FFLocalizations.of(context).getVariableText( + ptText: "Não há mais dados.", enText: "No more data."), style: TextStyle( color: Colors.white, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), diff --git a/lib/pages/message_history_page/message_history_page_model.dart b/lib/pages/message_history_page/message_history_page_model.dart index 1a2cd70d..9660882d 100644 --- a/lib/pages/message_history_page/message_history_page_model.dart +++ b/lib/pages/message_history_page/message_history_page_model.dart @@ -6,7 +6,8 @@ import 'package:hub/pages/message_history_page/message_history_page_widget.dart' import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart'; -class MessageHistoryPageModel extends FlutterFlowModel { +class MessageHistoryPageModel + extends FlutterFlowModel { late final String devUUID; late final String userUUID; late final String cliUUID; @@ -17,7 +18,8 @@ class MessageHistoryPageModel extends FlutterFlowModel String? Function(BuildContext, String?)? textControllerValidator; TabController? tabBarController; - int get tabBarCurrentIndex => tabBarController != null ? tabBarController!.index : 0; + int get tabBarCurrentIndex => + tabBarController != null ? tabBarController!.index : 0; final _getLiberationsManager = StreamRequestManager(); Stream getLiberations({ @@ -31,7 +33,8 @@ class MessageHistoryPageModel extends FlutterFlowModel requestFn: requestFn, ); void clearGetLiberationsCache() => _getLiberationsManager.clear(); - void clearGetLiberationsCacheKey(String? uniqueKey) => _getLiberationsManager.clearRequest(uniqueKey); + void clearGetLiberationsCacheKey(String? uniqueKey) => + _getLiberationsManager.clearRequest(uniqueKey); @override void initState(BuildContext context) { @@ -39,9 +42,12 @@ class MessageHistoryPageModel extends FlutterFlowModel } Future init() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; } @override diff --git a/lib/pages/message_history_page/message_history_page_widget.dart b/lib/pages/message_history_page/message_history_page_widget.dart index 84624c22..81cb79b7 100644 --- a/lib/pages/message_history_page/message_history_page_widget.dart +++ b/lib/pages/message_history_page/message_history_page_widget.dart @@ -14,10 +14,12 @@ class MessageHistoryPageWidget extends StatefulWidget { const MessageHistoryPageWidget({super.key}); @override - State createState() => _MessageHistoryPageWidgetState(); + State createState() => + _MessageHistoryPageWidgetState(); } -class _MessageHistoryPageWidgetState extends State with TickerProviderStateMixin { +class _MessageHistoryPageWidgetState extends State + with TickerProviderStateMixin { late MessageHistoryPageModel _model; final scaffoldKey = GlobalKey(); @@ -43,25 +45,27 @@ class _MessageHistoryPageWidgetState extends State wit _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMore(); } }); - _model.tabBarController = TabController(vsync: this, length: 3, initialIndex: 0) - ..addListener(() { - if (_model.tabBarController?.index == 0) { - _destinyType = "P"; - } else if (_model.tabBarController?.index == 1) { - _destinyType = "A"; - } else { - _destinyType = "T"; - } + _model.tabBarController = + TabController(vsync: this, length: 3, initialIndex: 0) + ..addListener(() { + if (_model.tabBarController?.index == 0) { + _destinyType = "P"; + } else if (_model.tabBarController?.index == 1) { + _destinyType = "A"; + } else { + _destinyType = "T"; + } - _pageNumber = 1; - _messageWrap = []; - _messageFuture = fetchMessage(); - }); + _pageNumber = 1; + _messageWrap = []; + _messageFuture = fetchMessage(); + }); _model.textController ??= TextEditingController(); _model.textFieldFocusNode ??= FocusNode(); @@ -120,7 +124,8 @@ class _MessageHistoryPageWidgetState extends State wit return null; } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Mensagems", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Mensagems", e, s); setState(() { _hasData = false; _loading = false; @@ -175,7 +180,8 @@ class _MessageHistoryPageWidgetState extends State wit Widget _body(BuildContext context) { double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); - double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context); + double limitedSubHeaderFontSize = + LimitedFontSizeUtil.getSubHeaderFontSize(context); return SafeArea( top: true, child: Column( @@ -191,7 +197,8 @@ class _MessageHistoryPageWidgetState extends State wit fontFamily: FlutterFlowTheme.of(context).titleMediumFamily, fontSize: limitedBodyFontSize, 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, @@ -227,8 +234,9 @@ class _MessageHistoryPageWidgetState extends State wit children: [ Center( child: Text( - FFLocalizations.of(context) - .getVariableText(ptText: "Nenhuma mensagem encontrada!", enText: "No message found"), + FFLocalizations.of(context).getVariableText( + ptText: "Nenhuma mensagem encontrada!", + enText: "No message found"), style: TextStyle( color: FlutterFlowTheme.of(context).primaryText, fontSize: limitedSubHeaderFontSize, @@ -274,7 +282,8 @@ class _MessageHistoryPageWidgetState extends State wit ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."), + FFLocalizations.of(context).getVariableText( + ptText: "Não há mais dados.", enText: "No more data."), style: TextStyle( color: Colors.white, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), @@ -288,7 +297,8 @@ class _MessageHistoryPageWidgetState extends State wit Widget _item(BuildContext context, dynamic jsonBody) { double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); - double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context); + double limitedSubHeaderFontSize = + LimitedFontSizeUtil.getSubHeaderFontSize(context); return Padding( padding: const EdgeInsets.symmetric(horizontal: 15), child: Card( @@ -339,7 +349,8 @@ class _MessageHistoryPageWidgetState extends State wit padding: const EdgeInsets.only(left: 5), child: Icon( Icons.history, - color: FlutterFlowTheme.of(context).customColor6, + color: + FlutterFlowTheme.of(context).customColor6, size: 15, ), ), @@ -349,7 +360,8 @@ class _MessageHistoryPageWidgetState extends State wit style: TextStyle( fontWeight: FontWeight.bold, fontSize: limitedBodyFontSize, - color: FlutterFlowTheme.of(context).customColor6, + color: + FlutterFlowTheme.of(context).customColor6, ), overflow: TextOverflow.ellipsis, ), @@ -364,7 +376,8 @@ class _MessageHistoryPageWidgetState extends State wit padding: const EdgeInsets.only(left: 5), child: Icon( Icons.message, - color: FlutterFlowTheme.of(context).customColor6, + color: + FlutterFlowTheme.of(context).customColor6, size: 15, ), ), @@ -373,7 +386,8 @@ class _MessageHistoryPageWidgetState extends State wit jsonBody['MSG_TEXTO'].toString(), style: TextStyle( fontSize: limitedBodyFontSize, - color: FlutterFlowTheme.of(context).customColor6, + color: + FlutterFlowTheme.of(context).customColor6, ), ), ), diff --git a/lib/pages/package_order_page/package_order_page.dart b/lib/pages/package_order_page/package_order_page.dart index 980c5c0b..62f38272 100644 --- a/lib/pages/package_order_page/package_order_page.dart +++ b/lib/pages/package_order_page/package_order_page.dart @@ -56,7 +56,8 @@ class _PackageOrderPage extends State { _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMoreOrders(); } }); @@ -64,7 +65,8 @@ class _PackageOrderPage extends State { } Future initDatabase() async { - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value) ?? ''); + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value) ?? ''); } @override @@ -79,7 +81,8 @@ class _PackageOrderPage extends State { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."), + FFLocalizations.of(context).getVariableText( + ptText: "Não há mais dados.", enText: "No more data."), style: TextStyle( color: Colors.white, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), @@ -163,25 +166,30 @@ class _PackageOrderPage extends State { child: IconButton( icon: const Icon(Icons.filter_list), onPressed: () async { - final Map? selectedFilter = await showModalBottomSheet>( - isScrollControlled: true, - backgroundColor: Colors.transparent, - context: context, - builder: (context) { - return GestureDetector( - onTap: () => Navigator.of(context).pop(), - child: Container( - color: Colors.transparent, - child: GestureDetector( - onTap: () {}, - child: OrderFilterModalWidget( - defaultAdresseeType: _selectedTypeSubject.value['adresseeType'] ?? '.*', - defaultStatus: _selectedTypeSubject.value['status'] ?? '.*', + final Map? selectedFilter = + await showModalBottomSheet>( + isScrollControlled: true, + backgroundColor: Colors.transparent, + context: context, + builder: (context) { + return GestureDetector( + onTap: () => Navigator.of(context).pop(), + child: Container( + color: Colors.transparent, + child: GestureDetector( + onTap: () {}, + child: OrderFilterModalWidget( + defaultAdresseeType: _selectedTypeSubject + .value['adresseeType'] ?? + '.*', + defaultStatus: + _selectedTypeSubject.value['status'] ?? + '.*', + ), + ), ), - ), - ), - ); - }); + ); + }); if (selectedFilter != null) { _updateFilterAction(selectedFilter); @@ -224,7 +232,9 @@ class _PackageOrderPage extends State { return AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, automaticallyImplyLeading: false, - title: Text(FFLocalizations.of(context).getVariableText(enText: 'Orders', ptText: 'Encomendas'), + title: Text( + FFLocalizations.of(context) + .getVariableText(enText: 'Orders', ptText: 'Encomendas'), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, @@ -255,8 +265,9 @@ class _PackageOrderPage extends State { children: [ Center( child: Text( - FFLocalizations.of(context) - .getVariableText(ptText: "Nenhuma encomenda encontrada!", enText: "No orders found!"), + FFLocalizations.of(context).getVariableText( + ptText: "Nenhuma encomenda encontrada!", + enText: "No orders found!"), style: TextStyle( color: FlutterFlowTheme.of(context).primaryText, fontSize: LimitedFontSizeUtil.getHeaderFontSize(context), @@ -312,10 +323,12 @@ class _PackageOrderPage extends State { '${FFLocalizations.of(context).getVariableText(ptText: 'Categoria', enText: 'Category')}:': order['customCategory'], '${FFLocalizations.of(context).getVariableText(ptText: 'Recebido em', enText: 'Received on')}:': - ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', order['dtReceive']), + ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', order['dtReceive']), if (order['isPending'] == false) '${FFLocalizations.of(context).getVariableText(ptText: 'Retirado em', enText: 'Picked up on')}:': - ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', order['dtPickUp']), + ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', order['dtPickUp']), }); } @@ -327,21 +340,25 @@ class _PackageOrderPage extends State { '${FFLocalizations.of(context).getVariableText(ptText: 'Categoria', enText: 'Category')}:': order['customCategory'], if (order['code'] != null) - '${FFLocalizations.of(context).getVariableText(ptText: 'Cód. Objeto', enText: 'Object Code')}:': order['code'], + '${FFLocalizations.of(context).getVariableText(ptText: 'Cód. Objeto', enText: 'Object Code')}:': + order['code'], '${FFLocalizations.of(context).getVariableText(ptText: 'Entregue por', enText: 'Delivered by')}:': order['sendedBy'], '${FFLocalizations.of(context).getVariableText(ptText: 'Recebido por', enText: 'Received by')}:': order['receivedBy'], '${FFLocalizations.of(context).getVariableText(ptText: 'Recebido em', enText: 'Received on')}:': - ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', order['dtReceive']), + ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', order['dtReceive']), if (order['isPending'] == false) '${FFLocalizations.of(context).getVariableText(ptText: 'Retirado por', enText: 'Picked up by')}:': order['pickedUpBy'], if (order['isPending'] == false) '${FFLocalizations.of(context).getVariableText(ptText: 'Retirado em', enText: 'Picked up on')}:': - ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', order['dtPickUp']), + ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', order['dtPickUp']), if (order['message'] != null) - '${FFLocalizations.of(context).getVariableText(ptText: 'Mensagem', enText: 'Message')}:': order['message'] + '${FFLocalizations.of(context).getVariableText(ptText: 'Mensagem', enText: 'Message')}:': + order['message'] }); } @@ -349,13 +366,15 @@ class _PackageOrderPage extends State { return [ if (order['isPending'] == true) Map.from({ - FFLocalizations.of(context).getVariableText(ptText: 'Aguardando Retirada', enText: 'Waiting Pick up'): - FlutterFlowTheme.of(context).warning, + FFLocalizations.of(context).getVariableText( + ptText: 'Aguardando Retirada', + enText: 'Waiting Pick up'): FlutterFlowTheme.of(context).warning, }) else Map.from({ - FFLocalizations.of(context).getVariableText(ptText: 'Retirado', enText: 'Picked up'): - FlutterFlowTheme.of(context).primary, + FFLocalizations.of(context).getVariableText( + ptText: 'Retirado', + enText: 'Picked up'): FlutterFlowTheme.of(context).primary, }), if (order['adresseeType'] == 'PRO') Map.from({ @@ -392,12 +411,14 @@ class _PackageOrderPage extends State { if (order['isPending'] == true) Map.from({ FFLocalizations.of(context).getVariableText( - ptText: 'Aguardando Retirada', - enText: 'Waiting Pick up'): FlutterFlowTheme.of(context).warning, + ptText: 'Aguardando Retirada', + enText: 'Waiting Pick up'): + FlutterFlowTheme.of(context).warning, }) else Map.from({ - FFLocalizations.of(context).getVariableText(ptText: 'Retirado', enText: 'Picked up'): + FFLocalizations.of(context).getVariableText( + ptText: 'Retirado', enText: 'Picked up'): FlutterFlowTheme.of(context).primary, }), ], @@ -417,4 +438,4 @@ class _PackageOrderPage extends State { body: _appBody(context), ); } -} \ No newline at end of file +} diff --git a/lib/pages/people_on_the_property_page/people_on_the_property_page_model.dart b/lib/pages/people_on_the_property_page/people_on_the_property_page_model.dart index de07033f..90228bc3 100644 --- a/lib/pages/people_on_the_property_page/people_on_the_property_page_model.dart +++ b/lib/pages/people_on_the_property_page/people_on_the_property_page_model.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_widget.dart'; -class PeopleOnThePropertyPageModel extends FlutterFlowModel { +class PeopleOnThePropertyPageModel + extends FlutterFlowModel { /// State fields for stateful widgets in this page. final unfocusNode = FocusNode(); diff --git a/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart b/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart index a1146aeb..e5a60ef4 100644 --- a/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart +++ b/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart @@ -15,7 +15,8 @@ class PeopleOnThePropertyPage extends StatefulWidget { const PeopleOnThePropertyPage({super.key}); @override - State createState() => _PeopleOnThePropertyPageState(); + State createState() => + _PeopleOnThePropertyPageState(); } class _PeopleOnThePropertyPageState extends State { @@ -97,7 +98,12 @@ class _PeopleOnThePropertyPageState extends State { if (snapshot.hasError || snapshot.data?.exception != null) { if (snapshot.error != null && snapshot.stackTrace != null) { - LogUtil.requestAPIFailed('getPessoasLocal.php', "", 'Busca Pessoas no Local', snapshot.error, snapshot.stackTrace!); + LogUtil.requestAPIFailed( + 'getPessoasLocal.php', + "", + 'Busca Pessoas no Local', + snapshot.error, + snapshot.stackTrace!); } return Center( @@ -105,7 +111,9 @@ class _PeopleOnThePropertyPageState extends State { width: double.infinity, height: 100, child: Text( - FFLocalizations.of(context).getVariableText(ptText: "Pessoas não encontradas", enText: "Persons not found"), + FFLocalizations.of(context).getVariableText( + ptText: "Pessoas não encontradas", + enText: "Persons not found"), textAlign: TextAlign.center, ), ), @@ -154,13 +162,17 @@ class _PeopleOnThePropertyPageState extends State { r'''$.USU_NOME''', ).toString(), style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, fontSize: 14.0, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), ), - ].divide(const SizedBox(width: 20.0)).addToStart(const SizedBox(width: 40.0)), + ] + .divide(const SizedBox(width: 20.0)) + .addToStart(const SizedBox(width: 40.0)), ); }, ); diff --git a/lib/pages/pets_on_the_property_page/pets_history_screen.dart b/lib/pages/pets_on_the_property_page/pets_history_screen.dart index b32ba509..22fd2957 100644 --- a/lib/pages/pets_on_the_property_page/pets_history_screen.dart +++ b/lib/pages/pets_on_the_property_page/pets_history_screen.dart @@ -23,7 +23,8 @@ class PetsHistoryScreen extends StatefulWidget { _PetsHistoryScreenState createState() => _PetsHistoryScreenState(); } -class _PetsHistoryScreenState extends State with TickerProviderStateMixin { +class _PetsHistoryScreenState extends State + with TickerProviderStateMixin { late ScrollController _scrollController; int _pageNumber = 1; @@ -38,11 +39,13 @@ class _PetsHistoryScreenState extends State with TickerProvid @override void initState() { super.initState(); - model = widget.model ?? createModel(context, () => PetsPageModel(isInteractive: false)); + model = widget.model ?? + createModel(context, () => PetsPageModel(isInteractive: false)); _petsFuture = _fetch(); _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMore(); } }); @@ -58,10 +61,11 @@ class _PetsHistoryScreenState extends State with TickerProvid return AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, automaticallyImplyLeading: false, - title: Text(FFLocalizations.of(context).getVariableText( - ptText: 'Pets', - enText: 'Pets', - ), + title: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Pets', + enText: 'Pets', + ), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, @@ -124,7 +128,8 @@ class _PetsHistoryScreenState extends State with TickerProvid return null; } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Pets", e, s); setState(() { _hasData = false; _loading = false; @@ -145,7 +150,8 @@ class _PetsHistoryScreenState extends State with TickerProvid ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."), + FFLocalizations.of(context).getVariableText( + ptText: "Não há mais dados.", enText: "No more data."), style: TextStyle( color: Colors.white, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), @@ -159,8 +165,10 @@ class _PetsHistoryScreenState extends State with TickerProvid @override Widget build(BuildContext context) { - late final double limitedBodyTextSize = LimitedFontSizeUtil.getBodyFontSize(context); - late final double limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context); + late final double limitedBodyTextSize = + LimitedFontSizeUtil.getBodyFontSize(context); + late final double limitedHeaderTextSize = + LimitedFontSizeUtil.getHeaderFontSize(context); return Scaffold( appBar: widget.isApp ? _appBar(context) : null, @@ -177,8 +185,9 @@ class _PetsHistoryScreenState extends State with TickerProvid children: [ Center( child: Text( - FFLocalizations.of(context) - .getVariableText(ptText: "Nenhum Pet encontrado!", enText: "No pets found"), + FFLocalizations.of(context).getVariableText( + ptText: "Nenhum Pet encontrado!", + enText: "No pets found"), style: TextStyle( fontFamily: 'Nunito', fontSize: limitedHeaderTextSize, @@ -204,7 +213,8 @@ class _PetsHistoryScreenState extends State with TickerProvid padding: const EdgeInsets.only(right: 30, top: 10), child: Text( model.petAmountRegister == '0' - ? FFLocalizations.of(context).getVariableText(ptText: "Ilimitado", enText: "Unlimited") + ? FFLocalizations.of(context).getVariableText( + ptText: "Ilimitado", enText: "Unlimited") : "${FFLocalizations.of(context).getVariableText(ptText: "Quantidade de Pets: ", enText: "Amount of Pets: ")}$count/${model.petAmountRegister}", textAlign: TextAlign.right, style: TextStyle( @@ -241,9 +251,12 @@ class _PetsHistoryScreenState extends State with TickerProvid imagePath: 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${model.devUUID}&userUUID=${model.userUUID}&cliID=${model.cliUUID}&atividade=consultaFotoPet&petId=${uItem['id'] ?? ''}', labelsHashMap: { - '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': uItem['name'] ?? '', - '${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:': uItem['species'] ?? '', - '${FFLocalizations.of(context).getVariableText(ptText: "Raça", enText: "Breed")}:': uItem['breed'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': + uItem['name'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:': + uItem['species'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Raça", enText: "Breed")}:': + uItem['breed'] ?? '', }, statusHashMap: [ if (uItem['size'] == "MIN") @@ -283,7 +296,8 @@ class _PetsHistoryScreenState extends State with TickerProvid }, if (uItem['gender'] == "MAC") { - FFLocalizations.of(context).getVariableText(ptText: 'Macho', enText: 'Male'): const Color(0xFF094CB0), + FFLocalizations.of(context).getVariableText( + ptText: 'Macho', enText: 'Male'): const Color(0xFF094CB0), }, if (uItem['gender'] == "FEM") { @@ -294,10 +308,17 @@ class _PetsHistoryScreenState extends State with TickerProvid } ], onTapCardItemAction: () async { - final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - final cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + final devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? + ''; + final cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? + ''; + final cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? + ''; await showDialog( useSafeArea: true, context: context, @@ -319,11 +340,13 @@ class _PetsHistoryScreenState extends State with TickerProvid safeSetState(() { _pageNumber = 1; _petsWrap = []; - _petsFuture = _fetch().then((value) => value!.jsonBody['pets'] ?? []); + _petsFuture = + _fetch().then((value) => value!.jsonBody['pets'] ?? []); }); }).catchError((e, s) async { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Pets", e, s); safeSetState(() { _hasData = false; _loading = false; diff --git a/lib/pages/pets_page/pets_page_model.dart b/lib/pages/pets_page/pets_page_model.dart index aeb213a9..199a60dd 100644 --- a/lib/pages/pets_page/pets_page_model.dart +++ b/lib/pages/pets_page/pets_page_model.dart @@ -114,8 +114,10 @@ class PetsPageModel extends FlutterFlowModel { enText: 'Select an option', ptText: 'Selecione uma opção', ); - dropDownValueController1 = FormFieldController(dropDownValue1 ??= defaultDropDownText); - dropDownValueController2 = FormFieldController(dropDownValue2 ??= defaultDropDownText); + dropDownValueController1 = + FormFieldController(dropDownValue1 ??= defaultDropDownText); + dropDownValueController2 = + FormFieldController(dropDownValue2 ??= defaultDropDownText); safeSetState?.call(); } @@ -147,15 +149,18 @@ class PetsPageModel extends FlutterFlowModel { textControllerObservation = TextEditingController(); WidgetsBinding.instance.addPostFrameCallback((_) async { - devUUID = await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? ''; - userUUID = await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? ''; - cliUUID = await StorageHelper().get(KeychainStorageKey.clientUUID.value) ?? ''; - petAmountRegister = await StorageHelper().get(KeychainStorageKey.petAmount.value) ?? ''; + devUUID = + await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? ''; + userUUID = + await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? ''; + cliUUID = + await StorageHelper().get(KeychainStorageKey.clientUUID.value) ?? ''; + petAmountRegister = + await StorageHelper().get(KeychainStorageKey.petAmount.value) ?? ''; }); } void setEditForm() { - if (item != null) petId = item['id']; // updateImage!(); @@ -167,16 +172,20 @@ class PetsPageModel extends FlutterFlowModel { updateImage?.call(); })(); - textControllerName = TextEditingController(text: item != null ? item['name'] ?? '' : ''); + textControllerName = + TextEditingController(text: item != null ? item['name'] ?? '' : ''); textFieldFocusName = FocusNode(); - textControllerSpecies = TextEditingController(text: item != null ? item['species'] ?? '' : ''); + textControllerSpecies = + TextEditingController(text: item != null ? item['species'] ?? '' : ''); textFieldFocusSpecies = FocusNode(); - textControllerRace = TextEditingController(text: item != null ? item['breed'] ?? '' : ''); + textControllerRace = + TextEditingController(text: item != null ? item['breed'] ?? '' : ''); textFieldFocusRace = FocusNode(); - textControllerColor = TextEditingController(text: item != null ? item['color'] ?? '' : ''); + textControllerColor = + TextEditingController(text: item != null ? item['color'] ?? '' : ''); textFieldFocusColor = FocusNode(); textControllerData = TextEditingController( @@ -188,7 +197,8 @@ class PetsPageModel extends FlutterFlowModel { textFieldFocusData = FocusNode(); - textControllerObservation = TextEditingController(text: item != null ? item['notes'] ?? '' : ''); + textControllerObservation = + TextEditingController(text: item != null ? item['notes'] ?? '' : ''); textFieldFocusObservation = FocusNode(); item != null ? dropDownValue1 = item['gender'] ?? '' : dropDownValue1 = ''; @@ -228,10 +238,13 @@ class PetsPageModel extends FlutterFlowModel { if (uploadedLocalFile == null || uploadedLocalFile!.bytes!.isEmpty) { return false; } - if (textControllerName.text.isEmpty || textControllerName.text.length > 80 || textControllerName.text == '') { + if (textControllerName.text.isEmpty || + textControllerName.text.length > 80 || + textControllerName.text == '') { return false; } - if (textControllerSpecies.text.isEmpty || textControllerSpecies.text == '') { + if (textControllerSpecies.text.isEmpty || + textControllerSpecies.text == '') { return false; } if (textControllerRace.text.isEmpty || textControllerRace.text == '') { @@ -249,11 +262,15 @@ class PetsPageModel extends FlutterFlowModel { return false; } - if (dropDownValue1 == 'Selecione uma opção' || dropDownValue1 == null || dropDownValue1 == '') { + if (dropDownValue1 == 'Selecione uma opção' || + dropDownValue1 == null || + dropDownValue1 == '') { return false; } - if (dropDownValue2 == 'Selecione uma opção' || dropDownValue2 == null || dropDownValue2 == '') { + if (dropDownValue2 == 'Selecione uma opção' || + dropDownValue2 == null || + dropDownValue2 == '') { return false; } @@ -293,7 +310,8 @@ class PetsPageModel extends FlutterFlowModel { } else { String errorMessage; try { - errorMessage = jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString(); + errorMessage = + jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString(); } catch (e) { errorMessage = FFLocalizations.of(buildContext!).getVariableText( enText: 'Failed to update pet', @@ -331,10 +349,12 @@ class PetsPageModel extends FlutterFlowModel { } else { String errorMessage; try { - errorMessage = jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString(); + errorMessage = + jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString(); await DialogUtil.error(buildContext!, errorMessage); } catch (e) { - if (response.jsonBody['error_msg'] == "Limite de Cadastro de Pet Atingido.") { + if (response.jsonBody['error_msg'] == + "Limite de Cadastro de Pet Atingido.") { errorMessage = FFLocalizations.of(buildContext!).getVariableText( enText: 'Pet registration limit reached', ptText: 'Limite de cadastro de pets atingido', @@ -519,23 +539,33 @@ class PetsPageModel extends FlutterFlowModel { '${FFLocalizations.of(context).getVariableText(ptText: "Data de Nascimento", enText: "Date of Birth")}:': ValidatorUtil.formatDateTimePicker(item['birthdayDate']), if (item['gender'] != null && item['gender'] != '') - '${FFLocalizations.of(context).getVariableText(ptText: "Gênero", enText: "Gender")}:': item['gender'] == 'MAC' - ? FFLocalizations.of(context).getVariableText(ptText: 'MACHO', enText: 'MALE') - : FFLocalizations.of(context).getVariableText(enText: 'FEMALE', ptText: 'FÊMEA'), + '${FFLocalizations.of(context).getVariableText(ptText: "Gênero", enText: "Gender")}:': + item['gender'] == 'MAC' + ? FFLocalizations.of(context) + .getVariableText(ptText: 'MACHO', enText: 'MALE') + : FFLocalizations.of(context) + .getVariableText(enText: 'FEMALE', ptText: 'FÊMEA'), if (item['size'] != null && item['size'] != '') - '${FFLocalizations.of(context).getVariableText(ptText: "Porte", enText: "Size")}:': item['size'] == 'MIN' - ? FFLocalizations.of(context).getVariableText(ptText: 'MINI', enText: 'MINI') - : item['size'] == 'PEQ' - ? FFLocalizations.of(context).getVariableText(ptText: 'PEQUENO', enText: 'SMALL') - : item['size'] == 'MED' - ? FFLocalizations.of(context).getVariableText(ptText: 'MÉDIO', enText: 'MEDIUM') - : item['size'] == 'GRD' - ? FFLocalizations.of(context).getVariableText(ptText: 'GRANDE', enText: 'LARGE') - : item['size'] == 'GIG' - ? FFLocalizations.of(context).getVariableText(ptText: 'GIGANTE', enText: 'GIANT') - : '', + '${FFLocalizations.of(context).getVariableText(ptText: "Porte", enText: "Size")}:': + item['size'] == 'MIN' + ? FFLocalizations.of(context) + .getVariableText(ptText: 'MINI', enText: 'MINI') + : item['size'] == 'PEQ' + ? FFLocalizations.of(context) + .getVariableText(ptText: 'PEQUENO', enText: 'SMALL') + : item['size'] == 'MED' + ? FFLocalizations.of(context).getVariableText( + ptText: 'MÉDIO', enText: 'MEDIUM') + : item['size'] == 'GRD' + ? FFLocalizations.of(context).getVariableText( + ptText: 'GRANDE', enText: 'LARGE') + : item['size'] == 'GIG' + ? FFLocalizations.of(context).getVariableText( + ptText: 'GIGANTE', enText: 'GIANT') + : '', if (item['notes'] != null && item['notes'] != '') - '${FFLocalizations.of(context).getVariableText(ptText: "Observação", enText: "Notes")}:': item['notes'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Observação", enText: "Notes")}:': + item['notes'] ?? '', }), imagePath: 'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=${item['id'] ?? ''}', diff --git a/lib/pages/pets_page/pets_page_widget.dart b/lib/pages/pets_page/pets_page_widget.dart index a2d7c1f7..b1214838 100644 --- a/lib/pages/pets_page/pets_page_widget.dart +++ b/lib/pages/pets_page/pets_page_widget.dart @@ -28,7 +28,8 @@ class PetsPageWidget extends StatefulWidget { State createState() => _PetsPageWidgetState(); } -class _PetsPageWidgetState extends State with SingleTickerProviderStateMixin { +class _PetsPageWidgetState extends State + with SingleTickerProviderStateMixin { late PetsPageModel _model; @override @@ -78,7 +79,7 @@ class _PetsPageWidgetState extends State with SingleTickerProvid title: FFLocalizations.of(context).getVariableText( ptText: 'Cadastrar Pets', enText: 'Pets Register', - ), + ), onBackButtonPressed: () => context.pop(), ); } @@ -94,11 +95,16 @@ class _PetsPageWidgetState extends State with SingleTickerProvid context: context, model: _model, labelTab1: _model.isEditing - ? FFLocalizations.of(context).getVariableText(ptText: 'Editar', enText: 'Edit') - : FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register'), - labelTab2: FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'History'), + ? FFLocalizations.of(context) + .getVariableText(ptText: 'Editar', enText: 'Edit') + : FFLocalizations.of(context) + .getVariableText(ptText: 'Cadastrar', enText: 'Register'), + labelTab2: FFLocalizations.of(context) + .getVariableText(ptText: 'Consultar', enText: 'History'), controller: _model.tabBarController, - widget1: _model.isEditing ? _buildEditForm(context) : _buildRegisterForm(context), + widget1: _model.isEditing + ? _buildEditForm(context) + : _buildRegisterForm(context), widget2: PetsHistoryScreen(model: _model, isApp: false), onEditingChanged: onEditingChanged, ); @@ -106,8 +112,10 @@ class _PetsPageWidgetState extends State with SingleTickerProvid Widget _buildRegisterForm(BuildContext context) { double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context); - double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context); - double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context); + double limitedHeaderFontSize = + LimitedFontSizeUtil.getHeaderFontSize(context); + double limitedSubHeaderFontSize = + LimitedFontSizeUtil.getSubHeaderFontSize(context); return SingleChildScrollView( child: Column( @@ -126,7 +134,8 @@ class _PetsPageWidgetState extends State with SingleTickerProvid 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, ), ), @@ -135,326 +144,437 @@ class _PetsPageWidgetState extends State with SingleTickerProvid Form( key: _model.registerFormKey, autovalidateMode: AutovalidateMode.onUserInteraction, - child: - Column(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Padding( - padding: const EdgeInsets.fromLTRB(0, 10, 0, 20), - child: MediaUploadButtonUtil( - onUploadComplete: _model.handleUploadComplete, - isUploading: _model.isDataUploading, - uploadedFiles: _model.uploadedLocalFile, - labelText: FFLocalizations.of(context).getVariableText( - ptText: 'Clique para adicionar a foto de seu Pet', enText: 'Click to add your Pet\'s photo'), - ), - ), - CustomInputUtil( - controller: _model.textControllerName, - validator: _model.textControllerNameValidator.asValidator(context), - focusNode: _model.textFieldFocusName, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Nome', enText: 'Name'), - hintText: FFLocalizations.of(context).getVariableText(ptText: 'Nome', enText: 'Name'), - suffixIcon: Symbols.format_color_text, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 80, - ), - CustomInputUtil( - controller: _model.textControllerSpecies, - validator: _model.textControllerSpeciesValidator.asValidator(context), - focusNode: _model.textFieldFocusSpecies, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Espécie', enText: 'Species'), - hintText: FFLocalizations.of(context) - .getVariableText(ptText: 'Ex: Cachorro, Gato, Papagaio', enText: 'e.g. Dog, Cat, Parrot'), - suffixIcon: Symbols.sound_detection_dog_barking, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 80, - ), - CustomInputUtil( - controller: _model.textControllerRace, - validator: _model.textControllerRaceValidator.asValidator(context), - focusNode: _model.textFieldFocusRace, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Raça', enText: 'Race'), - hintText: FFLocalizations.of(context).getVariableText( - ptText: 'Ex: Labrador, Poodle, Siamês, Persa', enText: 'e.g. Labrador, Poodle, Siamese, Persian'), - suffixIcon: Icons.pets_outlined, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 80, - ), - CustomInputUtil( - controller: _model.textControllerColor, - validator: _model.textControllerColorValidator.asValidator(context), - focusNode: _model.textFieldFocusColor, - 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'), - suffixIcon: Symbols.palette, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 80, - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - SizedBox( - width: MediaQuery.of(context).size.width, - height: 60.0, - child: Stack( - children: [ - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textControllerData, - focusNode: _model.textFieldFocusData, - cursorColor: FlutterFlowTheme.of(context).primary, - readOnly: true, - autovalidateMode: AutovalidateMode.onUserInteraction, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - isDense: true, - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), - fontSize: limitedInputFontSize, + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 20), + child: MediaUploadButtonUtil( + onUploadComplete: _model.handleUploadComplete, + isUploading: _model.isDataUploading, + uploadedFiles: _model.uploadedLocalFile, + labelText: FFLocalizations.of(context).getVariableText( + ptText: 'Clique para adicionar a foto de seu Pet', + enText: 'Click to add your Pet\'s photo'), + ), + ), + CustomInputUtil( + controller: _model.textControllerName, + validator: _model.textControllerNameValidator + .asValidator(context), + focusNode: _model.textFieldFocusName, + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Nome', enText: 'Name'), + hintText: FFLocalizations.of(context) + .getVariableText(ptText: 'Nome', enText: 'Name'), + suffixIcon: Symbols.format_color_text, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 80, + ), + CustomInputUtil( + controller: _model.textControllerSpecies, + validator: _model.textControllerSpeciesValidator + .asValidator(context), + focusNode: _model.textFieldFocusSpecies, + labelText: FFLocalizations.of(context).getVariableText( + ptText: 'Espécie', enText: 'Species'), + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Ex: Cachorro, Gato, Papagaio', + enText: 'e.g. Dog, Cat, Parrot'), + suffixIcon: Symbols.sound_detection_dog_barking, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 80, + ), + CustomInputUtil( + controller: _model.textControllerRace, + validator: _model.textControllerRaceValidator + .asValidator(context), + focusNode: _model.textFieldFocusRace, + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Raça', enText: 'Race'), + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Ex: Labrador, Poodle, Siamês, Persa', + enText: 'e.g. Labrador, Poodle, Siamese, Persian'), + suffixIcon: Icons.pets_outlined, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 80, + ), + CustomInputUtil( + controller: _model.textControllerColor, + validator: _model.textControllerColorValidator + .asValidator(context), + focusNode: _model.textFieldFocusColor, + 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'), + suffixIcon: Symbols.palette, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 80, + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + width: MediaQuery.of(context).size.width, + height: 60.0, + child: Stack( + children: [ + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textControllerData, + focusNode: _model.textFieldFocusData, + cursorColor: + FlutterFlowTheme.of(context).primary, + readOnly: true, + autovalidateMode: + AutovalidateMode.onUserInteraction, + autofocus: false, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + fontSize: limitedInputFontSize, + ), + hintText: FFLocalizations.of(context) + .getVariableText( + ptText: 'Data de Nascimento', + enText: 'Date of Birth', ), - hintText: FFLocalizations.of(context).getVariableText( - ptText: 'Data de Nascimento', - enText: 'Date of Birth', - ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), - lineHeight: 1.0, - fontSize: limitedInputFontSize, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + lineHeight: 1.0, + fontSize: limitedInputFontSize, + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .customColor6, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .primary, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.date_range, + color: FlutterFlowTheme.of(context) + .accent1, ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).customColor6, - width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.date_range, - color: FlutterFlowTheme.of(context).accent1, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + lineHeight: 1.8, + fontSize: limitedInputFontSize, + ), + textAlign: TextAlign.start, + validator: _model + .textControllerDataValidator + .asValidator(context), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - lineHeight: 1.8, - fontSize: limitedInputFontSize, - ), - textAlign: TextAlign.start, - validator: _model.textControllerDataValidator.asValidator(context), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - final pickedDate = await showDatePicker( - context: context, - initialDate: getCurrentTimestamp, - firstDate: DateTime(1990), - lastDate: DateTime.now(), - builder: (context, child) { - return wrapInMaterialDatePickerTheme( - context, - child!, - headerBackgroundColor: FlutterFlowTheme.of(context).primary, - headerForegroundColor: FlutterFlowTheme.of(context).info, - headerTextStyle: FlutterFlowTheme.of(context).headlineLarge.override( - fontFamily: FlutterFlowTheme.of(context).headlineLargeFamily, - fontSize: limitedInputFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).headlineLargeFamily), - ), - pickerBackgroundColor: FlutterFlowTheme.of(context).primaryBackground, - pickerForegroundColor: FlutterFlowTheme.of(context).primaryText, - selectedDateTimeBackgroundColor: FlutterFlowTheme.of(context).primary, - selectedDateTimeForegroundColor: FlutterFlowTheme.of(context).info, - actionButtonForegroundColor: FlutterFlowTheme.of(context).primaryText, - iconSize: 24.0, + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + final pickedDate = await showDatePicker( + context: context, + initialDate: getCurrentTimestamp, + firstDate: DateTime(1990), + lastDate: DateTime.now(), + builder: (context, child) { + return wrapInMaterialDatePickerTheme( + context, + child!, + headerBackgroundColor: + FlutterFlowTheme.of(context) + .primary, + headerForegroundColor: + FlutterFlowTheme.of(context) + .info, + headerTextStyle: + FlutterFlowTheme.of(context) + .headlineLarge + .override( + fontFamily: FlutterFlowTheme + .of(context) + .headlineLargeFamily, + fontSize: + limitedInputFontSize, + letterSpacing: 0.0, + fontWeight: + FontWeight.w600, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .headlineLargeFamily), + ), + pickerBackgroundColor: + FlutterFlowTheme.of(context) + .primaryBackground, + pickerForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of(context) + .primary, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of(context) + .info, + actionButtonForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + iconSize: 24.0, + ); + }, ); + + if (pickedDate != null) { + setState(() { + _model.selectedDate = DateTime( + pickedDate.year, + pickedDate.month, + pickedDate.day, + ); + + _model.textControllerData = + TextEditingController( + text: dateTimeFormat( + 'dd/MM/yyyy', + _model.selectedDate, + locale: FFLocalizations.of(context) + .languageCode, + )); + _model.textControllerData?.selection = + TextSelection.collapsed( + offset: _model.textControllerData! + .text.length, + ); + }); + } }, - ); - - if (pickedDate != null) { - setState(() { - _model.selectedDate = DateTime( - pickedDate.year, - pickedDate.month, - pickedDate.day, - ); - - _model.textControllerData = TextEditingController( - text: dateTimeFormat( - 'dd/MM/yyyy', - _model.selectedDate, - locale: FFLocalizations.of(context).languageCode, - )); - _model.textControllerData?.selection = TextSelection.collapsed( - offset: _model.textControllerData!.text.length, - ); - }); - } - }, - child: Container( - width: double.infinity, - height: 80.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), + child: Container( + width: double.infinity, + height: 80.0, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(10.0), + ), + ), ), ), - ), + ], ), - ], + ), + ], + ), + ), + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0, 0.0, 15), + child: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Selecione as opções disponíveis', + enText: 'Select the available options', + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.w600, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + fontSize: limitedSubHeaderFontSize, + ), ), ), - ], - ), - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0, 0.0, 15), - child: Text( - FFLocalizations.of(context).getVariableText( - ptText: 'Selecione as opções disponíveis', - enText: 'Select the available options', - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context).bodySmall.override( - fontFamily: FlutterFlowTheme.of(context).bodySmallFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - fontSize: limitedSubHeaderFontSize, - ), ), - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: CustomSelect( - options: const ['MAC', 'FEM'], - controller: _model.dropDownValueController1 ??= - FormFieldController(_model.dropDownValue1 ??= ''), - isRequired: true, - changed: (val) => safeSetState(() { - _model.dropDownValue1 = val; - }), - dropDownValue: _model.dropDownValue1, - optionsLabel: [ - FFLocalizations.of(context).getVariableText(ptText: 'Macho', enText: 'Male'), - FFLocalizations.of(context).getVariableText(ptText: 'Fêmea', enText: 'Female') - ], - hintText: FFLocalizations.of(context) - .getVariableText(ptText: 'Gênero do Pet', enText: 'Gender of the Pet')), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: CustomSelect( - options: const ['MIN', 'PEQ', 'MED', 'GRA', 'GIG'], - controller: _model.dropDownValueController2 ??= - FormFieldController(_model.dropDownValue2 ??= ''), - isRequired: true, - changed: (val) => safeSetState(() { - _model.dropDownValue2 = val; - }), - dropDownValue: _model.dropDownValue2, - optionsLabel: [ - FFLocalizations.of(context).getVariableText(ptText: 'Mini', enText: 'Mini'), - FFLocalizations.of(context).getVariableText(ptText: 'Pequeno', enText: 'Small'), - FFLocalizations.of(context).getVariableText(ptText: 'Médio', enText: 'Medium'), - FFLocalizations.of(context).getVariableText(ptText: 'Grande', enText: 'Big'), - FFLocalizations.of(context).getVariableText(ptText: 'Gigante', enText: 'Giant'), - ], - hintText: FFLocalizations.of(context) - .getVariableText(ptText: 'Porte do Pet', enText: 'Size of the Pet')), - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0, 0.0, 15), - child: Text( - FFLocalizations.of(context).getVariableText( - ptText: 'Você tem alguma observação sobre o seu Pet?', - enText: 'Do you have any observations about your Pet?', - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context).bodySmall.override( - fontFamily: FlutterFlowTheme.of(context).bodySmallFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - fontSize: limitedInputFontSize, - ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: CustomSelect( + options: const ['MAC', 'FEM'], + controller: _model.dropDownValueController1 ??= + FormFieldController( + _model.dropDownValue1 ??= ''), + isRequired: true, + changed: (val) => safeSetState(() { + _model.dropDownValue1 = val; + }), + dropDownValue: _model.dropDownValue1, + optionsLabel: [ + FFLocalizations.of(context).getVariableText( + ptText: 'Macho', enText: 'Male'), + FFLocalizations.of(context).getVariableText( + ptText: 'Fêmea', enText: 'Female') + ], + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Gênero do Pet', + enText: 'Gender of the Pet')), ), - ), - ), - CustomInputUtil( - controller: _model.textControllerObservation, - validator: _model.textControllerObservationValidator.asValidator(context), - focusNode: _model.textFieldFocusObservation, - labelText: FFLocalizations.of(context).getVariableText( - ptText: 'Escreva as suas observações aqui...', enText: 'Write your observations here...'), - hintText: FFLocalizations.of(context).getVariableText( - ptText: 'Escreva as suas observações aqui...', enText: 'Write your observations here...'), - suffixIcon: Icons.text_fields, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 250, - ), - Padding( - padding: const EdgeInsets.fromLTRB(70, 20, 70, 30), - child: SubmitButtonUtil( - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register'), - onPressed: _model.isFormValid(context) ? _model.registerPet : null), - ), - ])), + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: CustomSelect( + options: const ['MIN', 'PEQ', 'MED', 'GRA', 'GIG'], + controller: _model.dropDownValueController2 ??= + FormFieldController( + _model.dropDownValue2 ??= ''), + isRequired: true, + changed: (val) => safeSetState(() { + _model.dropDownValue2 = val; + }), + dropDownValue: _model.dropDownValue2, + optionsLabel: [ + FFLocalizations.of(context).getVariableText( + ptText: 'Mini', enText: 'Mini'), + FFLocalizations.of(context).getVariableText( + ptText: 'Pequeno', enText: 'Small'), + FFLocalizations.of(context).getVariableText( + ptText: 'Médio', enText: 'Medium'), + FFLocalizations.of(context).getVariableText( + ptText: 'Grande', enText: 'Big'), + FFLocalizations.of(context).getVariableText( + ptText: 'Gigante', enText: 'Giant'), + ], + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Porte do Pet', + enText: 'Size of the Pet')), + ), + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0, 0.0, 15), + child: Text( + FFLocalizations.of(context).getVariableText( + ptText: + 'Você tem alguma observação sobre o seu Pet?', + enText: + 'Do you have any observations about your Pet?', + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.w600, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + fontSize: limitedInputFontSize, + ), + ), + ), + ), + CustomInputUtil( + controller: _model.textControllerObservation, + validator: _model.textControllerObservationValidator + .asValidator(context), + focusNode: _model.textFieldFocusObservation, + labelText: FFLocalizations.of(context).getVariableText( + ptText: 'Escreva as suas observações aqui...', + enText: 'Write your observations here...'), + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Escreva as suas observações aqui...', + enText: 'Write your observations here...'), + suffixIcon: Icons.text_fields, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 250, + ), + Padding( + padding: const EdgeInsets.fromLTRB(70, 20, 70, 30), + child: SubmitButtonUtil( + labelText: FFLocalizations.of(context) + .getVariableText( + ptText: 'Cadastrar', enText: 'Register'), + onPressed: _model.isFormValid(context) + ? _model.registerPet + : null), + ), + ])), ], ), ); @@ -478,7 +598,8 @@ class _PetsPageWidgetState extends State with SingleTickerProvid 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), ), ), ), @@ -486,331 +607,442 @@ class _PetsPageWidgetState extends State with SingleTickerProvid Form( key: _model.updateFormKey, autovalidateMode: AutovalidateMode.onUserInteraction, - child: - Column(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Padding( - padding: const EdgeInsets.fromLTRB(0, 10, 0, 20), - child: MediaUploadButtonUtil( - onUploadComplete: _model.handleUploadComplete, - isUploading: _model.isDataUploading, - uploadedFiles: _model.uploadedLocalFile, - labelText: FFLocalizations.of(context).getVariableText( - ptText: 'Clique para adicionar a foto de seu Pet', enText: 'Click to add your Pet\'s photo'), - ), - ), - CustomInputUtil( - controller: _model.textControllerName, - validator: _model.textControllerNameValidator.asValidator(context), - focusNode: _model.textFieldFocusName, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Nome', enText: 'Name'), - hintText: FFLocalizations.of(context).getVariableText(ptText: 'Nome', enText: 'Name'), - suffixIcon: Symbols.format_color_text, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 80, - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: CustomInputUtil( - controller: _model.textControllerSpecies, - validator: _model.textControllerSpeciesValidator.asValidator(context), - focusNode: _model.textFieldFocusSpecies, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Espécie', enText: 'Species'), - hintText: FFLocalizations.of(context) - .getVariableText(ptText: 'Ex: Cachorro, Gato, Papagaio', enText: 'e.g. Dog, Cat, Parrot'), - suffixIcon: Symbols.sound_detection_dog_barking, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 80, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: CustomInputUtil( - controller: _model.textControllerRace, - validator: _model.textControllerRaceValidator.asValidator(context), - focusNode: _model.textFieldFocusRace, - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Raça', enText: 'Race'), - hintText: FFLocalizations.of(context).getVariableText( - ptText: 'Ex: Labrador, Poodle, Siamês, Persa', - enText: 'e.g. Labrador, Poodle, Siamese, Persian'), - suffixIcon: Icons.pets_outlined, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 80, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: CustomInputUtil( - controller: _model.textControllerColor, - validator: _model.textControllerColorValidator.asValidator(context), - focusNode: _model.textFieldFocusColor, - 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'), - suffixIcon: Symbols.palette, - haveMaxLength: true, - onChanged: (value) => setState(() {}), - maxLength: 80, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - SizedBox( - width: MediaQuery.of(context).size.width, - height: 60.0, - child: Stack( - children: [ - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textControllerData, - focusNode: _model.textFieldFocusData, - cursorColor: FlutterFlowTheme.of(context).primary, - readOnly: true, - autovalidateMode: AutovalidateMode.onUserInteraction, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - isDense: true, - labelStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 20), + child: MediaUploadButtonUtil( + onUploadComplete: _model.handleUploadComplete, + isUploading: _model.isDataUploading, + uploadedFiles: _model.uploadedLocalFile, + labelText: FFLocalizations.of(context).getVariableText( + ptText: 'Clique para adicionar a foto de seu Pet', + enText: 'Click to add your Pet\'s photo'), + ), + ), + CustomInputUtil( + controller: _model.textControllerName, + validator: _model.textControllerNameValidator + .asValidator(context), + focusNode: _model.textFieldFocusName, + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Nome', enText: 'Name'), + hintText: FFLocalizations.of(context) + .getVariableText(ptText: 'Nome', enText: 'Name'), + suffixIcon: Symbols.format_color_text, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 80, + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: CustomInputUtil( + controller: _model.textControllerSpecies, + validator: _model.textControllerSpeciesValidator + .asValidator(context), + focusNode: _model.textFieldFocusSpecies, + labelText: FFLocalizations.of(context).getVariableText( + ptText: 'Espécie', enText: 'Species'), + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Ex: Cachorro, Gato, Papagaio', + enText: 'e.g. Dog, Cat, Parrot'), + suffixIcon: Symbols.sound_detection_dog_barking, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 80, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: CustomInputUtil( + controller: _model.textControllerRace, + validator: _model.textControllerRaceValidator + .asValidator(context), + focusNode: _model.textFieldFocusRace, + labelText: FFLocalizations.of(context) + .getVariableText(ptText: 'Raça', enText: 'Race'), + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Ex: Labrador, Poodle, Siamês, Persa', + enText: 'e.g. Labrador, Poodle, Siamese, Persian'), + suffixIcon: Icons.pets_outlined, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 80, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: CustomInputUtil( + controller: _model.textControllerColor, + validator: _model.textControllerColorValidator + .asValidator(context), + focusNode: _model.textFieldFocusColor, + 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'), + suffixIcon: Symbols.palette, + haveMaxLength: true, + onChanged: (value) => setState(() {}), + maxLength: 80, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + width: MediaQuery.of(context).size.width, + height: 60.0, + child: Stack( + children: [ + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textControllerData, + focusNode: _model.textFieldFocusData, + cursorColor: + FlutterFlowTheme.of(context).primary, + readOnly: true, + autovalidateMode: + AutovalidateMode.onUserInteraction, + autofocus: false, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + hintText: FFLocalizations.of(context) + .getVariableText( + ptText: 'Data de Nascimento', + enText: 'Date of Birth', ), - hintText: FFLocalizations.of(context).getVariableText( - ptText: 'Data de Nascimento', - enText: 'Date of Birth', - ), - hintStyle: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).labelMediumFamily), - lineHeight: 1.0, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + lineHeight: 1.0, + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .customColor6, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .primary, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.date_range, + color: FlutterFlowTheme.of(context) + .accent1, ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).customColor6, - width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.date_range, - color: FlutterFlowTheme.of(context).accent1, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + lineHeight: 1.8, + ), + textAlign: TextAlign.start, + validator: _model + .textControllerDataValidator + .asValidator(context), ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - lineHeight: 1.8, - ), - textAlign: TextAlign.start, - validator: _model.textControllerDataValidator.asValidator(context), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - final pickedDate = await showDatePicker( - context: context, - initialDate: DateFormat('dd/MM/yyyy').tryParse(_model.textControllerData.text), - firstDate: DateTime(1990), - lastDate: DateTime.now(), - builder: (context, child) { - return wrapInMaterialDatePickerTheme( - context, - child!, - headerBackgroundColor: FlutterFlowTheme.of(context).primary, - headerForegroundColor: FlutterFlowTheme.of(context).info, - headerTextStyle: FlutterFlowTheme.of(context).headlineLarge.override( - fontFamily: FlutterFlowTheme.of(context).headlineLargeFamily, - fontSize: 32.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).headlineLargeFamily), - ), - pickerBackgroundColor: FlutterFlowTheme.of(context).primaryBackground, - pickerForegroundColor: FlutterFlowTheme.of(context).primaryText, - selectedDateTimeBackgroundColor: FlutterFlowTheme.of(context).primary, - selectedDateTimeForegroundColor: FlutterFlowTheme.of(context).info, - actionButtonForegroundColor: FlutterFlowTheme.of(context).primaryText, - iconSize: 24.0, + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + final pickedDate = await showDatePicker( + context: context, + initialDate: DateFormat('dd/MM/yyyy') + .tryParse( + _model.textControllerData.text), + firstDate: DateTime(1990), + lastDate: DateTime.now(), + builder: (context, child) { + return wrapInMaterialDatePickerTheme( + context, + child!, + headerBackgroundColor: + FlutterFlowTheme.of(context) + .primary, + headerForegroundColor: + FlutterFlowTheme.of(context) + .info, + headerTextStyle: + FlutterFlowTheme.of(context) + .headlineLarge + .override( + fontFamily: FlutterFlowTheme + .of(context) + .headlineLargeFamily, + fontSize: 32.0, + letterSpacing: 0.0, + fontWeight: + FontWeight.w600, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .headlineLargeFamily), + ), + pickerBackgroundColor: + FlutterFlowTheme.of(context) + .primaryBackground, + pickerForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of(context) + .primary, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of(context) + .info, + actionButtonForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + iconSize: 24.0, + ); + }, ); + + if (pickedDate != null) { + setState(() { + _model.selectedDate = DateTime( + pickedDate.year, + pickedDate.month, + pickedDate.day, + ); + + _model.textControllerData = + TextEditingController( + text: dateTimeFormat( + 'dd/MM/yyyy', + _model.selectedDate, + locale: FFLocalizations.of(context) + .languageCode, + )); + _model.textControllerData?.selection = + TextSelection.collapsed( + offset: _model.textControllerData! + .text.length, + ); + }); + } }, - ); - - if (pickedDate != null) { - setState(() { - _model.selectedDate = DateTime( - pickedDate.year, - pickedDate.month, - pickedDate.day, - ); - - _model.textControllerData = TextEditingController( - text: dateTimeFormat( - 'dd/MM/yyyy', - _model.selectedDate, - locale: FFLocalizations.of(context).languageCode, - )); - _model.textControllerData?.selection = TextSelection.collapsed( - offset: _model.textControllerData!.text.length, - ); - }); - } - }, - child: Container( - width: double.infinity, - height: 80.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), + child: Container( + width: double.infinity, + height: 80.0, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(10.0), + ), + ), ), ), - ), + ], ), - ], + ), + ], + ), + ), + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0, 0.0, 15), + child: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Selecione as opções disponíveis', + enText: 'Select the available options', + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.w600, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), ), ), - ], - ), - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0, 0.0, 15), - child: Text( - FFLocalizations.of(context).getVariableText( - ptText: 'Selecione as opções disponíveis', - enText: 'Select the available options', - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context).bodySmall.override( - fontFamily: FlutterFlowTheme.of(context).bodySmallFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - ), ), - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: CustomSelect( - options: const ['MAC', 'FEM'], - controller: _model.dropDownValueController1 ??= - FormFieldController(_model.dropDownValue1 ??= ''), - isRequired: true, - changed: (val) => safeSetState(() { - _model.dropDownValue1 = val; - }), - dropDownValue: _model.dropDownValue1, - optionsLabel: [ - FFLocalizations.of(context).getVariableText(ptText: 'Macho', enText: 'Male'), - FFLocalizations.of(context).getVariableText(ptText: 'Fêmea', enText: 'Female') - ], + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: CustomSelect( + options: const ['MAC', 'FEM'], + controller: _model.dropDownValueController1 ??= + FormFieldController( + _model.dropDownValue1 ??= ''), + isRequired: true, + changed: (val) => safeSetState(() { + _model.dropDownValue1 = val; + }), + dropDownValue: _model.dropDownValue1, + optionsLabel: [ + FFLocalizations.of(context).getVariableText( + ptText: 'Macho', enText: 'Male'), + FFLocalizations.of(context).getVariableText( + ptText: 'Fêmea', enText: 'Female') + ], + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Selecione o gênero do Pet', + enText: 'Select the gender of the Pet')), + ), + Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), + child: CustomSelect( + options: const ['MIN', 'PEQ', 'MED', 'GRA', 'GIG'], + controller: _model.dropDownValueController2 ??= + FormFieldController( + _model.dropDownValue2 ??= ''), + isRequired: true, + changed: (val) => safeSetState(() { + _model.dropDownValue2 = val; + }), + dropDownValue: _model.dropDownValue1, + optionsLabel: [ + FFLocalizations.of(context).getVariableText( + ptText: 'Mini', enText: 'Mini'), + FFLocalizations.of(context).getVariableText( + ptText: 'Pequeno', enText: 'Small'), + FFLocalizations.of(context).getVariableText( + ptText: 'Médio', enText: 'Medium'), + FFLocalizations.of(context).getVariableText( + ptText: 'Grande', enText: 'Big'), + FFLocalizations.of(context).getVariableText( + ptText: 'Gigante', enText: 'Giant'), + ], + hintText: FFLocalizations.of(context).getVariableText( + ptText: 'Selecione o porte do Pet', + enText: 'Select the size of the Pet')), + ), + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0, 0.0, 15), + child: Text( + FFLocalizations.of(context).getVariableText( + ptText: + 'Você tem alguma observação sobre o seu Pet?', + enText: + 'Do you have any observations about your Pet?', + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.w600, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + CustomInputUtil( + controller: _model.textControllerObservation, + validator: _model.textControllerObservationValidator + .asValidator(context), + focusNode: _model.textFieldFocusObservation, + labelText: FFLocalizations.of(context).getVariableText( + ptText: 'Escreva as suas observações aqui...', + enText: 'Write your observations here...'), hintText: FFLocalizations.of(context).getVariableText( - ptText: 'Selecione o gênero do Pet', enText: 'Select the gender of the Pet')), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 15), - child: CustomSelect( - options: const ['MIN', 'PEQ', 'MED', 'GRA', 'GIG'], - controller: _model.dropDownValueController2 ??= - FormFieldController(_model.dropDownValue2 ??= ''), - isRequired: true, - changed: (val) => safeSetState(() { - _model.dropDownValue2 = val; - }), - dropDownValue: _model.dropDownValue1, - optionsLabel: [ - FFLocalizations.of(context).getVariableText(ptText: 'Mini', enText: 'Mini'), - FFLocalizations.of(context).getVariableText(ptText: 'Pequeno', enText: 'Small'), - FFLocalizations.of(context).getVariableText(ptText: 'Médio', enText: 'Medium'), - FFLocalizations.of(context).getVariableText(ptText: 'Grande', enText: 'Big'), - FFLocalizations.of(context).getVariableText(ptText: 'Gigante', enText: 'Giant'), - ], - hintText: FFLocalizations.of(context) - .getVariableText(ptText: 'Selecione o porte do Pet', enText: 'Select the size of the Pet')), - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0, 0.0, 15), - child: Text( - FFLocalizations.of(context).getVariableText( - ptText: 'Você tem alguma observação sobre o seu Pet?', - enText: 'Do you have any observations about your Pet?', - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context).bodySmall.override( - fontFamily: FlutterFlowTheme.of(context).bodySmallFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - ), + ptText: 'Escreva as suas observações aqui...', + enText: 'Write your observations here...'), + suffixIcon: Icons.text_fields, + haveMaxLength: true, + maxLength: 250, + onChanged: (value) => setState(() {}), ), - ), - ), - CustomInputUtil( - controller: _model.textControllerObservation, - validator: _model.textControllerObservationValidator.asValidator(context), - focusNode: _model.textFieldFocusObservation, - labelText: FFLocalizations.of(context).getVariableText( - ptText: 'Escreva as suas observações aqui...', enText: 'Write your observations here...'), - hintText: FFLocalizations.of(context).getVariableText( - ptText: 'Escreva as suas observações aqui...', enText: 'Write your observations here...'), - suffixIcon: Icons.text_fields, - haveMaxLength: true, - maxLength: 250, - onChanged: (value) => setState(() {}), - ), - Padding( - padding: const EdgeInsets.fromLTRB(70, 20, 70, 30), - child: SubmitButtonUtil( - labelText: FFLocalizations.of(context).getVariableText(ptText: 'Salvar', enText: 'Save'), - onPressed: _model.isFormValid(context) ? _model.updatePet : null), - ), - ])), + Padding( + padding: const EdgeInsets.fromLTRB(70, 20, 70, 30), + child: SubmitButtonUtil( + labelText: FFLocalizations.of(context) + .getVariableText( + ptText: 'Salvar', enText: 'Save'), + onPressed: _model.isFormValid(context) + ? _model.updatePet + : null), + ), + ])), ], ), ); diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index 6f52a602..a4f59ed2 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -24,11 +24,17 @@ class PreferencesPageModel with ChangeNotifier { late bool isPanic = false; Future _initialize() async { - isFingerprint = await StorageHelper().get(KeychainStorageKey.fingerprint.value) == 'true'; - isPerson = await StorageHelper().get(KeychainStorageKey.person.value) == 'true'; - isNotify = await StorageHelper().get(KeychainStorageKey.notify.value) == 'true'; - isAccess = await StorageHelper().get(KeychainStorageKey.access.value) == 'true'; - isPanic = await StorageHelper().get(KeychainStorageKey.panic.value) == 'true'; + isFingerprint = + await StorageHelper().get(KeychainStorageKey.fingerprint.value) == + 'true'; + isPerson = + await StorageHelper().get(KeychainStorageKey.person.value) == 'true'; + isNotify = + await StorageHelper().get(KeychainStorageKey.notify.value) == 'true'; + isAccess = + await StorageHelper().get(KeychainStorageKey.access.value) == 'true'; + isPanic = + await StorageHelper().get(KeychainStorageKey.panic.value) == 'true'; notifyListeners(); } @@ -37,7 +43,8 @@ class PreferencesPageModel with ChangeNotifier { } Future enablePerson(BuildContext context) async { - final String userDevUUID = (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? ''; + final String userDevUUID = + (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? ''; notifyListeners(); Share.share( FFLocalizations.of(context).getVariableText( @@ -64,7 +71,8 @@ class PreferencesPageModel with ChangeNotifier { .call(notifica: value) .then((value) async { if (value.jsonBody['error'] == false) { - await StorageHelper().set(KeychainStorageKey.notify.value, isNotify ? 'false' : 'true'); + await StorageHelper().set( + KeychainStorageKey.notify.value, isNotify ? 'false' : 'true'); content = FFLocalizations.of(context).getVariableText( enText: 'Notification changed successfully', ptText: 'Notificação alterada com sucesso', @@ -86,7 +94,9 @@ class PreferencesPageModel with ChangeNotifier { ); SnackBarUtil.showSnackBar(context, content, isError: true); }) - .then((_) async => isNotify = await StorageHelper().get(KeychainStorageKey.notify.value) == 'true') + .then((_) async => isNotify = + await StorageHelper().get(KeychainStorageKey.notify.value) == + 'true') .whenComplete(() => notifyListeners()); context.pop(); } @@ -109,7 +119,8 @@ class PreferencesPageModel with ChangeNotifier { if (value.jsonBody['error'] == false) { notifyListeners(); content = FFLocalizations.of(context).getVariableText( - ptText: 'Atualização do identificador de acesso realizada com sucesso', + ptText: + 'Atualização do identificador de acesso realizada com sucesso', enText: 'Access identifier updated successfully', ); SnackBarUtil.showSnackBar(context, content); @@ -141,7 +152,8 @@ class PreferencesPageModel with ChangeNotifier { .then((value) async { final String content; if (jsonDecode(value.jsonBody['error'].toString()) == false) { - await StorageHelper().set(KeychainStorageKey.access.value, isAccess ? 'false' : 'true'); + await StorageHelper().set( + KeychainStorageKey.access.value, isAccess ? 'false' : 'true'); notifyListeners(); content = FFLocalizations.of(context).getVariableText( enText: 'Access pass changed successfully', @@ -163,7 +175,9 @@ class PreferencesPageModel with ChangeNotifier { ); SnackBarUtil.showSnackBar(context, content, isError: true); }) - .then((_) async => isAccess = await StorageHelper().get(KeychainStorageKey.access.value) == 'true') + .then((_) async => isAccess = + await StorageHelper().get(KeychainStorageKey.access.value) == + 'true') .whenComplete(() => notifyListeners()); } @@ -178,7 +192,8 @@ class PreferencesPageModel with ChangeNotifier { .then((value) async { final String content; if (jsonDecode(value.jsonBody['error'].toString()) == false) { - await StorageHelper().set(KeychainStorageKey.panic.value, isPanic ? 'false' : 'true'); + await StorageHelper().set( + KeychainStorageKey.panic.value, isPanic ? 'false' : 'true'); notifyListeners(); content = FFLocalizations.of(context).getVariableText( enText: 'Panic password changed successfully', @@ -200,7 +215,9 @@ class PreferencesPageModel with ChangeNotifier { ); SnackBarUtil.showSnackBar(context, content, isError: true); }) - .then((_) async => isPanic = await StorageHelper().get(KeychainStorageKey.panic.value) == 'true') + .then((_) async => isPanic = + await StorageHelper().get(KeychainStorageKey.panic.value) == + 'true') .whenComplete(() => notifyListeners()); } @@ -215,11 +232,15 @@ class PreferencesPageModel with ChangeNotifier { onChange(String? key) async { isFingerprint = !isFingerprint; - await StorageHelper().set(SecureStorageKey.fingerprintPass.value, key ?? ''); - await StorageHelper().set(KeychainStorageKey.fingerprint.value, isFingerprint ? 'true' : 'false'); + await StorageHelper() + .set(SecureStorageKey.fingerprintPass.value, key ?? ''); + await StorageHelper().set(KeychainStorageKey.fingerprint.value, + isFingerprint ? 'true' : 'false'); notifyListeners(); SnackBarUtil.showSnackBar(context, content); - isFingerprint = await StorageHelper().get(KeychainStorageKey.fingerprint.value) == 'true'; + isFingerprint = + await StorageHelper().get(KeychainStorageKey.fingerprint.value) == + 'true'; } isFingerprint ? onChange(null) : _showPassKey(context, onChange); @@ -257,7 +278,8 @@ class PreferencesPageModel with ChangeNotifier { showAlertDialog(context, title, content, onConfirm); } - void _showPassKey(BuildContext context, void Function(String) onChange) async { + void _showPassKey( + BuildContext context, void Function(String) onChange) async { await showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent, diff --git a/lib/pages/preferences_settings_page/preferences_settings_widget.dart b/lib/pages/preferences_settings_page/preferences_settings_widget.dart index 227c953d..7cf47f3b 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_widget.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_widget.dart @@ -29,7 +29,9 @@ class _PreferencesPageWidgetState extends State { create: (_) => PreferencesPageModel(), child: Consumer( builder: (context, model, child) => GestureDetector( - onTap: () => model.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(model.unfocusNode) : FocusScope.of(context).unfocus(), + onTap: () => model.unfocusNode.canRequestFocus + ? FocusScope.of(context).requestFocus(model.unfocusNode) + : FocusScope.of(context).unfocus(), child: Scaffold( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, appBar: AppBar( @@ -91,7 +93,8 @@ class _PreferencesPageWidgetState extends State { ); } - Widget _buildIconButton(BuildContext context, int index, PreferencesPageModel model) { + Widget _buildIconButton( + BuildContext context, int index, PreferencesPageModel model) { IconData icon; Function() onPressed = () => {}; bool isEnabled; @@ -203,10 +206,14 @@ class _PreferencesPageWidgetState extends State { child: Row( children: [ CircleAvatar( - backgroundColor: isEnabled ? FlutterFlowTheme.of(context).primary : FlutterFlowTheme.of(context).alternate, + backgroundColor: isEnabled + ? FlutterFlowTheme.of(context).primary + : FlutterFlowTheme.of(context).alternate, child: Icon( icon, - color: isEnabled ? FlutterFlowTheme.of(context).primaryBackground : FlutterFlowTheme.of(context).primary, + color: isEnabled + ? FlutterFlowTheme.of(context).primaryBackground + : FlutterFlowTheme.of(context).primary, ), ), const SizedBox(width: 8.0), diff --git a/lib/pages/provisional_schedule_page/provisional_schedule_widget.dart b/lib/pages/provisional_schedule_page/provisional_schedule_widget.dart index 96d35366..022822ed 100644 --- a/lib/pages/provisional_schedule_page/provisional_schedule_widget.dart +++ b/lib/pages/provisional_schedule_page/provisional_schedule_widget.dart @@ -67,6 +67,7 @@ class _ProvisionalScheduleState extends State { centerTitle: true, elevation: 0.0, ), - body: const SafeArea(top: true, child: ScheduleProvisionalVisitPageWidget())); + body: const SafeArea( + top: true, child: ScheduleProvisionalVisitPageWidget())); } } diff --git a/lib/pages/qr_code_page/qr_code_page_model.dart b/lib/pages/qr_code_page/qr_code_page_model.dart index 41df6e77..aeef5eaf 100644 --- a/lib/pages/qr_code_page/qr_code_page_model.dart +++ b/lib/pages/qr_code_page/qr_code_page_model.dart @@ -29,8 +29,11 @@ class QrCodePageModel extends FlutterFlowModel { } Future initVariable() async { - isFingerprint = await StorageHelper().get(KeychainStorageKey.fingerprint.value) == 'true'; - userDevUUID = await StorageHelper().get(KeychainStorageKey.userDevUUID.value) ?? ''; + isFingerprint = + await StorageHelper().get(KeychainStorageKey.fingerprint.value) == + 'true'; + userDevUUID = + await StorageHelper().get(KeychainStorageKey.userDevUUID.value) ?? ''; safeSetState?.call(); } @@ -39,7 +42,8 @@ class QrCodePageModel extends FlutterFlowModel { unfocusNode.dispose(); } - Uint8List assembleQRPacket(int direction, String identifier, String password) { + Uint8List assembleQRPacket( + int direction, String identifier, String password) { List packet = [direction]; String paddedBadge = identifier.padLeft(30, '0'); @@ -57,7 +61,8 @@ class QrCodePageModel extends FlutterFlowModel { int sum = year + month + day + hour + minute; - if (sum == int.parse('0D', radix: 16) || sum == int.parse('0A', radix: 16)) { + if (sum == int.parse('0D', radix: 16) || + sum == int.parse('0A', radix: 16)) { packet.add(int.parse('FF', radix: 16)); } else { packet.add(sum); @@ -75,7 +80,8 @@ class QrCodePageModel extends FlutterFlowModel { check ^= b; } - if (check == int.parse('0D', radix: 16) || check == int.parse('0A', radix: 16)) { + if (check == int.parse('0D', radix: 16) || + check == int.parse('0A', radix: 16)) { packet.add(int.parse('FF', radix: 16)); } else { packet.add(check); @@ -88,13 +94,16 @@ class QrCodePageModel extends FlutterFlowModel { int len = s.length; Uint8List data = Uint8List(len ~/ 2); for (int i = 0; i < len; i += 2) { - data[i ~/ 2] = ((int.parse(s[i], radix: 16) << 4) + int.parse(s[i + 1], radix: 16)); + data[i ~/ 2] = + ((int.parse(s[i], radix: 16) << 4) + int.parse(s[i + 1], radix: 16)); } return data; } String byteToHexa(Uint8List pDados) { - return pDados.map((byte) => byte.toRadixString(16).padLeft(2, '0').toUpperCase()).join(); + return pDados + .map((byte) => byte.toRadixString(16).padLeft(2, '0').toUpperCase()) + .join(); } Future byteToString(Uint8List bytes) async { @@ -112,7 +121,8 @@ class QrCodePageModel extends FlutterFlowModel { const Color foregroundColor = Colors.black; return QrImageView.withQr( qr: QrCode.fromUint8List( - data: assembleQRPacket(direction, identifier, pass), errorCorrectLevel: errorCorrectLevel), + data: assembleQRPacket(direction, identifier, pass), + errorCorrectLevel: errorCorrectLevel), size: dimension, padding: const EdgeInsets.all(10), backgroundColor: backgroundColor, diff --git a/lib/pages/qr_code_page/qr_code_page_widget.dart b/lib/pages/qr_code_page/qr_code_page_widget.dart index 6aad1599..4d486828 100644 --- a/lib/pages/qr_code_page/qr_code_page_widget.dart +++ b/lib/pages/qr_code_page/qr_code_page_widget.dart @@ -33,7 +33,8 @@ class QrCodePageWidget extends StatefulWidget { State createState() => _QrCodePageWidgetState(); } -class _QrCodePageWidgetState extends State with TickerProviderStateMixin { +class _QrCodePageWidgetState extends State + with TickerProviderStateMixin { late QrCodePageModel _model; final scaffoldKey = GlobalKey(); @@ -69,7 +70,9 @@ class _QrCodePageWidgetState extends State with TickerProvider ), }); setupAnimations( - animationsMap.values.where((anim) => anim.trigger == AnimationTrigger.onActionTrigger || !anim.applyInitialState), + animationsMap.values.where((anim) => + anim.trigger == AnimationTrigger.onActionTrigger || + !anim.applyInitialState), this, ); } @@ -78,7 +81,9 @@ class _QrCodePageWidgetState extends State with TickerProvider void dispose() { // Removendo o ouvinte antes de chamar super.dispose para evitar vazamentos de memória if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { - animationsMap['barcodeOnActionTriggerAnimation']!.controller.removeStatusListener((status) {}); + animationsMap['barcodeOnActionTriggerAnimation']! + .controller + .removeStatusListener((status) {}); } super.dispose(); @@ -97,10 +102,12 @@ class _QrCodePageWidgetState extends State with TickerProvider Widget buildBody(BuildContext context) { double screenWidth = MediaQuery.of(context).size.width; double screenHeight = MediaQuery.of(context).size.height; - double smallerDimension = screenWidth < screenHeight ? screenWidth : screenHeight; + double smallerDimension = + screenWidth < screenHeight ? screenWidth : screenHeight; double dimension = smallerDimension * 0.75; double totalTimeInSeconds = 100.0; - double limitedHeaderTextSize = LimitedFontSizeUtil.getCalculateFontSize(context, 18, 18, 16); + double limitedHeaderTextSize = + LimitedFontSizeUtil.getCalculateFontSize(context, 18, 18, 16); double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); return SafeArea( @@ -121,12 +128,13 @@ class _QrCodePageWidgetState extends State with TickerProvider ), textAlign: TextAlign.center, style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, fontSize: limitedHeaderTextSize, letterSpacing: 0.0, fontWeight: FontWeight.bold, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), ), ), ), @@ -206,16 +214,26 @@ class _QrCodePageWidgetState extends State with TickerProvider ), options: FFButtonOptions( height: 40.0, - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.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: FlutterFlowTheme.of(context).titleSmallFamily, + textStyle: FlutterFlowTheme.of(context) + .titleSmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .titleSmallFamily, color: Colors.white, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).titleSmallFamily), - fontSize: LimitedFontSizeUtil.getCalculateFontSize(context, 12, 12, 10), + .containsKey( + FlutterFlowTheme.of(context) + .titleSmallFamily), + fontSize: LimitedFontSizeUtil + .getCalculateFontSize( + context, 12, 12, 10), ), elevation: 3.0, borderSide: const BorderSide( @@ -241,16 +259,20 @@ class _QrCodePageWidgetState extends State with TickerProvider visible: _model.isAccess == true, child: Text( FFLocalizations.of(context).getVariableText( - ptText: 'Certifique-se de que o QRCode está visivel para o leitor', - enText: 'Make sure the QRCode is visible to the reader', + ptText: + 'Certifique-se de que o QRCode está visivel para o leitor', + enText: + 'Make sure the QRCode is visible to the reader', // '6z6kvmhl' /* Certifique-se de que o QRCode ... */, ), textAlign: TextAlign.center, style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + 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: limitedBodyFontSize, ), ), @@ -274,7 +296,8 @@ class _QrCodePageWidgetState extends State with TickerProvider children: [ Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 10.0, 0.0, 0.0, 0.0), child: Text( FFLocalizations.of(context).getVariableText( ptText: 'Expirando QR code em', @@ -282,13 +305,20 @@ class _QrCodePageWidgetState extends State with TickerProvider // 'wkjkxd2e' /* Trocando QR code em */, ), textAlign: TextAlign.center, - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, letterSpacing: 0.0, fontWeight: FontWeight.w600, - useGoogleFonts: - GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), - fontSize: LimitedFontSizeUtil.getNoResizeFont(context, 14), + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + fontSize: + LimitedFontSizeUtil.getNoResizeFont( + context, 14), ), ), ), @@ -296,11 +326,13 @@ class _QrCodePageWidgetState extends State with TickerProvider Align( alignment: const AlignmentDirectional(0.0, 0.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 20.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 20.0, 0.0), child: StreamBuilder( stream: getProgressValue(), builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { + if (snapshot.connectionState == + ConnectionState.waiting) { return const CircularProgressIndicator(); } else if (snapshot.hasError) { return Text('Error: ${snapshot.error}'); @@ -319,16 +351,26 @@ class _QrCodePageWidgetState extends State with TickerProvider onAnimationEnd: () { _resetAnimationAndToggleAccess(); }, - progressColor: FlutterFlowTheme.of(context).primary, - backgroundColor: FlutterFlowTheme.of(context).primaryText, + progressColor: + FlutterFlowTheme.of(context).primary, + backgroundColor: + FlutterFlowTheme.of(context) + .primaryText, center: Text( '${(progress * totalTimeInSeconds / 5).toStringAsFixed(1)}s', - style: FlutterFlowTheme.of(context).headlineSmall.override( - fontFamily: FlutterFlowTheme.of(context).headlineSmallFamily, - fontSize: LimitedFontSizeUtil.getNoResizeFont(context, 14), + style: FlutterFlowTheme.of(context) + .headlineSmall + .override( + fontFamily: + FlutterFlowTheme.of(context) + .headlineSmallFamily, + fontSize: LimitedFontSizeUtil + .getNoResizeFont(context, 14), letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).headlineSmallFamily), + .containsKey( + FlutterFlowTheme.of(context) + .headlineSmallFamily), ), ), startAngle: 20.0, @@ -351,14 +393,21 @@ class _QrCodePageWidgetState extends State with TickerProvider Future _showBiometricsAuth(BuildContext context) async { await BiometricHelper.checkBiometrics() - .then((value) async => await BiometricHelper.authenticateBiometric().then((value) async { - if (value == false) throw Exception('Biometric authentication failed'); - final key = await StorageHelper().get(SecureStorageKey.fingerprintPass.value); + .then((value) async => + await BiometricHelper.authenticateBiometric().then((value) async { + if (value == false) + throw Exception('Biometric authentication failed'); + final key = await StorageHelper() + .get(SecureStorageKey.fingerprintPass.value); if (key == null || key.isEmpty) throw Exception('No key found'); safeSetState(() { if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { - animationsMap['barcodeOnActionTriggerAnimation']!.controller.stop(); - animationsMap['barcodeOnActionTriggerAnimation']!.controller.reverse(); + animationsMap['barcodeOnActionTriggerAnimation']! + .controller + .stop(); + animationsMap['barcodeOnActionTriggerAnimation']! + .controller + .reverse(); } _model.isAccess = !_model.isAccess; _model.key = key; @@ -386,9 +435,14 @@ class _QrCodePageWidgetState extends State with TickerProvider child: QrCodePassKeyTemplateComponentWidget( toggleActionStatus: (key) async { safeSetState(() { - if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { - animationsMap['barcodeOnActionTriggerAnimation']!.controller.stop(); - animationsMap['barcodeOnActionTriggerAnimation']!.controller.reverse(); + if (animationsMap['barcodeOnActionTriggerAnimation'] != + null) { + animationsMap['barcodeOnActionTriggerAnimation']! + .controller + .stop(); + animationsMap['barcodeOnActionTriggerAnimation']! + .controller + .reverse(); } _model.isAccess = !_model.isAccess; _model.key = key; @@ -398,7 +452,8 @@ class _QrCodePageWidgetState extends State with TickerProvider ), ); }, - ).catchError((error) => safeSetState(() => _resetAnimationAndToggleAccess())); + ).catchError( + (error) => safeSetState(() => _resetAnimationAndToggleAccess())); unawaited( () async { await _model.qrCodeEncoder(context, key: _model.key); @@ -442,7 +497,8 @@ class _QrCodePageWidgetState extends State with TickerProvider fontSize: 15.0, fontWeight: FontWeight.bold, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).headlineMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).headlineMediumFamily), ), ), actions: const [], diff --git a/lib/pages/reception_page/reception_page_model.dart b/lib/pages/reception_page/reception_page_model.dart index 239f675a..553935c9 100644 --- a/lib/pages/reception_page/reception_page_model.dart +++ b/lib/pages/reception_page/reception_page_model.dart @@ -6,7 +6,8 @@ import 'package:share_plus/share_plus.dart'; class ReceptionPageModel with ChangeNotifier { Future getIdenfifier(BuildContext context) async { - final String userDevUUID = (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? ''; + final String userDevUUID = + (await StorageHelper().get(KeychainStorageKey.userDevUUID.value)) ?? ''; notifyListeners(); Share.share( diff --git a/lib/pages/reception_page/reception_page_widget.dart b/lib/pages/reception_page/reception_page_widget.dart index a29e194b..ea627ad7 100644 --- a/lib/pages/reception_page/reception_page_widget.dart +++ b/lib/pages/reception_page/reception_page_widget.dart @@ -23,7 +23,8 @@ class ReceptionPageWidget extends StatefulWidget { State createState() => _ReceptionPageWidgetState(); } -class _ReceptionPageWidgetState extends State with WidgetsBindingObserver { +class _ReceptionPageWidgetState extends State + with WidgetsBindingObserver { @override void initState() { super.initState(); @@ -53,7 +54,8 @@ class _ReceptionPageWidgetState extends State with WidgetsB @override Widget build(BuildContext context) { - double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context); + double limitedHeaderFontSize = + LimitedFontSizeUtil.getHeaderFontSize(context); double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context); @@ -73,34 +75,46 @@ class _ReceptionPageWidgetState extends State with WidgetsB Padding( padding: const EdgeInsets.fromLTRB(45, 20, 45, 15.0), child: Text( - FFLocalizations.of(context) - .getVariableText(ptText: 'Falta pouco para você utilizar o FRE Access Hub...', enText: 'You are close to using the FRE Access Hub...'), + FFLocalizations.of(context).getVariableText( + ptText: + 'Falta pouco para você utilizar o FRE Access Hub...', + enText: + 'You are close to using the FRE Access Hub...'), textAlign: TextAlign.center, - style: FlutterFlowTheme.of(context).displayLarge.override( + style: FlutterFlowTheme.of(context) + .displayLarge + .override( fontFamily: 'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).accent1, fontSize: limitedHeaderFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w700, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), ), ), - const AtomImageSvgTheme(filename: 'reception', width: 180, height: 180), + const AtomImageSvgTheme( + filename: 'reception', width: 180, height: 180), Padding( padding: const EdgeInsets.fromLTRB(70, 30, 70.0, 40), child: Text( FFLocalizations.of(context).getVariableText( - ptText: 'Envie seu identificador para seu condomínio para vincularem sua conta aos nossos sistemas.', - enText: 'Send your identifier to your condominium to link your account to our systems.'), + ptText: + 'Envie seu identificador para seu condomínio para vincularem sua conta aos nossos sistemas.', + enText: + 'Send your identifier to your condominium to link your account to our systems.'), textAlign: TextAlign.center, - style: FlutterFlowTheme.of(context).displaySmall.override( + style: FlutterFlowTheme.of(context) + .displaySmall + .override( fontFamily: 'Nunito Sans', color: FlutterFlowTheme.of(context).primaryText, fontSize: limitedBodyFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), ), ), @@ -111,32 +125,48 @@ class _ReceptionPageWidgetState extends State with WidgetsB Padding( padding: const EdgeInsets.fromLTRB(60, 0, 60, 10), child: Tooltip( - message: FFLocalizations.of(context) - .getVariableText(ptText: 'Seu identificador é utilizado para efetuar\no vínculo do seu APP com o condominio.', enText: 'My Identifier'), - textStyle: FlutterFlowTheme.of(context).labelSmall.override( + message: FFLocalizations.of(context).getVariableText( + ptText: + 'Seu identificador é utilizado para efetuar\no vínculo do seu APP com o condominio.', + enText: 'My Identifier'), + textStyle: FlutterFlowTheme.of(context) + .labelSmall + .override( fontFamily: 'Nunito Sans', - color: FlutterFlowTheme.of(context).secondaryText, + color: FlutterFlowTheme.of(context) + .secondaryText, fontSize: limitedInputFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), child: FFButtonWidget( onPressed: () => model.getIdenfifier(context), - text: FFLocalizations.of(context).getVariableText(ptText: 'Meu Identificador', enText: 'My Identifier'), + text: FFLocalizations.of(context) + .getVariableText( + ptText: 'Meu Identificador', + enText: 'My Identifier'), options: FFButtonOptions( width: double.infinity, height: 30, - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), - iconPadding: 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( + textStyle: FlutterFlowTheme.of(context) + .titleSmall + .override( fontFamily: 'Nunito Sans', - color: FlutterFlowTheme.of(context).info, + color: + FlutterFlowTheme.of(context).info, fontSize: limitedInputFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), elevation: 3.0, borderSide: const BorderSide( @@ -157,20 +187,29 @@ class _ReceptionPageWidgetState extends State with WidgetsB AuthenticationService.signOut(context); setState(() {}); }, - text: FFLocalizations.of(context).getVariableText(ptText: 'Sair da Conta', enText: 'Logout'), + text: FFLocalizations.of(context).getVariableText( + ptText: 'Sair da Conta', enText: 'Logout'), options: FFButtonOptions( width: double.infinity, height: 30, - 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( + 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: 'Nunito Sans', - color: FlutterFlowTheme.of(context).primaryBackground, + color: FlutterFlowTheme.of(context) + .primaryBackground, fontSize: limitedInputFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), ), elevation: 3.0, borderSide: const BorderSide( diff --git a/lib/pages/register_visitor_page/register_visitor_page_model.dart b/lib/pages/register_visitor_page/register_visitor_page_model.dart index e6db1afb..9c813fc5 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_model.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_model.dart @@ -4,10 +4,12 @@ import '/flutter_flow/flutter_flow_util.dart'; import 'register_visitor_page_widget.dart' show RegisterVisitorPageWidget; import 'package:flutter/material.dart'; -class RegisterVisitorPageModel extends FlutterFlowModel { +class RegisterVisitorPageModel + extends FlutterFlowModel { /// State fields for stateful widgets in this page. - late RegisiterVistorTemplateComponentModel regisiterVistorTemplateComponentModel; + late RegisiterVistorTemplateComponentModel + regisiterVistorTemplateComponentModel; @override void initState(BuildContext context) {} diff --git a/lib/pages/register_visitor_page/register_visitor_page_widget.dart b/lib/pages/register_visitor_page/register_visitor_page_widget.dart index 50e11f96..483364bf 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_widget.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_widget.dart @@ -14,7 +14,8 @@ class RegisterVisitorPageWidget extends StatefulWidget { const RegisterVisitorPageWidget({super.key}); @override - State createState() => _RegisterVisitorPageWidgetState(); + State createState() => + _RegisterVisitorPageWidgetState(); } class _RegisterVisitorPageWidgetState extends State { @@ -65,7 +66,8 @@ class _RegisterVisitorPageWidgetState extends State { fontSize: 15.0, fontWeight: FontWeight.bold, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).headlineMediumFamily), + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).headlineMediumFamily), ), ), actions: const [], diff --git a/lib/pages/reservation_page/reservation_page_widget.dart b/lib/pages/reservation_page/reservation_page_widget.dart index 4d9091ac..6dbb8ea2 100644 --- a/lib/pages/reservation_page/reservation_page_widget.dart +++ b/lib/pages/reservation_page/reservation_page_widget.dart @@ -22,11 +22,16 @@ class _ReservationPageWidgetState extends State { late WebViewController _controllerAll; Future> initVariables() async { - final email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; - final name = (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? ''; - final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final clientId = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + final email = + (await StorageHelper().get(SecureStorageKey.email.value)) ?? ''; + final name = + (await StorageHelper().get(KeychainStorageKey.userName.value)) ?? ''; + final devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + final clientId = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; const createdAt = '0000-00-00 00:00:00'; final url = 'https://hub.freaccess.com.br/hub/reservation/$clientId'; final freUserData = @@ -52,10 +57,12 @@ class _ReservationPageWidgetState extends State { builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) { + } else if (snapshot.hasError || + !snapshot.hasData || + snapshot.data!.isEmpty) { return Center( - child: Text(FFLocalizations.of(context) - .getVariableText(enText: 'Unexpected error', ptText: 'Erro inesperado'))); + child: Text(FFLocalizations.of(context).getVariableText( + enText: 'Unexpected error', ptText: 'Erro inesperado'))); } else { final data = snapshot.data!; final url = data['url']!; @@ -80,9 +87,14 @@ class _ReservationPageWidgetState extends State { ), onWebViewCreated: (controller) async {}, onLoadStop: (controller, url) async { - await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-token', '\"$userUUID\"')"); - await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-user-data', '$freUserData')"); - await controller.evaluateJavascript(source: "window.localStorage.setItem('enableBackButton', 'true')"); + await controller.evaluateJavascript( + source: + "window.localStorage.setItem('fre-token', '\"$userUUID\"')"); + await controller.evaluateJavascript( + source: + "window.localStorage.setItem('fre-user-data', '$freUserData')"); + await controller.evaluateJavascript( + source: "window.localStorage.setItem('enableBackButton', 'true')"); }, onUpdateVisitedHistory: (controller, uri, isVisited) { if (uri.toString().contains('/hub/home')) context.pop(); @@ -100,16 +112,21 @@ class _ReservationPageWidgetState extends State { ..setNavigationDelegate( NavigationDelegate( onPageStarted: (String url) { - final String token = "localStorage.setItem('fre-token', '\"$userUUID\"');"; - final String data = "localStorage.setItem('fre-user-data', '$freUserData');"; - const String backNavigation = "localStorage.setItem('enableBackButton', 'true');"; + final String token = + "localStorage.setItem('fre-token', '\"$userUUID\"');"; + final String data = + "localStorage.setItem('fre-user-data', '$freUserData');"; + const String backNavigation = + "localStorage.setItem('enableBackButton', 'true');"; _controllerAll.runJavaScript(token); _controllerAll.runJavaScript(data); _controllerAll.runJavaScript(backNavigation); }, onPageFinished: (String url) { - bool isDarkMode = SchedulerBinding.instance.platformDispatcher.platformBrightness == Brightness.dark; + bool isDarkMode = SchedulerBinding + .instance.platformDispatcher.platformBrightness == + Brightness.dark; if (isDarkMode) { _controllerAll.runJavaScript(WebviewUtil.jsEnableDarkMode); diff --git a/lib/pages/residents_on_the_property/residents_on_the_property_model.dart b/lib/pages/residents_on_the_property/residents_on_the_property_model.dart index 4883ceb3..d3d1ff3e 100644 --- a/lib/pages/residents_on_the_property/residents_on_the_property_model.dart +++ b/lib/pages/residents_on_the_property/residents_on_the_property_model.dart @@ -4,7 +4,8 @@ import 'package:hub/pages/residents_on_the_property/residents_on_the_property_sc import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart'; -class ResidentsOnThePropertyModel extends FlutterFlowModel { +class ResidentsOnThePropertyModel + extends FlutterFlowModel { ResidentsOnThePropertyModel({this.onRefresh}); late final VoidCallback? onRefresh; @@ -18,8 +19,10 @@ class ResidentsOnThePropertyModel extends FlutterFlowModel _ResidentsOnThePropertyState(); } -class _ResidentsOnThePropertyState extends State with TickerProviderStateMixin { +class _ResidentsOnThePropertyState extends State + with TickerProviderStateMixin { late ScrollController _scrollController; int _pageNumber = 1; @@ -33,12 +34,16 @@ class _ResidentsOnThePropertyState extends State with Ti @override void initState() { super.initState(); - model = createModel(context, () => ResidentsOnThePropertyModel(onRefresh: () => safeSetState(() {}))); + model = createModel( + context, + () => + ResidentsOnThePropertyModel(onRefresh: () => safeSetState(() {}))); _future = _fetch(); _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMore(); } }); @@ -52,7 +57,8 @@ class _ResidentsOnThePropertyState extends State with Ti @override Widget build(BuildContext context) { - late final limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context); + late final limitedHeaderTextSize = + LimitedFontSizeUtil.getHeaderFontSize(context); return Scaffold( appBar: _appBar(context), @@ -129,7 +135,9 @@ class _ResidentsOnThePropertyState extends State with Ti return AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, automaticallyImplyLeading: false, - title: Text(FFLocalizations.of(context).getVariableText(ptText: 'Moradores', enText: 'Residents'), + title: Text( + FFLocalizations.of(context) + .getVariableText(ptText: 'Moradores', enText: 'Residents'), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, @@ -164,7 +172,8 @@ class _ResidentsOnThePropertyState extends State with Ti try { setState(() => _loading = true); - var response = await PhpGroup.getResidentsByProperty.call(_pageNumber.toString()); + var response = + await PhpGroup.getResidentsByProperty.call(_pageNumber.toString()); final List residents = response.jsonBody['residents'] ?? []; safeSetState(() => count = response.jsonBody['total_rows'] ?? 0); @@ -189,7 +198,8 @@ class _ResidentsOnThePropertyState extends State with Ti return null; } catch (e, s) { DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de moradores", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de moradores", e, s); setState(() { _hasData = false; _loading = false; @@ -227,19 +237,22 @@ class _ResidentsOnThePropertyState extends State with Ti Widget _item(BuildContext context, dynamic uItem) { return CardItemTemplateComponentWidget( - imagePath: 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${model.devUUID}&cliID=${model.cliUUID}&atividade=getFoto&Documento=${uItem['documento']}&tipo=Z', + imagePath: + 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${model.devUUID}&cliID=${model.cliUUID}&atividade=getFoto&Documento=${uItem['documento']}&tipo=Z', labelsHashMap: { - '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': uItem['nome'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': + uItem['nome'] ?? '', //statusweb - '${FFLocalizations.of(context).getVariableText(ptText: "Possui App", enText: "Has App")}:': uItem['statusweb'] == "A" - ? FFLocalizations.of(context).getVariableText( - ptText: 'Sim', - enText: 'Yes', - ) - : FFLocalizations.of(context).getVariableText( - ptText: 'Não', - enText: 'No', - ), + '${FFLocalizations.of(context).getVariableText(ptText: "Possui App", enText: "Has App")}:': + uItem['statusweb'] == "A" + ? FFLocalizations.of(context).getVariableText( + ptText: 'Sim', + enText: 'Yes', + ) + : FFLocalizations.of(context).getVariableText( + ptText: 'Não', + enText: 'No', + ), }, statusHashMap: [], onTapCardItemAction: () async {}, diff --git a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart index 1821c93b..66648ecf 100644 --- a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart +++ b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart @@ -17,7 +17,8 @@ import 'package:share_plus/share_plus.dart'; import '../../shared/utils/validator_util.dart'; -class ScheduleCompleteVisitPageModel extends FlutterFlowModel { +class ScheduleCompleteVisitPageModel + extends FlutterFlowModel { ScheduleCompleteVisitPageModel({this.safeSetState}); late VoidCallback? safeSetState; @@ -45,14 +46,16 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel requestFn: requestFn, ); void clearVisitHistoryCache() => _visitHistoryManager.clear(); - void clearVisitHistoryCacheKey(String? uniqueKey) => _visitHistoryManager.clearRequest(uniqueKey); + void clearVisitHistoryCacheKey(String? uniqueKey) => + _visitHistoryManager.clearRequest(uniqueKey); String convertDateFormat(String dateStr) { try { DateFormat originalFormat = DateFormat('dd/MM/yyyy HH:mm:ss'); DateFormat newFormat = DateFormat('y-M-d H:mm:ss'); - if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$').hasMatch(dateStr)) { + if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$') + .hasMatch(dateStr)) { return 'Invalid date format'; } @@ -67,8 +70,10 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item); void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item); - void removeAtIndexFromVisitorJsonList(int index) => visitorJsonList.removeAt(index); - void insertAtIndexInVisitorJsonList(int index, dynamic item) => visitorJsonList.insert(index, item); + void removeAtIndexFromVisitorJsonList(int index) => + visitorJsonList.removeAt(index); + void insertAtIndexInVisitorJsonList(int index, dynamic item) => + visitorJsonList.insert(index, item); void updateVisitorJsonListAtIndex(int index, Function(dynamic) updateFn) => visitorJsonList[index] = updateFn(visitorJsonList[index]); @@ -91,11 +96,14 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel DateTime selectedDateTime1; DateTime selectedDateTime2; - DateTime currentDateTime = DateTime.now().subtract(const Duration(minutes: 10)); + DateTime currentDateTime = + DateTime.now().subtract(const Duration(minutes: 10)); try { - selectedDateTime1 = DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController1.text); - selectedDateTime2 = DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController2.text); + selectedDateTime1 = + DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController1.text); + selectedDateTime2 = + DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController2.text); } catch (e) { return false; } @@ -117,7 +125,8 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel final unfocusNode = FocusNode(); TabController? tabBarController; - int get tabBarCurrentIndex => tabBarController != null ? tabBarController!.index : 0; + int get tabBarCurrentIndex => + tabBarController != null ? tabBarController!.index : 0; FocusNode? textFieldFocusNode1; TextEditingController? textController1; @@ -132,14 +141,16 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel if (val != '0') { try { DateTime startDate = DateFormat('dd/MM/yyyy HH:mm:ss').parse(val); - DateTime endDate = DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController2!.text); + DateTime endDate = + DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController2!.text); if (startDate.isAfter(endDate)) { return FFLocalizations.of(context).getVariableText( ptText: 'A data de início deve ser anterior à data de término.', enText: 'Start date must be before end date.', ); } - if (startDate.isBefore(DateTime.now().subtract(const Duration(minutes: 10)))) { + if (startDate + .isBefore(DateTime.now().subtract(const Duration(minutes: 10)))) { return FFLocalizations.of(context).getVariableText( enText: 'Start date must be after current date.', ptText: 'A data de início deve ser posterior à data atual.', @@ -174,7 +185,8 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel if (val != '0') { try { DateTime endDate = DateFormat('dd/MM/yyyy HH:mm:ss').parse(val); - DateTime startDate = DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController1!.text); + DateTime startDate = + DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController1!.text); if (endDate.isBefore(startDate)) { return FFLocalizations.of(context).getVariableText( @@ -182,7 +194,8 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel ptText: 'A data de término deve ser posterior à data de início.', ); } - if (startDate.isBefore(DateTime.now().subtract(const Duration(minutes: 10)))) { + if (startDate + .isBefore(DateTime.now().subtract(const Duration(minutes: 10)))) { return FFLocalizations.of(context).getVariableText( enText: 'End date must be after current date.', ptText: 'A data de término deve ser posterior à data atual.', @@ -218,9 +231,12 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel } Future _initVariables() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; } @override @@ -251,8 +267,10 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel textController3 = TextEditingController(); textController3Validator = _textController3Validator; - dropDownValueController1 ??= FormFieldController(dropDownValue1 ??= ''); - dropDownValueController2 ??= FormFieldController(dropDownValue2 ??= ''); + dropDownValueController1 ??= + FormFieldController(dropDownValue1 ??= ''); + dropDownValueController2 ??= + FormFieldController(dropDownValue2 ??= ''); } // Updated variables for dropdowns @@ -268,8 +286,11 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel void processDropDown1(List reasonsJsonList) { if (dropDownValue1 != null && dropDownValue1!.isNotEmpty) { String value = dropDownValue1!; - if (!(value.contains('{') && value.contains('}') && value.contains(':'))) { - var item = reasonsJsonList.where((reason) => reason['MOT_DESCRICAO'].toString().contains(dropDownValue1!)); + if (!(value.contains('{') && + value.contains('}') && + value.contains(':'))) { + var item = reasonsJsonList.where((reason) => + reason['MOT_DESCRICAO'].toString().contains(dropDownValue1!)); dropDownValue1 = item.firstOrNull?.toString() ?? ''; dropDownValueController1?.value = dropDownValue1!; } @@ -281,8 +302,11 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel void processDropDown2(List lavelList) { if (dropDownValue2 != null && dropDownValue2!.isNotEmpty) { String value = dropDownValue2!; - if (!(value.contains('{') && value.contains('}') && value.contains(':'))) { - var item = lavelList.where((level) => level['NAC_DESCRICAO'].toString().contains(dropDownValue2!)); + if (!(value.contains('{') && + value.contains('}') && + value.contains(':'))) { + var item = lavelList.where((level) => + level['NAC_DESCRICAO'].toString().contains(dropDownValue2!)); dropDownValue2 = item.firstOrNull?.toString() ?? ''; dropDownValueController2?.value = dropDownValue2!; } @@ -334,7 +358,10 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel } Future visitCancelAction(BuildContext context, - {required int? idDestino, required int? idVisita, required String? accessKey, required String? email}) async { + {required int? idDestino, + required int? idVisita, + required String? accessKey, + required String? email}) async { final ApiCallResponse? response; final CancelaVisita callback = PhpGroup.cancelaVisita; @@ -406,7 +433,8 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel Widget buildVisitDetails({ required dynamic item, required BuildContext context, - required Future Function(BuildContext, int, int, String, String) changeStatusAction, + required Future Function(BuildContext, int, int, String, String) + changeStatusAction, required String devUUID, required String userUUID, required String cliUUID, @@ -414,7 +442,8 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel }) { return DetailsComponentWidget( buttons: [ - if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.active) // REJECT ACTION + if (Status.getStatus(item['VAW_STATUS']) == + StatusEnum.active) // REJECT ACTION FFButtonWidget( text: FFLocalizations.of(context).getVariableText( ptText: 'Cancelar', @@ -493,7 +522,8 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel // borderRadius: 12, ), ), - if (Status.getStatus(item['VAW_STATUS']) != StatusEnum.active) // RECALL ACTION + if (Status.getStatus(item['VAW_STATUS']) != + StatusEnum.active) // RECALL ACTION FFButtonWidget( text: FFLocalizations.of(context).getVariableText( ptText: 'Reagendar', @@ -528,7 +558,8 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel // borderRadius: 12, ), ), - if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.active) // SHARE ACTION + if (Status.getStatus(item['VAW_STATUS']) == + StatusEnum.active) // SHARE ACTION FFButtonWidget( text: FFLocalizations.of(context).getVariableText( ptText: 'Compartilhar', @@ -565,14 +596,17 @@ URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/$cliUUID/${ite ), ], labelsHashMap: Map.from({ - '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': item['VTE_NOME'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': + item['VTE_NOME'] ?? '', '${FFLocalizations.of(context).getVariableText(ptText: "Inicio", enText: "Start")}:': item['VAW_DTINICIO'] != '' && item['VAW_DTINICIO'] != null - ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', item['VAW_DTINICIO']) + ? ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', item['VAW_DTINICIO']) : '', '${FFLocalizations.of(context).getVariableText(ptText: "Fim", enText: "End")}:': item['VAW_DTFIM'] != '' && item['VAW_DTFIM'] != null - ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', item['VAW_DTFIM']) + ? ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', item['VAW_DTFIM']) : '', }), imagePath: diff --git a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart index 2cf0c1cb..207b5db6 100644 --- a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart +++ b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart @@ -32,10 +32,12 @@ class ScheduleCompleteVisitPageWidget extends ScheduleComplete { const ScheduleCompleteVisitPageWidget({super.key}); @override - State createState() => _ScheduleCompleteVisitPageWidgetState(); + State createState() => + _ScheduleCompleteVisitPageWidgetState(); } -class _ScheduleCompleteVisitPageWidgetState extends State +class _ScheduleCompleteVisitPageWidgetState + extends State with TickerProviderStateMixin { bool _isLoading = false; late ScheduleCompleteVisitPageModel _model; @@ -49,7 +51,10 @@ class _ScheduleCompleteVisitPageWidgetState extends State ScheduleCompleteVisitPageModel(safeSetState: () => safeSetState(() {}))); + _model = createModel( + context, + () => ScheduleCompleteVisitPageModel( + safeSetState: () => safeSetState(() {}))); _model.updateState = (Function fn) => safeSetState(fn()); _model.tabBarController = TabController( @@ -75,7 +80,8 @@ class _ScheduleCompleteVisitPageWidgetState extends State newItems = await fetchVisitHistory(start, _visitHistoryLoadingCount); + final List newItems = + await fetchVisitHistory(start, _visitHistoryLoadingCount); if (newItems.isNotEmpty) { _visitHistoryList.addAll(newItems); @@ -85,7 +91,8 @@ class _ScheduleCompleteVisitPageWidgetState extends State 16.0 ? 100 : 80; return SingleChildScrollView( @@ -230,18 +243,21 @@ class _ScheduleCompleteVisitPageWidgetState extends State e).toList(); + final visitorListView = + model.visitorJsonList.map((e) => e).toList(); return ListView.separated( padding: const EdgeInsets.fromLTRB( 0, @@ -664,16 +827,20 @@ class _ScheduleCompleteVisitPageWidgetState extends State const SizedBox(height: 5.0), + separatorBuilder: (_, __) => + const SizedBox(height: 5.0), itemBuilder: (context, visitorListViewIndex) { - final visitorListViewItem = visitorListView[visitorListViewIndex]; + final visitorListViewItem = + visitorListView[visitorListViewIndex]; return Padding( - padding: const EdgeInsets.symmetric(horizontal: 30), + padding: + const EdgeInsets.symmetric(horizontal: 30), child: Container( width: MediaQuery.of(context).size.width, height: 70.0, decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, + color: FlutterFlowTheme.of(context) + .primaryBackground, ), child: Row( mainAxisSize: MainAxisSize.max, @@ -687,8 +854,10 @@ class _ScheduleCompleteVisitPageWidgetState extends State model.unfocusNode.canRequestFocus - ? FocusScope.of(context).requestFocus(model.unfocusNode) + ? FocusScope.of(context) + .requestFocus(model.unfocusNode) : FocusScope.of(context).unfocus(), child: SizedBox( - height: MediaQuery.of(context).size.height * 0.8, + height: MediaQuery.of(context).size.height * + 0.8, width: MediaQuery.of(context).size.width, child: Padding( padding: MediaQuery.viewInsetsOf(context), - child: VisitorSearchModalTemplateComponentWidget( + child: + VisitorSearchModalTemplateComponentWidget( getVisitors: (visitorsParam) async { - model.visitorJsonList = visitorsParam!.toList().cast(); + model.visitorJsonList = visitorsParam! + .toList() + .cast(); safeSetState(() {}); }, getDocs: (docsParam) async { - model.visitorStrList = strListToStr(docsParam!.toList()); + model.visitorStrList = + strListToStr(docsParam!.toList()); safeSetState(() {}); }, ), @@ -777,7 +966,8 @@ class _ScheduleCompleteVisitPageWidgetState extends State( - FlutterFlowTheme.of(context).primary, + valueColor: + AlwaysStoppedAnimation( + FlutterFlowTheme.of(context) + .primary, ), ), ) : Icon( Icons.add, - color: FlutterFlowTheme.of(context).primary, + color: FlutterFlowTheme.of(context) + .primary, size: 30.0, ), Padding( - padding: const EdgeInsets.fromLTRB(0, 15, 0, 0), + padding: + const EdgeInsets.fromLTRB(0, 15, 0, 0), child: Text( FFLocalizations.of(context).getText( 'r8soavtz', ), textAlign: TextAlign.center, - style: FlutterFlowTheme.of(context).titleSmall.override( - fontFamily: FlutterFlowTheme.of(context).titleSmallFamily, - color: FlutterFlowTheme.of(context).primaryText, + style: FlutterFlowTheme.of(context) + .titleSmall + .override( + fontFamily: + FlutterFlowTheme.of(context) + .titleSmallFamily, + color: FlutterFlowTheme.of(context) + .primaryText, fontSize: limitedInputFontSize, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context).titleSmallFamily), + .containsKey( + FlutterFlowTheme.of(context) + .titleSmallFamily), ), ), ) @@ -832,18 +1033,23 @@ class _ScheduleCompleteVisitPageWidgetState extends State( @@ -870,7 +1078,9 @@ class _ScheduleCompleteVisitPageWidgetState extends State( - fillColor: FlutterFlowTheme.of(context).primaryBackground, - controller: model.dropDownValueController1, + fillColor: FlutterFlowTheme.of(context) + .primaryBackground, + controller: + model.dropDownValueController1, options: model.reasonsDropDown1, optionLabels: reasonsOptionLabels, - onChanged: (val) => safeSetState(() => model.dropDownValue1 = val), + onChanged: (val) => safeSetState( + () => model.dropDownValue1 = val), width: double.infinity, height: double.infinity, - textStyle: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + textStyle: 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: limitedInputFontSize, ), hintText: FFLocalizations.of(context) - .getVariableText(enText: 'Reason for Visit', ptText: 'Motivo da Visita'), + .getVariableText( + enText: 'Reason for Visit', + ptText: 'Motivo da Visita'), icon: Icon( Icons.keyboard_arrow_down_rounded, - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context) + .accent1, size: 24.0, ), elevation: 2.0, - borderColor: FlutterFlowTheme.of(context).customColor6, + borderColor: + FlutterFlowTheme.of(context) + .customColor6, borderWidth: 0.5, borderRadius: 10.0, - margin: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), + margin: const EdgeInsetsDirectional + .fromSTEB(16.0, 0.0, 16.0, 0.0), hidesUnderline: true, isOverButton: true, isSearchable: false, @@ -930,16 +1160,19 @@ class _ScheduleCompleteVisitPageWidgetState extends State( - controller: model.dropDownValueController2, + controller: + model.dropDownValueController2, options: model.lavelsDropDown2, optionLabels: lavelsOptionLabels, - onChanged: (val) => safeSetState(() => model.dropDownValue2 = val), + onChanged: (val) => safeSetState( + () => model.dropDownValue2 = val), width: double.infinity, height: double.infinity, - textStyle: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + textStyle: 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: limitedInputFontSize, ), - hintText: FFLocalizations.of(context).getVariableText( + hintText: FFLocalizations.of(context) + .getVariableText( enText: 'Level of access', ptText: 'Nível de acesso', ), icon: Icon( Icons.keyboard_arrow_down_rounded, - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context) + .accent1, size: 24.0, ), elevation: 2.0, - borderColor: FlutterFlowTheme.of(context).customColor6, + borderColor: + FlutterFlowTheme.of(context) + .customColor6, borderWidth: 0.5, borderRadius: 10.0, - margin: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 0.0), + margin: const EdgeInsetsDirectional + .fromSTEB(16.0, 0.0, 16.0, 0.0), hidesUnderline: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, + fillColor: FlutterFlowTheme.of(context) + .primaryBackground, isOverButton: true, isSearchable: false, isMultiSelect: false, @@ -1029,16 +1284,19 @@ class _ScheduleCompleteVisitPageWidgetState extends State await DialogUtil.errorDefault(context)) + .catchError((e) async => + await DialogUtil.errorDefault(context)) .then((value) async { if (PhpGroup.postScheduleVisitCall.error( (value.jsonBody ?? ''), @@ -1279,17 +1579,22 @@ class _ScheduleCompleteVisitPageWidgetState extends State(''); - model.dropDownValueController2 = FormFieldController(''); + model.dropDownValueController1 = + FormFieldController(''); + model.dropDownValueController2 = + FormFieldController(''); model.visitorStrList = ''; model.visitorJsonList = []; ToastUtil.showToast( message: FFLocalizations.of(context) - .getVariableText(ptText: 'Visitante já adicionado!', enText: 'Visitor already added!'), + .getVariableText( + ptText: 'Visitante já adicionado!', + enText: 'Visitor already added!'), gravity: ToastGravity.TOP, backgroundColor: Colors.green, - fontSize: LimitedFontSizeUtil.getBodyFontSize(context), + fontSize: + LimitedFontSizeUtil.getBodyFontSize(context), ); await ShareUtil.showShare(value.jsonBody); @@ -1308,9 +1613,12 @@ class _ScheduleCompleteVisitPageWidgetState extends State model.unfocusNode.canRequestFocus - ? FocusScope.of(context).requestFocus(model.unfocusNode) + ? FocusScope.of(context) + .requestFocus(model.unfocusNode) : FocusScope.of(context).unfocus(), child: Dialog( alignment: Alignment.topCenter, @@ -1328,7 +1637,8 @@ class _ScheduleCompleteVisitPageWidgetState extends State.from({ - FFLocalizations.of(context).getVariableText( + FFLocalizations.of(context) + .getVariableText( ptText: 'Inativo', enText: 'Inactive', ): FlutterFlowTheme.of(context).success, diff --git a/lib/pages/schedule_complete_visit_page/visit_history_page_widget.dart b/lib/pages/schedule_complete_visit_page/visit_history_page_widget.dart index e706f92f..d4eb90ba 100644 --- a/lib/pages/schedule_complete_visit_page/visit_history_page_widget.dart +++ b/lib/pages/schedule_complete_visit_page/visit_history_page_widget.dart @@ -20,7 +20,8 @@ class VisitHistoryWidget extends ScheduleComplete { _VisitHistoryWidgetState createState() => _VisitHistoryWidgetState(); } -class _VisitHistoryWidgetState extends State with TickerProviderStateMixin, Status { +class _VisitHistoryWidgetState extends State + with TickerProviderStateMixin, Status { late final String devUUID; late final String userUUID; late final String cliUUID; @@ -35,22 +36,29 @@ class _VisitHistoryWidgetState extends State with TickerProv List _visitWrap = []; Future _initVariables() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; } @override void initState() { super.initState(); - _model = createModel(context, () => ScheduleCompleteVisitPageModel(safeSetState: () => safeSetState(() {}))); + _model = createModel( + context, + () => ScheduleCompleteVisitPageModel( + safeSetState: () => safeSetState(() {}))); _initVariables(); _visitFuture = _fetchVisits(); _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMore(); } }); @@ -95,7 +103,8 @@ class _VisitHistoryWidgetState extends State with TickerProv return null; } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Visitas", e, s); setState(() { _hasData = false; _loading = false; @@ -115,7 +124,8 @@ class _VisitHistoryWidgetState extends State with TickerProv ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."), + FFLocalizations.of(context).getVariableText( + ptText: "Não há mais dados.", enText: "No more data."), style: TextStyle( color: Colors.white, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), @@ -129,7 +139,8 @@ class _VisitHistoryWidgetState extends State with TickerProv @override Widget build(BuildContext context) { - double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context); + double limitedHeaderFontSize = + LimitedFontSizeUtil.getHeaderFontSize(context); return Column( mainAxisSize: MainAxisSize.max, @@ -143,8 +154,9 @@ class _VisitHistoryWidgetState extends State with TickerProv children: [ Center( child: Text( - FFLocalizations.of(context) - .getVariableText(ptText: "Nenhuma visita encontrada!", enText: "No visit found"), + FFLocalizations.of(context).getVariableText( + ptText: "Nenhuma visita encontrada!", + enText: "No visit found"), style: TextStyle( color: FlutterFlowTheme.of(context).primaryText, fontSize: limitedHeaderFontSize, @@ -192,12 +204,16 @@ class _VisitHistoryWidgetState extends State with TickerProv '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': visitaWrapItem['VTE_NOME'] ?? '', '${FFLocalizations.of(context).getVariableText(ptText: "Inicio", enText: "Start")}:': - visitaWrapItem['VAW_DTINICIO'] != '' && visitaWrapItem['VAW_DTINICIO'] != null - ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTINICIO']) + visitaWrapItem['VAW_DTINICIO'] != '' && + visitaWrapItem['VAW_DTINICIO'] != null + ? ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTINICIO']) : '', '${FFLocalizations.of(context).getVariableText(ptText: "Fim", enText: "End")}:': - visitaWrapItem['VAW_DTFIM'] != '' && visitaWrapItem['VAW_DTFIM'] != null - ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTFIM']) + visitaWrapItem['VAW_DTFIM'] != '' && + visitaWrapItem['VAW_DTFIM'] != null + ? ValidatorUtil.toLocalDateTime( + 'yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTFIM']) : '', }, statusHashMap: [ @@ -208,35 +224,40 @@ class _VisitHistoryWidgetState extends State with TickerProv enText: 'Active', ): FlutterFlowTheme.of(context).warning, }, - if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == StatusEnum.finished) + if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == + StatusEnum.finished) { FFLocalizations.of(context).getVariableText( ptText: 'Finalizado', enText: 'Finished', ): FlutterFlowTheme.of(context).success, }, - if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == StatusEnum.unknown) + if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == + StatusEnum.unknown) { FFLocalizations.of(context).getVariableText( ptText: 'Desconhecido', enText: 'Unknown', ): FlutterFlowTheme.of(context).alternate, }, - if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == StatusEnum.canceled) + if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == + StatusEnum.canceled) { FFLocalizations.of(context).getVariableText( ptText: 'Cancelado', enText: 'Canceled', ): FlutterFlowTheme.of(context).error, }, - if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == StatusEnum.blocked) + if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == + StatusEnum.blocked) { FFLocalizations.of(context).getVariableText( ptText: 'Bloqueado', enText: 'Blocked', ): FlutterFlowTheme.of(context).error, }, - if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == StatusEnum.inactive) + if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == + StatusEnum.inactive) { FFLocalizations.of(context).getVariableText( ptText: 'Inativo', @@ -245,10 +266,17 @@ class _VisitHistoryWidgetState extends State with TickerProv }, ], onTapCardItemAction: () async { - final devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - final userUUID = (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? ''; - final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - final cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + final devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + final userUUID = + (await StorageHelper().get(KeychainStorageKey.userUUID.value)) ?? + ''; + final cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? + ''; + final cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? + ''; await showDialog( useSafeArea: true, @@ -275,7 +303,8 @@ class _VisitHistoryWidgetState extends State with TickerProv }); }).catchError((e, s) async { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Visitas", e, s); safeSetState(() { _hasData = false; _loading = false; diff --git a/lib/pages/sign_in_page/sign_in_page_model.dart b/lib/pages/sign_in_page/sign_in_page_model.dart index 8642b98d..e8b945bd 100644 --- a/lib/pages/sign_in_page/sign_in_page_model.dart +++ b/lib/pages/sign_in_page/sign_in_page_model.dart @@ -12,7 +12,8 @@ class SignInPageModel extends FlutterFlowModel { @override void initState(BuildContext context) { - signInTemplateComponentModel = createModel(context, () => SignInTemplateComponentModel()); + signInTemplateComponentModel = + createModel(context, () => SignInTemplateComponentModel()); } @override diff --git a/lib/pages/sign_up_page/sign_up_page_model.dart b/lib/pages/sign_up_page/sign_up_page_model.dart index ff69d9b5..938a3b46 100644 --- a/lib/pages/sign_up_page/sign_up_page_model.dart +++ b/lib/pages/sign_up_page/sign_up_page_model.dart @@ -12,7 +12,8 @@ class SignUpPageModel extends FlutterFlowModel { @override void initState(BuildContext context) { - signUpTemplateComponentModel = createModel(context, () => SignUpTemplateComponentModel()); + signUpTemplateComponentModel = + createModel(context, () => SignUpTemplateComponentModel()); } @override 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 263eb263..8d12d08b 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 @@ -17,7 +17,8 @@ class VehicleOnTheProperty extends StatefulWidget { _VehicleOnThePropertyState createState() => _VehicleOnThePropertyState(); } -class _VehicleOnThePropertyState extends State with TickerProviderStateMixin { +class _VehicleOnThePropertyState extends State + with TickerProviderStateMixin { late ScrollController _scrollController; int _pageNumber = 1; @@ -36,7 +37,8 @@ class _VehicleOnThePropertyState extends State with Ticker _future = _fetchVisits(); _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMore(); } }); @@ -50,7 +52,8 @@ class _VehicleOnThePropertyState extends State with Ticker @override Widget build(BuildContext context) { - late final limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context); + late final limitedHeaderTextSize = + LimitedFontSizeUtil.getHeaderFontSize(context); return Scaffold( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, @@ -127,7 +130,9 @@ class _VehicleOnThePropertyState extends State with Ticker return AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, automaticallyImplyLeading: false, - title: Text(FFLocalizations.of(context).getVariableText(enText: 'Vehicles', ptText: 'Veículos'), + title: Text( + FFLocalizations.of(context) + .getVariableText(enText: 'Vehicles', ptText: 'Veículos'), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, @@ -162,7 +167,8 @@ class _VehicleOnThePropertyState extends State with Ticker try { setState(() => _loading = true); - var response = await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString()); + var response = + await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString()); final List vehicles = response.jsonBody['vehicles'] ?? []; safeSetState(() => count = response.jsonBody['total_rows'] ?? 0); @@ -187,7 +193,8 @@ class _VehicleOnThePropertyState extends State with Ticker return null; } catch (e, s) { DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículo", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Veículo", e, s); setState(() { _hasData = false; _loading = false; @@ -229,8 +236,10 @@ class _VehicleOnThePropertyState extends State with Ticker labelsHashMap: { '${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:': uItem['licensePlate'] ?? '', - '${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:': uItem['model'] ?? '', - '${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:': uItem['tag'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:': + uItem['model'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:': + uItem['tag'] ?? '', }, statusHashMap: [], onTapCardItemAction: () async { @@ -251,11 +260,13 @@ class _VehicleOnThePropertyState extends State with Ticker safeSetState(() { _pageNumber = 1; _wrap = []; - _future = _fetchVisits().then((value) => value!.jsonBody['vehicles'] ?? []); + _future = _fetchVisits() + .then((value) => value!.jsonBody['vehicles'] ?? []); }); }).catchError((e, s) { DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículos", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Veículos", e, s); safeSetState(() { _hasData = false; _loading = false; diff --git a/lib/pages/visits_on_the_property/model.dart b/lib/pages/visits_on_the_property/model.dart index 357ab6dd..affe665f 100644 --- a/lib/pages/visits_on_the_property/model.dart +++ b/lib/pages/visits_on_the_property/model.dart @@ -10,7 +10,8 @@ import 'package:hub/shared/helpers/storage/storage_helper.dart'; class VisitsModel extends FlutterFlowModel { static VisitsModel? _instance; 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; @@ -30,8 +31,10 @@ class VisitsModel extends FlutterFlowModel { void dispose() {} Future initAsync() async { - devUUID = (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + devUUID = + (await StorageHelper().get(KeychainStorageKey.devUUID.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; onRefresh?.call(); } @@ -41,55 +44,55 @@ class VisitsModel extends FlutterFlowModel { required VisitsModel model, }) { return DetailsComponentWidget( - buttons: [], - labelsHashMap: Map.from({ - if (item['VTA_NOME'] != null && item['VTA_NOME'] != '') - '${FFLocalizations.of(context).getVariableText( - ptText: "Nome", - enText: "Name", - )}:': item['VTA_NOME'].toString().toUpperCase(), - if (item['MOT_DESCRICAO'] != null && item['MOT_DESCRICAO'] != '') - '${FFLocalizations.of(context).getVariableText( - ptText: "Motivo", - enText: "Reason", - )}:': item['MOT_DESCRICAO'].toString().toUpperCase(), - if (item['VTA_DTINICIO'] != null && item['VTA_DTINICIO'] != '') - '${FFLocalizations.of(context).getVariableText( - ptText: "Data de Início", - enText: "Start Date", - )}:': item['VTA_DTINICIO'].toString().toUpperCase(), - if (item['VTA_VALIDADE'] != null && item['VTA_VALIDADE'] != '') - '${FFLocalizations.of(context).getVariableText( - ptText: "Validade", - enText: "Validity", - )}:': item['VTA_VALIDADE'].toString().toUpperCase(), - if (item['VTA_FIXA'] != null && item['VTA_FIXA'] != '') - '${FFLocalizations.of(context).getVariableText( - ptText: "Entrada Única", - enText: "Single Entry", - )}:': item['VTA_FIXA'] == true - ? FFLocalizations.of(context).getVariableText( - ptText: "Sim", - enText: "Yes", - ) - : FFLocalizations.of(context).getVariableText( - ptText: "Não", - enText: "No", - ), - }), - imagePath: - 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&cliID=${cliUUID}&atividade=getFoto&Documento=${item['VDO_DOCUMENTO']}&tipo=E', - statusHashMap: [ - Map.from({ - if (item['VTA_FIXA'] != null) - FFLocalizations.of(context).getVariableText( - ptText: item['VTA_FIXA'] ? "Entrada Única" : "Entrada Recorrente", - enText: item['VTA_FIXA'] ? "Single Entry" : "Recurrent Entry", - ): item['VTA_FIXA'] == true - ? FlutterFlowTheme.of(context).success - : FlutterFlowTheme.of(context).warning, - }) - ], - ); + buttons: [], + labelsHashMap: Map.from({ + if (item['VTA_NOME'] != null && item['VTA_NOME'] != '') + '${FFLocalizations.of(context).getVariableText( + ptText: "Nome", + enText: "Name", + )}:': item['VTA_NOME'].toString().toUpperCase(), + if (item['MOT_DESCRICAO'] != null && item['MOT_DESCRICAO'] != '') + '${FFLocalizations.of(context).getVariableText( + ptText: "Motivo", + enText: "Reason", + )}:': item['MOT_DESCRICAO'].toString().toUpperCase(), + if (item['VTA_DTINICIO'] != null && item['VTA_DTINICIO'] != '') + '${FFLocalizations.of(context).getVariableText( + ptText: "Data de Início", + enText: "Start Date", + )}:': item['VTA_DTINICIO'].toString().toUpperCase(), + if (item['VTA_VALIDADE'] != null && item['VTA_VALIDADE'] != '') + '${FFLocalizations.of(context).getVariableText( + ptText: "Validade", + enText: "Validity", + )}:': item['VTA_VALIDADE'].toString().toUpperCase(), + if (item['VTA_FIXA'] != null && item['VTA_FIXA'] != '') + '${FFLocalizations.of(context).getVariableText( + ptText: "Entrada Única", + enText: "Single Entry", + )}:': item['VTA_FIXA'] == true + ? FFLocalizations.of(context).getVariableText( + ptText: "Sim", + enText: "Yes", + ) + : FFLocalizations.of(context).getVariableText( + ptText: "Não", + enText: "No", + ), + }), + imagePath: + 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&cliID=${cliUUID}&atividade=getFoto&Documento=${item['VDO_DOCUMENTO']}&tipo=E', + statusHashMap: [ + Map.from({ + if (item['VTA_FIXA'] != null) + FFLocalizations.of(context).getVariableText( + ptText: item['VTA_FIXA'] ? "Entrada Única" : "Entrada Recorrente", + enText: item['VTA_FIXA'] ? "Single Entry" : "Recurrent Entry", + ): item['VTA_FIXA'] == true + ? FlutterFlowTheme.of(context).success + : FlutterFlowTheme.of(context).warning, + }) + ], + ); } } diff --git a/lib/pages/visits_on_the_property/visits_on_the_property_screen.dart b/lib/pages/visits_on_the_property/visits_on_the_property_screen.dart index ddc81d31..583e737e 100644 --- a/lib/pages/visits_on_the_property/visits_on_the_property_screen.dart +++ b/lib/pages/visits_on_the_property/visits_on_the_property_screen.dart @@ -17,7 +17,8 @@ class VisitsOnTheProperty extends StatefulWidget { _VisitsOnThePropertyState createState() => _VisitsOnThePropertyState(); } -class _VisitsOnThePropertyState extends State with TickerProviderStateMixin { +class _VisitsOnThePropertyState extends State + with TickerProviderStateMixin { late ScrollController _scrollController; int _pageNumber = 1; @@ -32,12 +33,14 @@ class _VisitsOnThePropertyState extends State with TickerPr @override void initState() { super.initState(); - model = createModel(context, () => VisitsModel(onRefresh: () => safeSetState(() {}))); + model = createModel( + context, () => VisitsModel(onRefresh: () => safeSetState(() {}))); _future = _fetchVisits(); _scrollController = ScrollController() ..addListener(() { - if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) { + if (_scrollController.position.atEdge && + _scrollController.position.pixels != 0) { _loadMore(); } }); @@ -51,8 +54,10 @@ class _VisitsOnThePropertyState extends State with TickerPr @override Widget build(BuildContext context) { - late final limitedBodyTextSize = LimitedFontSizeUtil.getBodyFontSize(context); - late final limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context); + late final limitedBodyTextSize = + LimitedFontSizeUtil.getBodyFontSize(context); + late final limitedHeaderTextSize = + LimitedFontSizeUtil.getHeaderFontSize(context); return Scaffold( appBar: _appBar(context), @@ -70,7 +75,8 @@ class _VisitsOnThePropertyState extends State with TickerPr Center( child: Text( FFLocalizations.of(context).getVariableText( - ptText: "Nenhuma visita em aberto encontrada!", enText: "No opened visits found"), + ptText: "Nenhuma visita em aberto encontrada!", + enText: "No opened visits found"), style: TextStyle( fontFamily: 'Nunito', fontSize: limitedHeaderTextSize, @@ -127,7 +133,9 @@ class _VisitsOnThePropertyState extends State with TickerPr return AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, automaticallyImplyLeading: false, - title: Text(FFLocalizations.of(context).getVariableText(ptText: 'Visitas em aberto', enText: 'Opened visits'), + title: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Visitas em aberto', enText: 'Opened visits'), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, @@ -162,7 +170,8 @@ class _VisitsOnThePropertyState extends State with TickerPr try { setState(() => _loading = true); - var response = await PhpGroup.getOpenedVisits.call(_pageNumber.toString()); + var response = + await PhpGroup.getOpenedVisits.call(_pageNumber.toString()); final List visits = response.jsonBody['visitas'] ?? []; safeSetState(() => count = response.jsonBody['total_rows'] ?? 0); @@ -187,7 +196,8 @@ class _VisitsOnThePropertyState extends State with TickerPr return null; } catch (e, s) { DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Visitas", e, s); setState(() { _hasData = false; _loading = false; @@ -208,7 +218,8 @@ class _VisitsOnThePropertyState extends State with TickerPr ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."), + FFLocalizations.of(context).getVariableText( + ptText: "Não há mais dados.", enText: "No more data."), style: TextStyle( color: Colors.white, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), @@ -225,11 +236,13 @@ class _VisitsOnThePropertyState extends State with TickerPr imagePath: 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${model.devUUID}&cliID=${model.cliUUID}&atividade=getFoto&Documento=${uItem['VDO_DOCUMENTO']}&tipo=E', labelsHashMap: { - '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': uItem['VTA_NOME'] ?? '', + '${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': + uItem['VTA_NOME'] ?? '', '${FFLocalizations.of(context).getVariableText(ptText: "Validade", enText: "Valids")}:': uItem['VTA_VALIDADE'] ?? '', '${FFLocalizations.of(context).getVariableText(ptText: "Motivo", enText: "Reason")}:': - uItem['MOT_DESCRICAO'][0].toUpperCase() + uItem['MOT_DESCRICAO'].substring(1).toLowerCase(), + uItem['MOT_DESCRICAO'][0].toUpperCase() + + uItem['MOT_DESCRICAO'].substring(1).toLowerCase(), }, statusHashMap: [ if (uItem['VTA_FIXA'] == false) @@ -265,11 +278,13 @@ class _VisitsOnThePropertyState extends State with TickerPr safeSetState(() { _pageNumber = 1; _list = []; - _future = _fetchVisits().then((value) => value!.jsonBody['visitas'] ?? []); + _future = _fetchVisits() + .then((value) => value!.jsonBody['visitas'] ?? []); }); }).catchError((e, s) { DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s); + LogUtil.requestAPIFailed( + "proccessRequest.php", "", "Consulta de Visitas", e, s); safeSetState(() { _hasData = false; _loading = false; diff --git a/lib/pages/welcome_page/welcome_page_model.dart b/lib/pages/welcome_page/welcome_page_model.dart index 7823f2b2..b8a54a7e 100644 --- a/lib/pages/welcome_page/welcome_page_model.dart +++ b/lib/pages/welcome_page/welcome_page_model.dart @@ -16,7 +16,8 @@ class WelcomePageModel extends FlutterFlowModel { @override void initState(BuildContext context) { - welcomeTemplateComponentModel = createModel(context, () => WelcomeTemplateComponentModel()); + welcomeTemplateComponentModel = + createModel(context, () => WelcomeTemplateComponentModel()); } @override diff --git a/lib/shared/components/atoms/term_of_use/atom_terms_of_use.dart b/lib/shared/components/atoms/term_of_use/atom_terms_of_use.dart index 470d61f8..01a47e5d 100644 --- a/lib/shared/components/atoms/term_of_use/atom_terms_of_use.dart +++ b/lib/shared/components/atoms/term_of_use/atom_terms_of_use.dart @@ -19,7 +19,8 @@ class AtomTermsOfUse extends StatelessWidget { color: FlutterFlowTheme.of(context).primaryText, fontSize: LimitedFontSizeUtil.getInputFontSize(context), letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), ), ), onTap: () => launchURL('https://freaccess.com.br/pp'), diff --git a/lib/shared/components/molecules/locals/data/data_sources/locals_local_data_source.dart b/lib/shared/components/molecules/locals/data/data_sources/locals_local_data_source.dart index 64d78e27..775b4c05 100644 --- a/lib/shared/components/molecules/locals/data/data_sources/locals_local_data_source.dart +++ b/lib/shared/components/molecules/locals/data/data_sources/locals_local_data_source.dart @@ -6,11 +6,9 @@ abstract class LocalsLocalDataSource { } class LocalsLocalDataSourceImpl { - Future unlinkLocal() async { - await StorageHelper().set(KeychainStorageKey.clientUUID.value, ''); - await StorageHelper().set(KeychainStorageKey.clientName.value, ''); - await StorageHelper().set(KeychainStorageKey.ownerName.value, ''); + await StorageHelper().set(KeychainStorageKey.clientUUID.value, ''); + await StorageHelper().set(KeychainStorageKey.clientName.value, ''); + await StorageHelper().set(KeychainStorageKey.ownerName.value, ''); } - } diff --git a/lib/shared/components/molecules/locals/data/data_sources/locals_remote_data_source.dart b/lib/shared/components/molecules/locals/data/data_sources/locals_remote_data_source.dart index 2520b990..b2d2ea69 100644 --- a/lib/shared/components/molecules/locals/data/data_sources/locals_remote_data_source.dart +++ b/lib/shared/components/molecules/locals/data/data_sources/locals_remote_data_source.dart @@ -20,14 +20,15 @@ import 'package:hub/shared/utils/snackbar_util.dart'; abstract class LocalsRemoteDataSource { Future linkLocal(BuildContext context); Future checkLocals(BuildContext context); - Future processLocals(BuildContext context) ; + Future processLocals(BuildContext context); Future processData(BuildContext context); - Future selectLocal(BuildContext context, ApiCallResponse? response) ; + Future selectLocal(BuildContext context, ApiCallResponse? response); Future detachLocal(BuildContext context); } class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { - static final LocalsRemoteDataSourceImpl _instance = LocalsRemoteDataSourceImpl._internal(); + static final LocalsRemoteDataSourceImpl _instance = + LocalsRemoteDataSourceImpl._internal(); factory LocalsRemoteDataSourceImpl() => _instance; LocalsRemoteDataSourceImpl._internal(); @@ -53,7 +54,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) { @@ -71,7 +73,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { @override Future processLocals(BuildContext context) async { - log('() => processLocals'); + log('() => processLocals'); try { final GetLocalsCall callback = PhpGroup.getLocalsCall; final ApiCallResponse response = await callback.call(); @@ -98,7 +100,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(); @@ -145,8 +148,10 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { @override Future checkLocals(BuildContext context) async { - String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - String cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + String cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; return cliUUID.isEmpty && cliName.isEmpty; } @@ -170,7 +175,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 { @@ -189,7 +195,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, @@ -223,7 +230,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { await StorageHelper().set(KeychainStorageKey.ownerName.value, ''); await StorageHelper().set(KeychainStorageKey.clientUUID.value, ''); context.pop(); - context.go('/homePage', extra: {'update': LocalsRepositoryImpl().update}); + context.go('/homePage', + extra: {'update': LocalsRepositoryImpl().update}); SnackBarUtil.showSnackBar(context, content); } }).catchError((err, stack) { @@ -244,6 +252,4 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource { SnackBarUtil.showSnackBar(context, content, isError: true); } } - - } diff --git a/lib/shared/components/molecules/locals/data/models/index.dart b/lib/shared/components/molecules/locals/data/models/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/locals/data/models/index.dart +++ b/lib/shared/components/molecules/locals/data/models/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/molecules/locals/data/repositories/locals_repository_impl.dart b/lib/shared/components/molecules/locals/data/repositories/locals_repository_impl.dart index 51c48596..7046bca7 100644 --- a/lib/shared/components/molecules/locals/data/repositories/locals_repository_impl.dart +++ b/lib/shared/components/molecules/locals/data/repositories/locals_repository_impl.dart @@ -32,21 +32,23 @@ class LocalsRepositoryImpl implements LocalsRepository { } Future select(BuildContext context) async { - await localDataSource.unlinkLocal(); - await update(context); + await localDataSource.unlinkLocal(); + await update(context); } Future check(BuildContext context) async { - final String? cliUUID = await StorageHelper().get(KeychainStorageKey.clientUUID.value); - final String? ownerUUID = await StorageHelper().get(KeychainStorageKey.ownerUUID.value); + final String? cliUUID = + await StorageHelper().get(KeychainStorageKey.clientUUID.value); + final String? ownerUUID = + await StorageHelper().get(KeychainStorageKey.ownerUUID.value); final bool haveCli = cliUUID != null && cliUUID.isNotEmpty; final bool haveOwner = ownerUUID != null && ownerUUID.isNotEmpty; if (!haveCli && !haveOwner) { - await update(context); - await FirebaseMessagingService().updateDeviceToken(); + await update(context); + await FirebaseMessagingService().updateDeviceToken(); } } - + Future _handleReponse(BuildContext context) async { bool response = false; final bool isUnselected = await remoteDataSource.checkLocals(context); @@ -75,10 +77,8 @@ class LocalsRepositoryImpl implements LocalsRepository { } Future _notifyBlocs(BuildContext context) async { - context.read().add(LocalProfileEvent()); context.read().add(MenuEvent()); - } @override diff --git a/lib/shared/components/molecules/locals/domain/entities/index.dart b/lib/shared/components/molecules/locals/domain/entities/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/locals/domain/entities/index.dart +++ b/lib/shared/components/molecules/locals/domain/entities/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/molecules/locals/domain/usecases/index.dart b/lib/shared/components/molecules/locals/domain/usecases/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/locals/domain/usecases/index.dart +++ b/lib/shared/components/molecules/locals/domain/usecases/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/molecules/locals/index.dart b/lib/shared/components/molecules/locals/index.dart index c6e39062..804475c2 100644 --- a/lib/shared/components/molecules/locals/index.dart +++ b/lib/shared/components/molecules/locals/index.dart @@ -1,4 +1,4 @@ export 'data/index.dart'; export 'domain/index.dart'; export 'presentation/index.dart'; -export 'utils/index.dart'; \ No newline at end of file +export 'utils/index.dart'; diff --git a/lib/shared/components/molecules/locals/presentation/blocs/local_profile_bloc.dart b/lib/shared/components/molecules/locals/presentation/blocs/local_profile_bloc.dart index d19459a1..16faa756 100644 --- a/lib/shared/components/molecules/locals/presentation/blocs/local_profile_bloc.dart +++ b/lib/shared/components/molecules/locals/presentation/blocs/local_profile_bloc.dart @@ -10,19 +10,18 @@ import 'package:hub/shared/components/molecules/menu/index.dart'; import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart'; -class LocalProfileEvent { - -} +class LocalProfileEvent {} class LocalProfileState { final String cliName; final String cliUUID; final String ownerName; - LocalProfileState({this.cliName = '', this.cliUUID = '', this.ownerName = ''}); - - LocalProfileState copyWith({String? cliName, String? ownerName, String? cliUUID}) { + LocalProfileState( + {this.cliName = '', this.cliUUID = '', this.ownerName = ''}); + LocalProfileState copyWith( + {String? cliName, String? ownerName, String? cliUUID}) { return LocalProfileState( cliName: cliName ?? this.cliName, ownerName: ownerName ?? this.ownerName, @@ -41,11 +40,16 @@ class LocalProfileBloc extends Bloc { }); } - Future _onLocalProfileEvent(LocalProfileEvent event, Emitter emit) async { - final cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; - final ownerName = (await StorageHelper().get(KeychainStorageKey.ownerName.value)) ?? ''; - final cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - emit(state.copyWith(cliName: cliName, cliUUID: cliUUID, ownerName: ownerName)); + Future _onLocalProfileEvent( + LocalProfileEvent event, Emitter emit) async { + final cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + final ownerName = + (await StorageHelper().get(KeychainStorageKey.ownerName.value)) ?? ''; + final cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + emit(state.copyWith( + cliName: cliName, cliUUID: cliUUID, ownerName: ownerName)); } // void updateProfile(BuildContext context) { @@ -56,7 +60,8 @@ class LocalProfileBloc extends Bloc { // } } -class LocalProfileComponentModel extends FlutterFlowModel { +class LocalProfileComponentModel + extends FlutterFlowModel { String cliName = ''; String cliUUID = ''; String ownerName = ''; @@ -68,9 +73,12 @@ class LocalProfileComponentModel extends FlutterFlowModel getData() async { - cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; - ownerName = (await StorageHelper().get(KeychainStorageKey.ownerName.value)) ?? ''; - cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + ownerName = + (await StorageHelper().get(KeychainStorageKey.ownerName.value)) ?? ''; + cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; setStateCallback?.call(); } diff --git a/lib/shared/components/molecules/locals/presentation/widgets/index.dart b/lib/shared/components/molecules/locals/presentation/widgets/index.dart index e0361f45..2b0fd4c4 100644 --- a/lib/shared/components/molecules/locals/presentation/widgets/index.dart +++ b/lib/shared/components/molecules/locals/presentation/widgets/index.dart @@ -1 +1 @@ -export 'local_profile/index.dart'; \ No newline at end of file +export 'local_profile/index.dart'; diff --git a/lib/shared/components/molecules/locals/presentation/widgets/local_profile/local_profile_widget.dart b/lib/shared/components/molecules/locals/presentation/widgets/local_profile/local_profile_widget.dart index 77994112..1cb799be 100644 --- a/lib/shared/components/molecules/locals/presentation/widgets/local_profile/local_profile_widget.dart +++ b/lib/shared/components/molecules/locals/presentation/widgets/local_profile/local_profile_widget.dart @@ -17,257 +17,278 @@ class LocalProfileComponentWidget extends StatefulWidget { const LocalProfileComponentWidget({super.key}); @override - State createState() => _LocalProfileComponentWidgetState(); + State createState() => + _LocalProfileComponentWidgetState(); } -class _LocalProfileComponentWidgetState extends State { +class _LocalProfileComponentWidgetState + extends State { bool _isLoading = false; Future retrieveProfileInfo() async { - - setState(() {_isLoading = true;}); - await LocalsRepositoryImpl().select(context); - setState(() {_isLoading = false;}); + setState(() { + _isLoading = true; + }); + await LocalsRepositoryImpl().select(context); + setState(() { + _isLoading = false; + }); } @override Widget build(BuildContext context) { - - - return StreamBuilder( - stream: LocalsRepositoryImpl.stream, - builder: (context, snapshot) { - final textScaler = MediaQuery.textScalerOf(context); - final double baseFontSize = 14.0; - final double scaledFontSize = baseFontSize * textScaler.scale(1); - final double limitedFontSize = scaledFontSize > 20 ? 12 : scaledFontSize; - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - return Center(child: Text('Error: ${snapshot.error}')); - } else if (!snapshot.hasData || snapshot.data! == false) { - - return BlocBuilder( + return StreamBuilder( + stream: LocalsRepositoryImpl.stream, + builder: (context, snapshot) { + final textScaler = MediaQuery.textScalerOf(context); + final double baseFontSize = 14.0; + final double scaledFontSize = baseFontSize * textScaler.scale(1); + final double limitedFontSize = + scaledFontSize > 20 ? 12 : scaledFontSize; + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Text('Error: ${snapshot.error}')); + } else if (!snapshot.hasData || snapshot.data! == false) { + return BlocBuilder( builder: (context, state) { return _buildDefaultLocalProfile(context, limitedFontSize); }, ); } - - return BlocBuilder( - builder: (context, state) { - return _buildAsyncLocalProfile(context, state, limitedFontSize); - }, - ); - - }, - ); - + + return BlocBuilder( + builder: (context, state) { + return _buildAsyncLocalProfile(context, state, limitedFontSize); + }, + ); + }, + ); } - Container _buildDefaultLocalProfile(BuildContext context, double limitedFontSize) { + Container _buildDefaultLocalProfile( + BuildContext context, double limitedFontSize) { return Container( - decoration: const BoxDecoration(), - child: Align( - alignment: const AlignmentDirectional(0.0, -1.0), - child: Material( - color: Colors.transparent, - elevation: 0.0, - child: Container( - width: double.infinity, - height: 119.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primary, - border: Border.all( - color: FlutterFlowTheme.of(context).primary, + decoration: const BoxDecoration(), + child: Align( + alignment: const AlignmentDirectional(0.0, -1.0), + child: Material( + color: Colors.transparent, + elevation: 0.0, + child: Container( + width: double.infinity, + height: 119.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primary, + border: Border.all( + color: FlutterFlowTheme.of(context).primary, + ), + ), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsets.all(2.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: _isLoading ? null : retrieveProfileInfo, + child: ClipRRect( + borderRadius: BorderRadius.circular(200.0), + child: CachedNetworkImage( + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, + fit: BoxFit.cover, + ), + ), + ), + imageUrl: 'assets/images/home.png', + width: 80.0, + height: 80.0, + fit: BoxFit.cover, + alignment: const Alignment(0.0, 0.0), + placeholder: (context, url) => + Image.asset('assets/images/home.png'), + errorListener: (_) => + Image.asset('assets/images/home.png'), + errorWidget: (_, __, ___) => + Image.asset('assets/images/home.png'), + ), + )), ), ), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsets.all(2.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: _isLoading ? null : retrieveProfileInfo, - child: ClipRRect( - borderRadius: BorderRadius.circular(200.0), - child: CachedNetworkImage( - imageBuilder: (context, imageProvider) => Container( - decoration: BoxDecoration( - image: DecorationImage( - image: imageProvider, - fit: BoxFit.cover, - ), - ), - ), - imageUrl: 'assets/images/home.png', - width: 80.0, - height: 80.0, - fit: BoxFit.cover, - alignment: const Alignment(0.0, 0.0), - placeholder: (context, url) => Image.asset('assets/images/home.png'), - errorListener: (_) => Image.asset('assets/images/home.png'), - errorWidget: (_, __, ___) => Image.asset('assets/images/home.png'), - ), - )), - ), + Expanded( + child: Tooltip( + message: FFLocalizations.of(context).getVariableText( + ptText: 'SEM LOCAL VINCULADO', + enText: 'NO LINKED LOCAL', ), - Expanded( - child: Tooltip( - message: FFLocalizations.of(context).getVariableText( + child: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'SEM LOCAL VINCULADO', + enText: 'NO LINKED LOCAL', + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: FlutterFlowTheme.of(context).labelMedium.override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).info, + fontSize: limitedFontSize, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap().containsKey('Nunito'), + ), + ), + ), + ), + ] + .divide(const SizedBox(width: 20.0)) + .addToStart(const SizedBox(width: 20.0)) + .addToEnd(const SizedBox(width: 20.0)), + ), + ), + ), + ), + ); + } + + Container _buildAsyncLocalProfile( + BuildContext context, LocalProfileState state, double limitedFontSize) { + return Container( + decoration: const BoxDecoration(), + child: Align( + alignment: const AlignmentDirectional(0.0, -1.0), + child: Material( + color: Colors.transparent, + elevation: 0.0, + child: Container( + width: double.infinity, + height: 119.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primary, + border: Border.all( + color: FlutterFlowTheme.of(context).primary, + ), + ), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsets.all(2.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: _isLoading ? null : retrieveProfileInfo, + child: ClipRRect( + borderRadius: BorderRadius.circular(200.0), + child: CachedNetworkImage( + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, + fit: BoxFit.cover, + ), + ), + ), + imageUrl: valueOrDefault( + 'https://freaccess.com.br/freaccess/Images/Clients/${state.cliUUID}.png', + 'assets/images/home.png'), + width: 80.0, + height: 80.0, + fit: BoxFit.cover, + alignment: const Alignment(0.0, 0.0), + placeholder: (context, url) => + Image.asset('assets/images/home.png'), + errorListener: (_) => + Image.asset('assets/images/home.png'), + errorWidget: (_, __, ___) => + Image.asset('assets/images/home.png'), + ), + )), + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Tooltip( + message: valueOrDefault( + convertToUppercase(state.cliName), + FFLocalizations.of(context).getVariableText( ptText: 'SEM LOCAL VINCULADO', enText: 'NO LINKED LOCAL', ), + ), child: Text( - FFLocalizations.of(context).getVariableText( + valueOrDefault( + convertToUppercase(state.cliName), + FFLocalizations.of(context).getVariableText( ptText: 'SEM LOCAL VINCULADO', enText: 'NO LINKED LOCAL', ), + ), overflow: TextOverflow.ellipsis, maxLines: 1, - style: FlutterFlowTheme.of(context).labelMedium.override( + style: FlutterFlowTheme.of(context) + .labelMedium + .override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).info, fontSize: limitedFontSize, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), + useGoogleFonts: + GoogleFonts.asMap().containsKey('Nunito'), ), ), ), - ), - ].divide(const SizedBox(width: 20.0)).addToStart(const SizedBox(width: 20.0)).addToEnd(const SizedBox(width: 20.0)), + Tooltip( + message: + valueOrDefault(' ' + state.ownerName, ''), + child: Text( + valueOrDefault( + state.ownerName.length > 30 + ? '${state.ownerName.substring(0, 20)}...' + : state.ownerName, + ''), + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).info, + fontSize: limitedFontSize, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap().containsKey('Nunito'), + ), + ), + ), + ], + ), ), - ), + ] + .divide(const SizedBox(width: 20.0)) + .addToStart(const SizedBox(width: 20.0)) + .addToEnd(const SizedBox(width: 20.0)), ), ), - ); - } - - Container _buildAsyncLocalProfile(BuildContext context, LocalProfileState state, double limitedFontSize) { - return Container( - decoration: const BoxDecoration(), - child: Align( - alignment: const AlignmentDirectional(0.0, -1.0), - child: Material( - color: Colors.transparent, - elevation: 0.0, - child: Container( - width: double.infinity, - height: 119.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primary, - border: Border.all( - color: FlutterFlowTheme.of(context).primary, - ), - ), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsets.all(2.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: _isLoading ? null : retrieveProfileInfo, - child: ClipRRect( - borderRadius: BorderRadius.circular(200.0), - child: CachedNetworkImage( - imageBuilder: (context, imageProvider) => Container( - decoration: BoxDecoration( - image: DecorationImage( - image: imageProvider, - fit: BoxFit.cover, - ), - ), - ), - imageUrl: valueOrDefault('https://freaccess.com.br/freaccess/Images/Clients/${state.cliUUID}.png', 'assets/images/home.png'), - width: 80.0, - height: 80.0, - fit: BoxFit.cover, - alignment: const Alignment(0.0, 0.0), - placeholder: (context, url) => Image.asset('assets/images/home.png'), - errorListener: (_) => Image.asset('assets/images/home.png'), - errorWidget: (_, __, ___) => Image.asset('assets/images/home.png'), - ), - )), - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Tooltip( - message: valueOrDefault( - convertToUppercase(state.cliName), - FFLocalizations.of(context).getVariableText( - ptText: 'SEM LOCAL VINCULADO', - enText: 'NO LINKED LOCAL', - ), - ), - child: Text( - valueOrDefault( - convertToUppercase(state.cliName), - FFLocalizations.of(context).getVariableText( - ptText: 'SEM LOCAL VINCULADO', - enText: 'NO LINKED LOCAL', - ), - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).info, - fontSize: limitedFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), - ), - ), - ), - Tooltip( - message: valueOrDefault( - ' '+state.ownerName, - '' - ), - child: Text( - valueOrDefault( - state.ownerName.length > 30 ? '${state.ownerName.substring(0, 20)}...' : state.ownerName, - '' - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - style: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).info, - fontSize: limitedFontSize, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), - ), - ), - ), - ], - ), - ), - ].divide(const SizedBox(width: 20.0)).addToStart(const SizedBox(width: 20.0)).addToEnd(const SizedBox(width: 20.0)), - ), - ), - ), - ), - ); - - - } + ), + ), + ); + } } diff --git a/lib/shared/components/molecules/locals/utils/local_util.dart b/lib/shared/components/molecules/locals/utils/local_util.dart index 9aaa7772..cb9ac067 100644 --- a/lib/shared/components/molecules/locals/utils/local_util.dart +++ b/lib/shared/components/molecules/locals/utils/local_util.dart @@ -1,5 +1,3 @@ - - import 'dart:developer'; import 'package:flutter/material.dart'; @@ -12,12 +10,14 @@ import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; class LocalUtil { - static void handleError(BuildContext context, String errorMsg) async { - final String devUUID = await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? ''; - final String userUUID = await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? ''; + final String devUUID = + await StorageHelper().get(KeychainStorageKey.devUUID.value) ?? ''; + final String userUUID = + await StorageHelper().get(KeychainStorageKey.userUUID.value) ?? ''; 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( @@ -39,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(KeychainStorageKey.clientUUID.value, locals[0]['CLI_ID']); - await StorageHelper().set(KeychainStorageKey.ownerUUID.value, locals[0]['CLU_OWNER_ID']); - await StorageHelper().set(KeychainStorageKey.clientName.value, locals[0]['CLI_NOME']); - await StorageHelper().set(KeychainStorageKey.ownerName.value, locals[0]['CLU_OWNER_DSC']); + await StorageHelper() + .set(KeychainStorageKey.clientUUID.value, locals[0]['CLI_ID']); + await StorageHelper() + .set(KeychainStorageKey.ownerUUID.value, locals[0]['CLU_OWNER_ID']); + await StorageHelper() + .set(KeychainStorageKey.clientName.value, locals[0]['CLI_NOME']); + await StorageHelper() + .set(KeychainStorageKey.ownerName.value, locals[0]['CLU_OWNER_DSC']); var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A'); if (response.jsonBody['error'] == true) { @@ -56,10 +61,14 @@ class LocalUtil { return false; } - if (response.jsonBody['error'] == false) return await LocalsRemoteDataSourceImpl().processData(context).then((value) => value); + if (response.jsonBody['error'] == false) + return await LocalsRemoteDataSourceImpl() + .processData(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; @@ -67,11 +76,16 @@ class LocalUtil { static Future handleEnabled(BuildContext context, dynamic local) async { log('() => isEnabled'); - await StorageHelper().set(KeychainStorageKey.clientUUID.value, local['CLI_ID']); - await StorageHelper().set(KeychainStorageKey.ownerUUID.value, local['CLU_OWNER_ID']); - await StorageHelper().set(KeychainStorageKey.clientName.value, local['CLI_NOME']); - await StorageHelper().set(KeychainStorageKey.ownerName.value, local['CLU_OWNER_DSC']); - await StorageHelper().set(KeychainStorageKey.userName.value, local['USU_NOME']); + await StorageHelper() + .set(KeychainStorageKey.clientUUID.value, local['CLI_ID']); + await StorageHelper() + .set(KeychainStorageKey.ownerUUID.value, local['CLU_OWNER_ID']); + await StorageHelper() + .set(KeychainStorageKey.clientName.value, local['CLI_NOME']); + await StorageHelper() + .set(KeychainStorageKey.ownerName.value, local['CLU_OWNER_DSC']); + await StorageHelper() + .set(KeychainStorageKey.userName.value, local['USU_NOME']); return await LocalsRemoteDataSourceImpl().processData(context); } @@ -84,16 +98,25 @@ class LocalUtil { static Future updateStorageUtil(Map jsonBody) async { try { - await StorageHelper().set(KeychainStorageKey.whatsapp.value, jsonBody['whatsapp'] ?? false); - await StorageHelper().set(KeychainStorageKey.provisional.value, jsonBody['provisional'] ?? false); - await StorageHelper().set(KeychainStorageKey.pets.value, jsonBody['pet'] ?? false); - await StorageHelper().set(KeychainStorageKey.petAmount.value, - jsonBody['petAmountRegister']?.toString().isEmpty ?? true ? '0' : jsonBody['petAmountRegister'].toString()); - await StorageHelper().set(KeychainStorageKey.userName.value, jsonBody['visitado']['VDO_NOME'] ?? ''); - await StorageHelper().set(KeychainStorageKey.userEmail.value, jsonBody['visitado']['VDO_EMAIL'] ?? ''); + await StorageHelper().set( + KeychainStorageKey.whatsapp.value, jsonBody['whatsapp'] ?? false); + await StorageHelper().set(KeychainStorageKey.provisional.value, + jsonBody['provisional'] ?? false); + await StorageHelper() + .set(KeychainStorageKey.pets.value, jsonBody['pet'] ?? false); + await StorageHelper().set( + KeychainStorageKey.petAmount.value, + jsonBody['petAmountRegister']?.toString().isEmpty ?? true + ? '0' + : jsonBody['petAmountRegister'].toString()); + await StorageHelper().set(KeychainStorageKey.userName.value, + jsonBody['visitado']['VDO_NOME'] ?? ''); + await StorageHelper().set(KeychainStorageKey.userEmail.value, + jsonBody['visitado']['VDO_EMAIL'] ?? ''); final bool isNewVersion = jsonBody['newVersion'] ?? false; - await StorageHelper().set(KeychainStorageKey.isNewVersion.value, isNewVersion); + await StorageHelper() + .set(KeychainStorageKey.isNewVersion.value, isNewVersion); return isNewVersion; } catch (e, s) { log('Error in _updateStorageUtil: $e', stackTrace: s); @@ -106,31 +129,44 @@ class LocalUtil { } static Future isInactived(List locals) async { - String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - return locals.where((local) => local['CLI_ID'] != cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty; + String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + 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(KeychainStorageKey.clientUUID.value)) ?? ''; - String cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; - String ownerUUID = (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? ''; + String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + String cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + String ownerUUID = + (await StorageHelper().get(KeychainStorageKey.ownerUUID.value)) ?? ''; return cliUUID.isEmpty && cliName.isEmpty && ownerUUID.isEmpty; } static Future isSelected(bool isInactived) async { - String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - String cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + String cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; return cliUUID.isNotEmpty && cliName.isNotEmpty && isInactived; } static Future isAvailable() async { - String cliUUID = (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; - String cliName = (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; + String cliUUID = + (await StorageHelper().get(KeychainStorageKey.clientUUID.value)) ?? ''; + String cliName = + (await StorageHelper().get(KeychainStorageKey.clientName.value)) ?? ''; return cliUUID.isNotEmpty && cliName.isNotEmpty; } - -} \ No newline at end of file +} diff --git a/lib/shared/components/molecules/menu/data/data_sources/menu_local_data_source.dart b/lib/shared/components/molecules/menu/data/data_sources/menu_local_data_source.dart index 113df0e4..7faae928 100644 --- a/lib/shared/components/molecules/menu/data/data_sources/menu_local_data_source.dart +++ b/lib/shared/components/molecules/menu/data/data_sources/menu_local_data_source.dart @@ -1,5 +1,3 @@ - - import 'dart:developer'; import 'package:flutter/material.dart'; @@ -12,20 +10,25 @@ import 'package:hub/shared/utils/path_util.dart'; import '../../../modules/domain/entities/index.dart'; abstract class MenuLocalDataSource { - Future addMenuEntry(EnumMenuItem item, List entries, IconData icon, String text, Function() action); - Future processDisplayDefault(EnumMenuItem item, MenuEntry opt, List entries); - Future handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt, List entries); + Future addMenuEntry(EnumMenuItem item, List entries, + IconData icon, String text, Function() action); + Future processDisplayDefault( + EnumMenuItem item, MenuEntry opt, List entries); + Future handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt, + List entries); Future processStartDate(String startDate, MenuEntry entry); Future processExpirationDate(String expirationDate, MenuEntry entry); } class MenuLocalDataSourceImpl implements MenuLocalDataSource { - static final MenuLocalDataSourceImpl _instance = MenuLocalDataSourceImpl._internal(); + static final MenuLocalDataSourceImpl _instance = + MenuLocalDataSourceImpl._internal(); factory MenuLocalDataSourceImpl() => _instance; MenuLocalDataSourceImpl._internal(); @override - Future addMenuEntry(EnumMenuItem item, List entries, IconData icon, String text, Function() action) async { + Future addMenuEntry(EnumMenuItem item, List entries, + IconData icon, String text, Function() action) async { final menuItem = item == EnumMenuItem.button ? ButtonMenuItem(icon: icon, action: action, title: text) : item == EnumMenuItem.card || item == EnumMenuItem.tile @@ -36,21 +39,22 @@ class MenuLocalDataSourceImpl implements MenuLocalDataSource { } return null; } - + @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(item, entries, opt.icon, opt.name, () async { await AuthenticationService.signOut(navigatorKey.currentContext!); }); return true; - - } - else return false; + } else + return false; } @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': @@ -60,7 +64,8 @@ class MenuLocalDataSourceImpl implements MenuLocalDataSource { break; case 'DESABILITADO': await addMenuEntry(item, entries, opt.icon, opt.name, () async { - await DialogUnavailable.unavailableFeature(navigatorKey.currentContext!); + await DialogUnavailable.unavailableFeature( + navigatorKey.currentContext!); }); break; case 'INVISIVEL': @@ -75,17 +80,18 @@ class MenuLocalDataSourceImpl implements MenuLocalDataSource { Future processStartDate(String startDate, MenuEntry opt) async { try { if (startDate.isEmpty) return true; - final start = DateTime.tryParse(startDate); + final start = DateTime.tryParse(startDate); if (start == null) return false; return DateTime.now().isAfter(start); } catch (e) { log('Error processing start date for module ${opt.key}: $e'); } return false; - } + } @override - Future processExpirationDate(String expirationDate, MenuEntry opt) async { + Future processExpirationDate( + String expirationDate, MenuEntry opt) async { try { if (expirationDate.isEmpty) return false; final expiration = DateTime.tryParse(expirationDate); @@ -95,7 +101,4 @@ class MenuLocalDataSourceImpl implements MenuLocalDataSource { } return false; } - - - -} \ No newline at end of file +} diff --git a/lib/shared/components/molecules/menu/data/models/index.dart b/lib/shared/components/molecules/menu/data/models/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/menu/data/models/index.dart +++ b/lib/shared/components/molecules/menu/data/models/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/molecules/menu/data/repositories/menu_repository_impl.dart b/lib/shared/components/molecules/menu/data/repositories/menu_repository_impl.dart index 2a05bb85..f52fc420 100644 --- a/lib/shared/components/molecules/menu/data/repositories/menu_repository_impl.dart +++ b/lib/shared/components/molecules/menu/data/repositories/menu_repository_impl.dart @@ -1,5 +1,3 @@ - - import 'dart:convert'; import 'dart:developer'; @@ -13,38 +11,43 @@ import 'package:hub/shared/extensions/string_extensions.dart'; import 'package:hub/shared/helpers/storage/base_storage.dart'; import 'package:hub/shared/helpers/storage/storage_helper.dart'; - class MenuRepositoryImpl implements MenuRepository { final MenuLocalDataSource menuDataSource = MenuLocalDataSourceImpl(); - @override - Future> generateMenuEntries(List menuEntries, EnumMenuItem item) async { + Future> generateMenuEntries( + List menuEntries, EnumMenuItem item) 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(item, entry, entries); + final bool isDefault = + await menuDataSource.processDisplayDefault(item, entry, entries); if (isDefault) continue; - final licenseValue = await LicenseRepositoryImpl().getLicense(entry.key); + final licenseValue = + await LicenseRepositoryImpl().getLicense(entry.key); if (licenseValue != null) { final licenseMap = await stringToMap(licenseValue); final display = EnumDisplay.fromString(licenseMap['display']); final startDate = licenseMap['startDate'] ?? ''; final expirationDate = licenseMap['expirationDate'] ?? ''; - final isStarted = await menuDataSource.processStartDate(startDate, entry); - final isExpired = await menuDataSource.processExpirationDate(expirationDate, entry); + final isStarted = + await menuDataSource.processStartDate(startDate, entry); + final isExpired = + await menuDataSource.processExpirationDate(expirationDate, entry); if (isStarted && !isExpired) { await menuDataSource.handleMenu(item, display, entry, entries); } if (isExpired) { log('Entry ${entry.key} is expired'); - await menuDataSource.handleMenu(item, EnumDisplay.inactive, entry, entries); + await menuDataSource.handleMenu( + item, EnumDisplay.inactive, entry, entries); } if (!isStarted) { log('Entry ${entry.key} is not started'); - await menuDataSource.handleMenu(item, EnumDisplay.inactive, entry, entries); + await menuDataSource.handleMenu( + item, EnumDisplay.inactive, entry, entries); } } } @@ -54,19 +57,21 @@ 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'; - await LicenseLocalDataSourceImpl().setDisplayByKey(['FRE-HUB-ABOUT-PROPERTY'], displayValue); + final displayValue = + module['display'] == EnumDisplay.active ? 'VISIVEL' : 'INVISIVEL'; + await LicenseLocalDataSourceImpl() + .setDisplayByKey(['FRE-HUB-ABOUT-PROPERTY'], displayValue); return EnumDisplay.fromString(displayValue); } return EnumDisplay.fromString(module['display']); } - Future _shouldUpdateDisplay(Map module, bool isNewVersion) async { + Future _shouldUpdateDisplay( + Map module, bool isNewVersion) async { const keysToCheck = [ LicenseKeys.residents, LicenseKeys.vehicles, @@ -74,6 +79,4 @@ class MenuRepositoryImpl implements MenuRepository { ]; return isNewVersion && keysToCheck.any((key) => module['key'] == key.value); } - - -} \ No newline at end of file +} diff --git a/lib/shared/components/molecules/menu/domain/entities/menu_item.dart b/lib/shared/components/molecules/menu/domain/entities/menu_item.dart index 31b36da6..d9da8c5f 100644 --- a/lib/shared/components/molecules/menu/domain/entities/menu_item.dart +++ b/lib/shared/components/molecules/menu/domain/entities/menu_item.dart @@ -6,7 +6,8 @@ enum EnumMenuItem { card, tile; - MenuItem getInstance(final Function() action, final String title, final IconData icon) { + MenuItem getInstance( + final Function() action, final String title, final IconData icon) { switch (this) { case EnumMenuItem.button: return ButtonMenuItem(action: action, title: title, icon: icon); @@ -29,7 +30,6 @@ abstract class MenuItem extends StatefulWidget { final Function() action; final String title; final IconData icon; - factory MenuItem.create( EnumMenuItem type, { diff --git a/lib/shared/components/molecules/menu/domain/respositories/index.dart b/lib/shared/components/molecules/menu/domain/respositories/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/menu/domain/respositories/index.dart +++ b/lib/shared/components/molecules/menu/domain/respositories/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/molecules/menu/domain/respositories/menu_repository.dart b/lib/shared/components/molecules/menu/domain/respositories/menu_repository.dart index 495dc332..1b9d1f74 100644 --- a/lib/shared/components/molecules/menu/domain/respositories/menu_repository.dart +++ b/lib/shared/components/molecules/menu/domain/respositories/menu_repository.dart @@ -2,5 +2,6 @@ import 'package:hub/shared/components/molecules/menu/domain/entities/menu_item.d import 'package:hub/shared/components/molecules/menu/index.dart'; abstract class MenuRepository { - Future> generateMenuEntries(List menuEntries, EnumMenuItem item); -} \ No newline at end of file + Future> generateMenuEntries( + List menuEntries, EnumMenuItem item); +} diff --git a/lib/shared/components/molecules/menu/domain/usecases/index.dart b/lib/shared/components/molecules/menu/domain/usecases/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/menu/domain/usecases/index.dart +++ b/lib/shared/components/molecules/menu/domain/usecases/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/molecules/menu/presentation/blocs/menu_bloc.dart b/lib/shared/components/molecules/menu/presentation/blocs/menu_bloc.dart index ed513784..4875d9fc 100644 --- a/lib/shared/components/molecules/menu/presentation/blocs/menu_bloc.dart +++ b/lib/shared/components/molecules/menu/presentation/blocs/menu_bloc.dart @@ -1,4 +1,3 @@ - import 'dart:async'; import 'dart:developer'; @@ -12,7 +11,6 @@ import 'package:hub/shared/components/molecules/modules/index.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; - class MenuEvent {} class MenuState { @@ -35,7 +33,8 @@ class MenuBloc extends Bloc { final List entries; late StreamSubscription _completer; - MenuBloc({required this.style, required this.item, required this.entries}) : super(MenuState()) { + MenuBloc({required this.style, required this.item, required this.entries}) + : super(MenuState()) { on(_onMenuEvent); _completer = LocalsRepositoryImpl.license.stream.listen((v) { add(MenuEvent()); @@ -44,8 +43,9 @@ class MenuBloc extends Bloc { Future _onMenuEvent(MenuEvent event, Emitter emit) async { await LicenseRemoteDataSourceImpl().waitForSaveCompletion(); - - final List newEntries = await MenuRepositoryImpl().generateMenuEntries(entries, item); + + final List newEntries = + await MenuRepositoryImpl().generateMenuEntries(entries, item); emit(state.copyWith(menuEntries: newEntries)); } @@ -54,6 +54,4 @@ class MenuBloc extends Bloc { _completer.cancel(); return super.close(); } - - } diff --git a/lib/shared/components/molecules/menu/presentation/blocs/menu_view_bloc.dart b/lib/shared/components/molecules/menu/presentation/blocs/menu_view_bloc.dart index bd77e2de..722ffc6d 100644 --- a/lib/shared/components/molecules/menu/presentation/blocs/menu_view_bloc.dart +++ b/lib/shared/components/molecules/menu/presentation/blocs/menu_view_bloc.dart @@ -1,5 +1,3 @@ - - import 'package:flutter_bloc/flutter_bloc.dart'; class MenuViewEvent {} diff --git a/lib/shared/components/molecules/menu/presentation/index.dart b/lib/shared/components/molecules/menu/presentation/index.dart index 2bb09756..8351c972 100644 --- a/lib/shared/components/molecules/menu/presentation/index.dart +++ b/lib/shared/components/molecules/menu/presentation/index.dart @@ -1,3 +1,3 @@ export 'blocs/index.dart'; export 'widgets/index.dart'; -export 'mappers/index.dart'; \ No newline at end of file +export 'mappers/index.dart'; diff --git a/lib/shared/components/molecules/menu/presentation/mappers/menu_entry.dart b/lib/shared/components/molecules/menu/presentation/mappers/menu_entry.dart index 6d7ac800..0bcd26a8 100644 --- a/lib/shared/components/molecules/menu/presentation/mappers/menu_entry.dart +++ b/lib/shared/components/molecules/menu/presentation/mappers/menu_entry.dart @@ -154,7 +154,8 @@ class MenuEntry implements BaseModule { MenuEntry( key: 'FRE-HUB-PETS', icon: Icons.pets, - name: FFLocalizations.of(navigatorKey.currentContext!).getVariableText(ptText: 'Cadastrar Pets', enText: 'Pets Register'), + name: FFLocalizations.of(navigatorKey.currentContext!) + .getVariableText(ptText: 'Cadastrar Pets', enText: 'Pets Register'), route: '/petsPage', types: [MenuEntryType.Home, MenuEntryType.Drawer], ), diff --git a/lib/shared/components/molecules/menu/presentation/widgets/index.dart b/lib/shared/components/molecules/menu/presentation/widgets/index.dart index 800e0aa8..b3915d35 100644 --- a/lib/shared/components/molecules/menu/presentation/widgets/index.dart +++ b/lib/shared/components/molecules/menu/presentation/widgets/index.dart @@ -1,4 +1,4 @@ export 'menu_item/index.dart'; export 'menu_view/index.dart'; -export 'menu_factory.dart'; \ No newline at end of file +export 'menu_factory.dart'; diff --git a/lib/shared/components/molecules/menu/presentation/widgets/menu_factory.dart b/lib/shared/components/molecules/menu/presentation/widgets/menu_factory.dart index 79bf3454..6a128366 100644 --- a/lib/shared/components/molecules/menu/presentation/widgets/menu_factory.dart +++ b/lib/shared/components/molecules/menu/presentation/widgets/menu_factory.dart @@ -41,8 +41,6 @@ class Menufactory extends StatelessWidget { return _buildMenuBloc(context); } - - Widget _buildMenuBloc(BuildContext context) { return BlocProvider( create: (context) => MenuBloc( diff --git a/lib/shared/components/molecules/menu/presentation/widgets/menu_item/menu_item_button.dart b/lib/shared/components/molecules/menu/presentation/widgets/menu_item/menu_item_button.dart index 7e861894..b52f0b28 100644 --- a/lib/shared/components/molecules/menu/presentation/widgets/menu_item/menu_item_button.dart +++ b/lib/shared/components/molecules/menu/presentation/widgets/menu_item/menu_item_button.dart @@ -3,7 +3,6 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/shared/components/molecules/menu/index.dart'; - class ButtonMenuItem extends MenuItem { const ButtonMenuItem({ super.key, @@ -100,7 +99,8 @@ class _MenuButtonWidgetState extends State { color: FlutterFlowTheme.of(context).primaryText, fontSize: limitedFontSize, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), + useGoogleFonts: + GoogleFonts.asMap().containsKey('Nunito'), ), ), ), diff --git a/lib/shared/components/molecules/menu/presentation/widgets/menu_item/menu_item_card.dart b/lib/shared/components/molecules/menu/presentation/widgets/menu_item/menu_item_card.dart index b120a09d..d2aa5693 100644 --- a/lib/shared/components/molecules/menu/presentation/widgets/menu_item/menu_item_card.dart +++ b/lib/shared/components/molecules/menu/presentation/widgets/menu_item/menu_item_card.dart @@ -3,7 +3,6 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/shared/components/molecules/menu/index.dart'; - class CardMenuItem extends MenuItem { const CardMenuItem({ super.key, @@ -54,7 +53,8 @@ class _MenuCardItemState extends State { Align( alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 10.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 10.0, 0.0), child: Container( width: 30.0, height: 30.0, diff --git a/lib/shared/components/molecules/menu/presentation/widgets/menu_view/menu_list_view.dart b/lib/shared/components/molecules/menu/presentation/widgets/menu_view/menu_list_view.dart index 277fd2c3..cd0e6f58 100644 --- a/lib/shared/components/molecules/menu/presentation/widgets/menu_view/menu_list_view.dart +++ b/lib/shared/components/molecules/menu/presentation/widgets/menu_view/menu_list_view.dart @@ -83,7 +83,8 @@ class _MenuListViewState extends State { itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.all(8.0), - child: SizedBox(height: 115, width: 115, child: widget.options[index]), + child: + SizedBox(height: 115, width: 115, child: widget.options[index]), ); }, ), @@ -104,7 +105,8 @@ class _MenuListViewState extends State { itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.all(8.0), - child: SizedBox(height: 115, width: 115, child: widget.options[index]), + child: + SizedBox(height: 115, width: 115, child: widget.options[index]), ); }, ), diff --git a/lib/shared/components/molecules/menu/presentation/widgets/menu_view/menu_staggered_view.dart b/lib/shared/components/molecules/menu/presentation/widgets/menu_view/menu_staggered_view.dart index fbaf5056..07f77818 100644 --- a/lib/shared/components/molecules/menu/presentation/widgets/menu_view/menu_staggered_view.dart +++ b/lib/shared/components/molecules/menu/presentation/widgets/menu_view/menu_staggered_view.dart @@ -13,7 +13,12 @@ class MenuStaggeredViewModel extends FlutterFlowModel { } class MenuStaggeredView extends StatefulWidget { - const MenuStaggeredView({super.key, required this.changeMenuStyle, required this.item, required this.options, required this.isGrid}); + const MenuStaggeredView( + {super.key, + required this.changeMenuStyle, + required this.item, + required this.options, + required this.isGrid}); final EnumMenuItem item; final bool isGrid; @@ -55,7 +60,9 @@ class _MenuStaggeredViewState extends State { return Column( children: [ _buildGridView(crossAxisCount), - ].addToStart(const SizedBox(height: 30)).addToEnd(const SizedBox(height: 30)), + ] + .addToStart(const SizedBox(height: 30)) + .addToEnd(const SizedBox(height: 30)), ); } diff --git a/lib/shared/components/molecules/modules/constants/index.dart b/lib/shared/components/molecules/modules/constants/index.dart index 20bc3626..799c6845 100644 --- a/lib/shared/components/molecules/modules/constants/index.dart +++ b/lib/shared/components/molecules/modules/constants/index.dart @@ -1 +1 @@ -export 'license_constants.dart'; \ No newline at end of file +export 'license_constants.dart'; diff --git a/lib/shared/components/molecules/modules/constants/license_constants.dart b/lib/shared/components/molecules/modules/constants/license_constants.dart index 6a4a2fcc..ea2bf899 100644 --- a/lib/shared/components/molecules/modules/constants/license_constants.dart +++ b/lib/shared/components/molecules/modules/constants/license_constants.dart @@ -1,8 +1,7 @@ +const String tableLicense = 'license'; - const String tableLicense = 'license'; - - class LicenseConstants { - static String get createLicenseTable => ''' +class LicenseConstants { + static String get createLicenseTable => ''' CREATE TABLE IF NOT EXISTS $tableLicense ( key TEXT UNIQUE, display TEXT, @@ -12,9 +11,9 @@ ); '''; - static String get deleteLicenseTable => 'DROP TABLE IF EXISTS $tableLicense;'; + static String get deleteLicenseTable => 'DROP TABLE IF EXISTS $tableLicense;'; - static String get updatePetsHistoryTrigger => ''' + static String get updatePetsHistoryTrigger => ''' CREATE TRIGGER update_fre_hub_pets_history AFTER INSERT ON $tableLicense WHEN NEW.key = 'FRE-HUB-PETS' @@ -24,9 +23,10 @@ END; '''; - static String get dropPetsHistoryTrigger => 'DROP TRIGGER IF EXISTS update_fre_hub_pets_history;'; + static String get dropPetsHistoryTrigger => + 'DROP TRIGGER IF EXISTS update_fre_hub_pets_history;'; - static String get updateDisplayTrigger => ''' + static String get updateDisplayTrigger => ''' CREATE TRIGGER update_display_trigger AFTER UPDATE ON $tableLicense WHEN NEW.key IN ('FRE-HUB-OPENED-VISITS', 'FRE-HUB-VEHICLES', 'FRE-HUB-RESIDENTS') @@ -44,9 +44,10 @@ END; '''; - static String get dropUpdateDisplayTrigger => 'DROP TRIGGER IF EXISTS update_display_trigger;'; + static String get dropUpdateDisplayTrigger => + 'DROP TRIGGER IF EXISTS update_display_trigger;'; - static String get insertDisplayTrigger => ''' + static String get insertDisplayTrigger => ''' CREATE TRIGGER insert_display_trigger AFTER INSERT ON $tableLicense WHEN NEW.key IN ('FRE-HUB-OPENED-VISITS', 'FRE-HUB-VEHICLES', 'FRE-HUB-RESIDENTS') @@ -62,9 +63,10 @@ END; '''; - static String get dropInsertDisplayTrigger => 'DROP TRIGGER IF EXISTS insert_display_trigger;'; + static String get dropInsertDisplayTrigger => + 'DROP TRIGGER IF EXISTS insert_display_trigger;'; - static String get updatePeopleDisplayTrigger => ''' + static String get updatePeopleDisplayTrigger => ''' CREATE TRIGGER update_people_display_trigger AFTER UPDATE ON $tableLicense WHEN NEW.key IN ('FRE-HUB-OPENED-VISITS', 'FRE-HUB-VEHICLES', 'FRE-HUB-RESIDENTS') @@ -80,5 +82,6 @@ END; '''; - static String get dropPeopleDisplayTrigger => 'DROP TRIGGER IF EXISTS update_people_display_trigger;'; - } \ No newline at end of file + static String get dropPeopleDisplayTrigger => + 'DROP TRIGGER IF EXISTS update_people_display_trigger;'; +} diff --git a/lib/shared/components/molecules/modules/data/data_sources/license_local_data_source.dart b/lib/shared/components/molecules/modules/data/data_sources/license_local_data_source.dart index ff502e5f..25e9d256 100644 --- a/lib/shared/components/molecules/modules/data/data_sources/license_local_data_source.dart +++ b/lib/shared/components/molecules/modules/data/data_sources/license_local_data_source.dart @@ -1,4 +1,3 @@ - import 'dart:developer'; import 'package:hub/shared/components/molecules/modules/index.dart'; @@ -19,18 +18,19 @@ abstract class LicenseLocalDataSource { } class LicenseLocalDataSourceImpl implements LicenseLocalDataSource { - static final LicenseLocalDataSourceImpl _instance = LicenseLocalDataSourceImpl._internal(); + static final LicenseLocalDataSourceImpl _instance = + LicenseLocalDataSourceImpl._internal(); factory LicenseLocalDataSourceImpl() => _instance; LicenseLocalDataSourceImpl._internal(); - @override Future init() async { await DatabaseStorage.instance.init(); } @override - Future setDisplayByKey(final List keys, final String display) async { + Future setDisplayByKey( + final List keys, final String display) async { if (keys.isEmpty) return; final validKeys = keys.where((key) => key.isNotEmpty).toList(); for (var key in validKeys) { @@ -45,19 +45,20 @@ class LicenseLocalDataSourceImpl implements LicenseLocalDataSource { @override Future isNewVersion() async { - final String? reponse = await StorageHelper().get(KeychainStorageKey.isNewVersion.value); + final String? reponse = + await StorageHelper().get(KeychainStorageKey.isNewVersion.value); final bool isNewVersion = reponse.toBoolean(); return isNewVersion; } @override Future get(String key) async { - var response = await DatabaseStorage.database.query(tableLicense, where: 'key = ?', whereArgs: [key]); + var response = await DatabaseStorage.database + .query(tableLicense, where: 'key = ?', whereArgs: [key]); if (response.isEmpty) { return null; } - - + return response.toString(); } @@ -66,22 +67,28 @@ class LicenseLocalDataSourceImpl implements LicenseLocalDataSource { value as Map; if (value.isEmpty) return; if (key == 'null') return; - - await DatabaseStorage.database.rawInsert( + + await DatabaseStorage.database.rawInsert( 'INSERT OR REPLACE INTO $tableLicense (key, display, expirationDate, startDate, quantity) VALUES (?, ?, ?, ?, ?)', - [key, value['display'], value['expirationDate'], value['startDate'], value['quantity']], + [ + key, + value['display'], + value['expirationDate'], + value['startDate'], + value['quantity'] + ], ); return; } @override Future del(String key) async { - await DatabaseStorage.database.delete(tableLicense, where: 'key = ?', whereArgs: [key]); + await DatabaseStorage.database + .delete(tableLicense, where: 'key = ?', whereArgs: [key]); } @override Future clear() async { await DatabaseStorage.database.delete(tableLicense); - } } diff --git a/lib/shared/components/molecules/modules/data/data_sources/license_remote_data_source.dart b/lib/shared/components/molecules/modules/data/data_sources/license_remote_data_source.dart index 9927d370..c47abfd2 100644 --- a/lib/shared/components/molecules/modules/data/data_sources/license_remote_data_source.dart +++ b/lib/shared/components/molecules/modules/data/data_sources/license_remote_data_source.dart @@ -18,51 +18,48 @@ abstract class LicenseRemoteDataSource { } class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource { - static final LicenseRemoteDataSourceImpl _instance = LicenseRemoteDataSourceImpl._internal(); + static final LicenseRemoteDataSourceImpl _instance = + LicenseRemoteDataSourceImpl._internal(); factory LicenseRemoteDataSourceImpl() => _instance; LicenseRemoteDataSourceImpl._internal(); - - - - @override Future processLicense() async {} @override Future cleanLicense() async { LocalsRepositoryImpl.license.add(false); - } - @override + @override Future setupLicense(Database database, bool isNewVersion) async { log('Setting up license...'); try { - final License license = await License.getLicense(isNewVersion); + final License license = await License.getLicense(isNewVersion); - final List inactiveModuleKey = license.modules - .where((module) => module.display == ModuleStatus.inactive.key) - .map((module) => module.key) - .toList(); + final List inactiveModuleKey = license.modules + .where((module) => module.display == ModuleStatus.inactive.key) + .map((module) => module.key) + .toList(); - final List activeModuleKey = license.modules - .where((module) => module.display == ModuleStatus.active.key) - .map((module) => module.key) - .toList(); + final List activeModuleKey = license.modules + .where((module) => module.display == ModuleStatus.active.key) + .map((module) => module.key) + .toList(); - final List disabledModuleKey = license.modules - .where((module) => module.display == ModuleStatus.disabled.key) - .map((module) => module.key) - .toList(); + final List disabledModuleKey = license.modules + .where((module) => module.display == ModuleStatus.disabled.key) + .map((module) => module.key) + .toList(); - await LicenseLocalDataSourceImpl().setDisplayByKey(inactiveModuleKey, 'INVISIVEL'); - await LicenseLocalDataSourceImpl().setDisplayByKey(activeModuleKey, 'VISIVEL'); - await LicenseLocalDataSourceImpl().setDisplayByKey(disabledModuleKey, 'DESABILITADO'); - - - - return true; + await LicenseLocalDataSourceImpl() + .setDisplayByKey(inactiveModuleKey, 'INVISIVEL'); + await LicenseLocalDataSourceImpl() + .setDisplayByKey(activeModuleKey, 'VISIVEL'); + await LicenseLocalDataSourceImpl() + .setDisplayByKey(disabledModuleKey, 'DESABILITADO'); + + return true; } catch (e, s) { log('Erro ao configurar licenças: $e', stackTrace: s); return false; @@ -76,11 +73,9 @@ class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource { final response = await PhpGroup.getLicense(); final dynamic responseBody = response.jsonBody; - if (responseBody == []) { return true; - } - else if (response.jsonBody is! List) { + } else if (response.jsonBody is! List) { late final String error; if (response.jsonBody is Map) error = response.jsonBody['error_msg']; @@ -90,8 +85,6 @@ class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource { throw Exception('Erro ao consultar licenças: $error'); } - - List> saveOperations = []; for (var element in responseBody) { if (licenseContainsKey(element['key'])) { @@ -112,7 +105,6 @@ class LicenseRemoteDataSourceImpl implements LicenseRemoteDataSource { } static bool licenseContainsKey(final String key) { - return LicenseKeys.values.map((e) => e.value).toList().contains(key); } diff --git a/lib/shared/components/molecules/modules/data/models/license_model.dart b/lib/shared/components/molecules/modules/data/models/license_model.dart index 1bbf5d3f..48e215cc 100644 --- a/lib/shared/components/molecules/modules/data/models/license_model.dart +++ b/lib/shared/components/molecules/modules/data/models/license_model.dart @@ -11,5 +11,6 @@ class LicenseModel with _$LicenseModel { required List modules, }) = _LicenseModel; - factory LicenseModel.fromJson(Map json) => _$LicenseModelFromJson(json); + factory LicenseModel.fromJson(Map json) => + _$LicenseModelFromJson(json); } diff --git a/lib/shared/components/molecules/modules/data/models/module_model.dart b/lib/shared/components/molecules/modules/data/models/module_model.dart index c45efffe..e373edc3 100644 --- a/lib/shared/components/molecules/modules/data/models/module_model.dart +++ b/lib/shared/components/molecules/modules/data/models/module_model.dart @@ -14,5 +14,6 @@ class ModuleModel with _$ModuleModel { required int quantity, }) = _ModuleModel; - factory ModuleModel.fromJson(Map json) => _$ModuleModelFromJson(json); + factory ModuleModel.fromJson(Map json) => + _$ModuleModelFromJson(json); } diff --git a/lib/shared/components/molecules/modules/data/repositories/license_repository_impl.dart b/lib/shared/components/molecules/modules/data/repositories/license_repository_impl.dart index 1ef3589a..824315c6 100644 --- a/lib/shared/components/molecules/modules/data/repositories/license_repository_impl.dart +++ b/lib/shared/components/molecules/modules/data/repositories/license_repository_impl.dart @@ -10,26 +10,23 @@ typedef LicenseStatus = bool; class LicenseRepositoryImpl implements LicenseRepository { final LicenseLocalDataSource localDataSource = LicenseLocalDataSourceImpl(); - final LicenseRemoteDataSource remoteDataSource = LicenseRemoteDataSourceImpl(); + final LicenseRemoteDataSource remoteDataSource = + LicenseRemoteDataSourceImpl(); final Database database = DatabaseStorage.database; LicenseRepositoryImpl(); - - @override Future updateLicense() async { log('updateLicense'); bool result = false; final bool isNewVersion = await localDataSource.isNewVersion(); result = await remoteDataSource.setupLicense(database, isNewVersion); - if (isNewVersion) { - result = await remoteDataSource.fetchLicenses(isNewVersion); - } + if (isNewVersion) { + result = await remoteDataSource.fetchLicenses(isNewVersion); + } - return result; - } @override diff --git a/lib/shared/components/molecules/modules/domain/entities/base_module.dart b/lib/shared/components/molecules/modules/domain/entities/base_module.dart index ef2c82a8..1cfbeef0 100644 --- a/lib/shared/components/molecules/modules/domain/entities/base_module.dart +++ b/lib/shared/components/molecules/modules/domain/entities/base_module.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; - - abstract class BaseModule { String get key; String get name; diff --git a/lib/shared/components/molecules/modules/domain/entities/license.dart b/lib/shared/components/molecules/modules/domain/entities/license.dart index 045e5559..9864b87b 100644 --- a/lib/shared/components/molecules/modules/domain/entities/license.dart +++ b/lib/shared/components/molecules/modules/domain/entities/license.dart @@ -61,7 +61,9 @@ class License { } static Future _precessWpp() async { - final bool whatsapp = await StorageHelper().get(KeychainStorageKey.whatsapp.value).then((v) => v.toBoolean()); + final bool whatsapp = await StorageHelper() + .get(KeychainStorageKey.whatsapp.value) + .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(KeychainStorageKey.provisional.value).then((v) => v.toBoolean()); + final bool provisional = await StorageHelper() + .get(KeychainStorageKey.provisional.value) + .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(KeychainStorageKey.pets.value).then((v) => v.toBoolean()); + final bool pets = await StorageHelper() + .get(KeychainStorageKey.pets.value) + .then((v) => v.toBoolean()); if (pets) return ModuleStatus.active.key; else @@ -134,21 +140,27 @@ 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, ), 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, @@ -211,14 +223,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/shared/components/molecules/modules/domain/entities/module.dart b/lib/shared/components/molecules/modules/domain/entities/module.dart index 7dc2e8c2..7cea6613 100644 --- a/lib/shared/components/molecules/modules/domain/entities/module.dart +++ b/lib/shared/components/molecules/modules/domain/entities/module.dart @@ -1,6 +1,5 @@ import 'package:hub/shared/components/molecules/modules/data/models/module_model.dart'; - enum ModuleStatus { active, inactive, disabled } enum EnumDisplay { @@ -26,7 +25,6 @@ enum EnumDisplay { } } - extension ModuleStatusExtension on ModuleStatus { String get key { switch (this) { @@ -40,7 +38,6 @@ extension ModuleStatusExtension on ModuleStatus { } } - class Module { final String key; final String display; @@ -48,14 +45,12 @@ class Module { final String startDate; final int quantity; - Module({ required this.key, required this.display, required this.expirationDate, required this.startDate, required this.quantity, - }); factory Module.fromModel(ModuleModel model) { @@ -77,6 +72,4 @@ class Module { quantity: quantity, ); } - - } diff --git a/lib/shared/components/molecules/modules/domain/usecases/index.dart b/lib/shared/components/molecules/modules/domain/usecases/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/modules/domain/usecases/index.dart +++ b/lib/shared/components/molecules/modules/domain/usecases/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/molecules/modules/index.dart b/lib/shared/components/molecules/modules/index.dart index 385ad97a..9e2e57a1 100644 --- a/lib/shared/components/molecules/modules/index.dart +++ b/lib/shared/components/molecules/modules/index.dart @@ -1,4 +1,4 @@ export 'data/index.dart'; export 'domain/index.dart'; export 'presentation/index.dart'; -export 'constants/index.dart'; \ No newline at end of file +export 'constants/index.dart'; diff --git a/lib/shared/components/molecules/modules/presentation/blocs/index.dart b/lib/shared/components/molecules/modules/presentation/blocs/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/modules/presentation/blocs/index.dart +++ b/lib/shared/components/molecules/modules/presentation/blocs/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/molecules/modules/presentation/widgets/index.dart b/lib/shared/components/molecules/modules/presentation/widgets/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/molecules/modules/presentation/widgets/index.dart +++ b/lib/shared/components/molecules/modules/presentation/widgets/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/templates/history/history_page_template.dart b/lib/shared/components/templates/history/history_page_template.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/templates/history/history_page_template.dart +++ b/lib/shared/components/templates/history/history_page_template.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/templates/home/home_page_template.dart b/lib/shared/components/templates/home/home_page_template.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/templates/home/home_page_template.dart +++ b/lib/shared/components/templates/home/home_page_template.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/components/templates/schedule/schedule_page_template.dart b/lib/shared/components/templates/schedule/schedule_page_template.dart index e69de29b..8b137891 100644 --- a/lib/shared/components/templates/schedule/schedule_page_template.dart +++ b/lib/shared/components/templates/schedule/schedule_page_template.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/constants/keychain_constants.dart b/lib/shared/constants/keychain_constants.dart index 0aac6594..83019a63 100644 --- a/lib/shared/constants/keychain_constants.dart +++ b/lib/shared/constants/keychain_constants.dart @@ -1,6 +1,6 @@ - const String tableKeychain = 'keychain'; +const String tableKeychain = 'keychain'; - String get createKeychainTable => ''' +String get createKeychainTable => ''' CREATE TABLE IF NOT EXISTS $tableKeychain ( key TEXT UNIQUE, value TEXT, @@ -10,4 +10,4 @@ createdAt TEXT ); '''; - String get deleteKeychainTable => 'DROP TABLE IF EXISTS $tableKeychain;'; \ No newline at end of file +String get deleteKeychainTable => 'DROP TABLE IF EXISTS $tableKeychain;'; diff --git a/lib/shared/extensions/dialog_extensions.dart b/lib/shared/extensions/dialog_extensions.dart index 222154dc..b4c4e86b 100644 --- a/lib/shared/extensions/dialog_extensions.dart +++ b/lib/shared/extensions/dialog_extensions.dart @@ -16,7 +16,8 @@ extension DialogUnavailable on DialogUtil { static Future unavailableCredentials(BuildContext context) { final message = FFLocalizations.of(context).getVariableText( - ptText: "Credenciais inválidas. Selecione um local ou faça o login novamente.", + ptText: + "Credenciais inválidas. Selecione um local ou faça o login novamente.", enText: "Invalid credentials. Select a location or log in again.", ); return DialogUtil.warning(context, message); diff --git a/lib/shared/extensions/flutter_secure_storage_extensions.dart b/lib/shared/extensions/flutter_secure_storage_extensions.dart index e689535d..8bba2507 100644 --- a/lib/shared/extensions/flutter_secure_storage_extensions.dart +++ b/lib/shared/extensions/flutter_secure_storage_extensions.dart @@ -6,23 +6,30 @@ import 'package:synchronized/synchronized.dart'; extension FlutterSecureStorageExtensions on FlutterSecureStorage { static final _lock = Lock(); - Future writeSync({required String key, String? value}) async => await _lock.synchronized(() async { + Future writeSync({required String key, String? value}) async => + await _lock.synchronized(() async { await write(key: key, value: value); }); void remove(String key) => delete(key: key); Future getString(String key) async => await read(key: key); - Future setString(String key, String value) async => await writeSync(key: key, value: value); + Future setString(String key, String value) async => + await writeSync(key: key, value: value); Future getBool(String key) async => (await read(key: key)) == 'true'; - Future setBool(String key, bool? value) async => await writeSync(key: key, value: value.toString()); + Future setBool(String key, bool? value) async => + await writeSync(key: key, value: value.toString()); - Future getInt(String key) async => int.tryParse(await read(key: key) ?? ''); - Future setInt(String key, int value) async => await writeSync(key: key, value: value.toString()); + Future getInt(String key) async => + int.tryParse(await read(key: key) ?? ''); + Future setInt(String key, int value) async => + await writeSync(key: key, value: value.toString()); - Future getDouble(String key) async => double.tryParse(await read(key: key) ?? ''); - Future setDouble(String key, double value) async => await writeSync(key: key, value: value.toString()); + Future getDouble(String key) async => + double.tryParse(await read(key: key) ?? ''); + Future setDouble(String key, double value) async => + await writeSync(key: key, value: value.toString()); Future getObject(String key) async { final value = await read(key: key); @@ -32,12 +39,18 @@ extension FlutterSecureStorageExtensions on FlutterSecureStorage { return value as BuildContext; } - Future?> getStringList(String key) async => await read(key: key).then((result) { + Future?> getStringList(String key) async => + await read(key: key).then((result) { if (result == null || result.isEmpty) { return null; } - return const CsvToListConverter().convert(result).first.map((e) => e.toString()).toList(); + return const CsvToListConverter() + .convert(result) + .first + .map((e) => e.toString()) + .toList(); }); Future setStringList(String key, List value) async => - await writeSync(key: key, value: const ListToCsvConverter().convert([value])); + await writeSync( + key: key, value: const ListToCsvConverter().convert([value])); } diff --git a/lib/shared/helpers/database/database_helper.dart b/lib/shared/helpers/database/database_helper.dart index 1fe11f02..ba26e34d 100644 --- a/lib/shared/helpers/database/database_helper.dart +++ b/lib/shared/helpers/database/database_helper.dart @@ -33,7 +33,7 @@ class DatabaseStorage { onUpgrade: _onUpgrade, onDowngrade: _onDowngrade, onOpen: _onOpen, - onConfigure: _onConfigure, + onConfigure: _onConfigure, ); await LicenseRepositoryImpl().updateLicense(); isInitialized = true; @@ -53,15 +53,17 @@ class DatabaseStorage { await _createTables(database, version); } - Future _onUpgrade(Database database, int oldVersion, int newVersion) async { + Future _onUpgrade( + Database database, int oldVersion, int newVersion) async { print('Upgrading database from version $oldVersion to $newVersion...'); if (oldVersion < 2 && newVersion >= 2) { await _createTables(database, newVersion); } } - Future _onDowngrade(Database database, int oldVersion, int newVersion) async { - print('Downgrading database from version $oldVersion to $newVersion...'); + Future _onDowngrade( + Database database, int oldVersion, int newVersion) async { + print('Downgrading database from version $oldVersion to $newVersion...'); if (oldVersion >= 2 && newVersion < 2) { await _dropTables(database); } diff --git a/lib/shared/helpers/storage/keychain_storage.dart b/lib/shared/helpers/storage/keychain_storage.dart index b86cb7f9..4f261b8e 100644 --- a/lib/shared/helpers/storage/keychain_storage.dart +++ b/lib/shared/helpers/storage/keychain_storage.dart @@ -12,8 +12,6 @@ class KeychainHelper implements BaseStorage { bool _isInitialized = false; - - @override Future init() async { if (_isInitialized) return; @@ -23,8 +21,8 @@ class KeychainHelper implements BaseStorage { @override Future get(String key) async { - - var response = await DatabaseStorage.database.query(tableKeychain, where: 'key = ?', whereArgs: [key]); + var response = await DatabaseStorage.database + .query(tableKeychain, where: 'key = ?', whereArgs: [key]); if (response.isEmpty) { return null; } @@ -34,7 +32,6 @@ class KeychainHelper implements BaseStorage { @override Future set(String key, T value) async { - var date = DateTime.now().toIso8601String(); await DatabaseStorage.database.insert( tableKeychain, @@ -52,19 +49,16 @@ class KeychainHelper implements BaseStorage { @override Future delete(String key) async { - await DatabaseStorage.database.delete(tableKeychain, where: 'key = ?', whereArgs: [key]); + await DatabaseStorage.database + .delete(tableKeychain, where: 'key = ?', whereArgs: [key]); } @override Future clearAll() async { try { await DatabaseStorage.database.delete(tableKeychain); - - } catch (e, s) { log('() => clearAll keychain: $e', stackTrace: s); } } - - } diff --git a/lib/shared/helpers/storage/secure_storage.dart b/lib/shared/helpers/storage/secure_storage.dart index e1138229..18adf900 100644 --- a/lib/shared/helpers/storage/secure_storage.dart +++ b/lib/shared/helpers/storage/secure_storage.dart @@ -41,14 +41,13 @@ class SecureStorage implements BaseStorage { @override Future clearAll() async { log('Clearing SecureStorage'); - try{ - await _secureStorage.deleteAll( - aOptions: AndroidOptions(), - iOptions: IOSOptions(), - ); + try { + await _secureStorage.deleteAll( + aOptions: AndroidOptions(), + iOptions: IOSOptions(), + ); } catch (e, s) { log('Error clearing all: $e', stackTrace: s); } - } } diff --git a/lib/shared/helpers/storage/storage_helper.dart b/lib/shared/helpers/storage/storage_helper.dart index c157698f..2dbc5703 100644 --- a/lib/shared/helpers/storage/storage_helper.dart +++ b/lib/shared/helpers/storage/storage_helper.dart @@ -24,12 +24,14 @@ class StorageHelper { await SharedPreferencesStorage.instance.init(); await KeychainHelper.instance.init(); - String? isFirstRun = await SharedPreferencesStorage.instance.get(SharedPreferencesKey.isFirstRun.value); + String? isFirstRun = await SharedPreferencesStorage.instance + .get(SharedPreferencesKey.isFirstRun.value); if (isFirstRun != 'false') { log('First run'); - await SharedPreferencesStorage.instance.set(SharedPreferencesKey.isFirstRun.value, false); - await SecureStorage.instance.set(SecureStorageKey.isLogged.value, false); + await SharedPreferencesStorage.instance + .set(SharedPreferencesKey.isFirstRun.value, false); + await SecureStorage.instance.set(SecureStorageKey.isLogged.value, false); } } @@ -47,7 +49,10 @@ class StorageHelper { static BaseStorage getInstanceByKey(String key) { if (SecureStorageKey.values.map((e) => e.value).toList().contains(key)) { return SecureStorage.instance; - } else if (SharedPreferencesKey.values.map((e) => e.value).toList().contains(key)) { + } else if (SharedPreferencesKey.values + .map((e) => e.value) + .toList() + .contains(key)) { return SharedPreferencesStorage.instance; } else { return KeychainHelper.instance; diff --git a/lib/shared/index.dart b/lib/shared/index.dart index e69de29b..8b137891 100644 --- a/lib/shared/index.dart +++ b/lib/shared/index.dart @@ -0,0 +1 @@ + diff --git a/lib/shared/services/authentication/authentication_service.dart b/lib/shared/services/authentication/authentication_service.dart index 522382bc..3643ca6d 100644 --- a/lib/shared/services/authentication/authentication_service.dart +++ b/lib/shared/services/authentication/authentication_service.dart @@ -39,7 +39,8 @@ class AuthenticationService { context.go('/receptionPage'); } else { await StorageHelper().set(SecureStorageKey.isLogged.value, true); - context.go('/homePage', extra: {'update': LocalsRepositoryImpl().update}); + context + .go('/homePage', extra: {'update': LocalsRepositoryImpl().update}); } } catch (e, s) { await DialogUtil.errorDefault(context); @@ -57,7 +58,8 @@ class AuthenticationService { final ApiCallResponse? response; final LoginCall callback = PhpGroup.loginCall; String deviceDescription = randomString(10, 10, true, false, false); - await StorageHelper().set(SecureStorageKey.deviceDescription.value, deviceDescription); + await StorageHelper() + .set(SecureStorageKey.deviceDescription.value, deviceDescription); final String? devUUID; final String userUUID; @@ -83,24 +85,29 @@ class AuthenticationService { userDevUUID = response.jsonBody['user']['dev_id']; userName = response.jsonBody['user']['name']; - await StorageHelper().set(KeychainStorageKey.userUUID.value, userUUID); - await StorageHelper().set(KeychainStorageKey.userDevUUID.value, userDevUUID); + await StorageHelper() + .set(KeychainStorageKey.userUUID.value, userUUID); + await StorageHelper() + .set(KeychainStorageKey.userDevUUID.value, userDevUUID); await StorageHelper().set(KeychainStorageKey.status.value, status); - await StorageHelper().set(KeychainStorageKey.userName.value, userName); + await StorageHelper() + .set(KeychainStorageKey.userName.value, userName); await login(context); } else { if (response.jsonBody['error'] == null) { await DialogUtil.errorDefault(context); } else { - await DialogUtil.error(context, response.jsonBody['error_msg'].toString()); + await DialogUtil.error( + context, response.jsonBody['error_msg'].toString()); } } } return; } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed('login.php', emailAdress.toString(), "Login", e, s); + LogUtil.requestAPIFailed( + 'login.php', emailAdress.toString(), "Login", e, s); } } @@ -135,7 +142,8 @@ class AuthenticationService { } } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed('registro.php', email.toString(), "Register", e, s); + LogUtil.requestAPIFailed( + 'registro.php', email.toString(), "Register", e, s); return false; } } @@ -163,8 +171,9 @@ class AuthenticationService { try { final ApiCallResponse? response; final ForgotPasswordCall callback = PhpGroup.forgotPasswordCall; - final String message = FFLocalizations.of(context) - .getVariableText(enText: "Send E-mail Successful!", ptText: "E-mail Enviado com Sucesso!"); + final String message = FFLocalizations.of(context).getVariableText( + enText: "Send E-mail Successful!", + ptText: "E-mail Enviado com Sucesso!"); response = await callback.call(email: email); @@ -177,15 +186,17 @@ class AuthenticationService { } } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed('forgotPassword.php', email, "Forgot Password", e, s); + LogUtil.requestAPIFailed( + 'forgotPassword.php', email, "Forgot Password", e, s); return false; } } - static Future changePassword(BuildContext context, String email, String password, String token) async { + static Future changePassword( + BuildContext context, String email, String password, String token) async { try { - final ApiCallResponse response = - await PhpGroup.changePasswordCall.call(email: email, psswd: password, token: token); + final ApiCallResponse response = await PhpGroup.changePasswordCall + .call(email: email, psswd: password, token: token); if (response.jsonBody['error'] == false) { final String message = FFLocalizations.of(context).getVariableText( @@ -201,7 +212,8 @@ class AuthenticationService { } } catch (e, s) { await DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed('changePassword.php', email, "Change Password", e, s); + LogUtil.requestAPIFailed( + 'changePassword.php', email, "Change Password", e, s); return false; } } @@ -216,7 +228,6 @@ class AuthenticationService { ptText: 'Conta deletada com sucesso', ); return await signOut(context); - } }).catchError((err) { context.pop(); @@ -224,8 +235,8 @@ class AuthenticationService { enText: 'Error deleting account', ptText: 'Erro ao deletar conta', ); - SnackBarUtil.showSnackBar(context, content); - return; + SnackBarUtil.showSnackBar(context, content); + return; }); } catch (err) { context.pop(); diff --git a/lib/shared/services/deeplink/deep_link_service.dart b/lib/shared/services/deeplink/deep_link_service.dart index 5df6ff67..1b44fd44 100644 --- a/lib/shared/services/deeplink/deep_link_service.dart +++ b/lib/shared/services/deeplink/deep_link_service.dart @@ -62,7 +62,8 @@ class DeepLinkService { child: ForgotPasswordScreen(email: email, token: token), ), isScrollControlled: true, - backgroundColor: FlutterFlowTheme.of(navigatorKey.currentContext!).primaryBackground, + backgroundColor: FlutterFlowTheme.of(navigatorKey.currentContext!) + .primaryBackground, showDragHandle: true, useSafeArea: true, enableDrag: true, diff --git a/lib/shared/utils/device_util.dart b/lib/shared/utils/device_util.dart index da41877e..24e7f265 100644 --- a/lib/shared/utils/device_util.dart +++ b/lib/shared/utils/device_util.dart @@ -6,7 +6,8 @@ import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/services.dart'; class DeviceUtil { - static const MethodChannel _channel = MethodChannel("com.freaccess.hub/getAndroidId"); + static const MethodChannel _channel = + MethodChannel("com.freaccess.hub/getAndroidId"); static Future getAndroidId() async { try { @@ -67,7 +68,8 @@ class DeviceUtil { } else if (Platform.isAndroid) { var androidDeviceInfo = await deviceInfo.androidInfo; - return androidDeviceInfo.version.release; // unique ID on Android. e.g . 11 + return androidDeviceInfo + .version.release; // unique ID on Android. e.g . 11 } return null; diff --git a/lib/shared/utils/dialog_util.dart b/lib/shared/utils/dialog_util.dart index d9f1c64d..6804443a 100644 --- a/lib/shared/utils/dialog_util.dart +++ b/lib/shared/utils/dialog_util.dart @@ -32,7 +32,8 @@ class DialogUtil { height: _height, child: Padding( padding: MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget(msg: message, type: EnumThrowException.error)))); + child: ThrowExceptionWidget( + msg: message, type: EnumThrowException.error)))); }); } @@ -45,7 +46,8 @@ class DialogUtil { height: _height, child: Padding( padding: MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget(msg: message, type: EnumThrowException.warning)))); + child: ThrowExceptionWidget( + msg: message, type: EnumThrowException.warning)))); }); } @@ -58,7 +60,8 @@ class DialogUtil { height: _height, child: Padding( padding: MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget(msg: message, type: EnumThrowException.success)))); + child: ThrowExceptionWidget( + msg: message, type: EnumThrowException.success)))); }); } } diff --git a/lib/shared/utils/image_util.dart b/lib/shared/utils/image_util.dart index f180004e..4c55c0dd 100644 --- a/lib/shared/utils/image_util.dart +++ b/lib/shared/utils/image_util.dart @@ -9,7 +9,8 @@ import 'package:path_provider/path_provider.dart'; import '../../flutter_flow/uploaded_file.dart'; class ImageUtils { - static Future convertImageFileToBase64(FFUploadedFile imageFile) async { + static Future convertImageFileToBase64( + FFUploadedFile imageFile) async { List? imageBytes = imageFile.bytes; if (imageBytes != null) { String base64Image = base64Encode(imageBytes); diff --git a/lib/shared/utils/limited_text_size.dart b/lib/shared/utils/limited_text_size.dart index 199dd83b..3356427f 100644 --- a/lib/shared/utils/limited_text_size.dart +++ b/lib/shared/utils/limited_text_size.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; class LimitedFontSizeUtil { - static double getCalculateFontSize( - BuildContext context, double baseFontSize, double maxFontSize, double limitedFontSize) { + static double getCalculateFontSize(BuildContext context, double baseFontSize, + double maxFontSize, double limitedFontSize) { final textScaler = MediaQuery.textScalerOf(context); final double scaledFontSize = baseFontSize * textScaler.scale(1); return scaledFontSize > maxFontSize ? limitedFontSize : scaledFontSize; @@ -14,8 +14,8 @@ class LimitedFontSizeUtil { return noscaledFontSize; } - static double getScaledSizedBoxSize( - BuildContext context, double baseFontSize, double maxFontSize, double sizeIfExceeded, double sizeIfNotExceeded) { + static double getScaledSizedBoxSize(BuildContext context, double baseFontSize, + double maxFontSize, double sizeIfExceeded, double sizeIfNotExceeded) { final textScaler = MediaQuery.textScalerOf(context); final double scaledFontSize = baseFontSize * textScaler.scale(1); return scaledFontSize > maxFontSize ? sizeIfExceeded : sizeIfNotExceeded; diff --git a/lib/shared/utils/loading_util.dart b/lib/shared/utils/loading_util.dart index d30dfec3..f1fa6e75 100644 --- a/lib/shared/utils/loading_util.dart +++ b/lib/shared/utils/loading_util.dart @@ -3,15 +3,16 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; class LoadingUtil { - static Widget buildLoadingIndicator(BuildContext context) { + static Widget buildLoadingIndicator(BuildContext context) { return Center( child: Padding( padding: EdgeInsets.only(top: MediaQuery.of(context).size.height / 10), child: CircularProgressIndicator( - backgroundColor: FlutterFlowTheme.of(navigatorKey.currentContext!).primaryBackground, + backgroundColor: FlutterFlowTheme.of(navigatorKey.currentContext!) + .primaryBackground, color: FlutterFlowTheme.of(navigatorKey.currentContext!).primary, ), ), ); } -} \ No newline at end of file +} diff --git a/lib/shared/utils/log_util.dart b/lib/shared/utils/log_util.dart index 99dfab8e..06be0098 100644 --- a/lib/shared/utils/log_util.dart +++ b/lib/shared/utils/log_util.dart @@ -4,7 +4,8 @@ import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; class LogUtil { - static void requestAPIFailed(String url, String body, String reason, dynamic error, StackTrace stack) async { + static void requestAPIFailed(String url, String body, String reason, + dynamic error, StackTrace stack) async { final fullUrl = "${PhpGroup.getBaseUrl()}/$url"; log("URL: $fullUrl"); log("Body: $body"); @@ -15,6 +16,7 @@ class LogUtil { FirebaseCrashlytics.instance.setCustomKey('URL', fullUrl); FirebaseCrashlytics.instance.setCustomKey('Body', body); - await FirebaseCrashlytics.instance.recordError(error, stack, reason: reason); + await FirebaseCrashlytics.instance + .recordError(error, stack, reason: reason); } } diff --git a/lib/shared/utils/path_util.dart b/lib/shared/utils/path_util.dart index 4692235a..8eda1149 100644 --- a/lib/shared/utils/path_util.dart +++ b/lib/shared/utils/path_util.dart @@ -1,10 +1,8 @@ - import 'package:flutter/material.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; class PathUtil { - static Future nav(String link) async { navigatorKey.currentContext!.push(link, extra: { kTransitionInfoKey: const TransitionInfo( @@ -14,4 +12,4 @@ class PathUtil { ), }); } -} \ No newline at end of file +} diff --git a/lib/shared/utils/share_util.dart b/lib/shared/utils/share_util.dart index e04e11bf..eed7a7dd 100644 --- a/lib/shared/utils/share_util.dart +++ b/lib/shared/utils/share_util.dart @@ -4,8 +4,10 @@ import 'package:share_plus/share_plus.dart'; class ShareUtil { static Future showShare(payload) async { - final cliName = await StorageHelper().get(KeychainStorageKey.clientName.value); - final cliUUID = await StorageHelper().get(KeychainStorageKey.clientUUID.value); + final cliName = + await StorageHelper().get(KeychainStorageKey.clientName.value); + final cliUUID = + await StorageHelper().get(KeychainStorageKey.clientUUID.value); for (var i = 0; i < payload['convites'].length; i++) { await Share.share(''' diff --git a/lib/shared/utils/snackbar_util.dart b/lib/shared/utils/snackbar_util.dart index 1b8ae0d0..7dff08bf 100644 --- a/lib/shared/utils/snackbar_util.dart +++ b/lib/shared/utils/snackbar_util.dart @@ -5,16 +5,21 @@ import 'package:hub/shared/utils/limited_text_size.dart'; import '../../flutter_flow/flutter_flow_theme.dart'; class SnackBarUtil { - static void showSnackBar(BuildContext context, String text, {bool isError = false}) { + static void showSnackBar(BuildContext context, String text, + {bool isError = false}) { double limitedBodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( text, overflow: TextOverflow.clip, - style: TextStyle(color: FlutterFlowTheme.of(context).info, fontSize: limitedBodyFontSize), + style: TextStyle( + color: FlutterFlowTheme.of(context).info, + fontSize: limitedBodyFontSize), ), - backgroundColor: isError ? FlutterFlowTheme.of(context).error : FlutterFlowTheme.of(context).success, + backgroundColor: isError + ? FlutterFlowTheme.of(context).error + : FlutterFlowTheme.of(context).success, duration: const Duration(seconds: 3), behavior: SnackBarBehavior.floating, shape: RoundedRectangleBorder( @@ -28,7 +33,8 @@ class SnackBarUtil { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."), + FFLocalizations.of(context).getVariableText( + ptText: "Não há mais dados.", enText: "No more data."), style: TextStyle( color: Colors.white, fontSize: LimitedFontSizeUtil.getBodyFontSize(context), diff --git a/lib/shared/utils/text_util.dart b/lib/shared/utils/text_util.dart index 344279e9..d2876a0b 100644 --- a/lib/shared/utils/text_util.dart +++ b/lib/shared/utils/text_util.dart @@ -16,8 +16,9 @@ class TextUtil extends StatelessWidget { Widget build(BuildContext context) { var textScale = MediaQuery.textScalerOf(context); var scaledTextSize = textScale.scale(style?.fontSize ?? 14); - double limitedTextSize = - scaledTextSize > (style?.fontSize ?? 14) * 2 ? (style?.fontSize ?? 14) * 2 : scaledTextSize; + double limitedTextSize = scaledTextSize > (style?.fontSize ?? 14) * 2 + ? (style?.fontSize ?? 14) * 2 + : scaledTextSize; return Text( text,