diff --git a/android/app/build.gradle b/android/app/build.gradle index 00885235..42faf3d4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -52,6 +52,7 @@ android { versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true + consumerProguardFiles 'proguard.txt' } compileOptions { diff --git a/android/app/proguard.txt b/android/app/proguard.txt new file mode 100644 index 00000000..8f70253a --- /dev/null +++ b/android/app/proguard.txt @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2016, microG Project Team +# SPDX-License-Identifier: CC0-1.0 + +# Keep AutoSafeParcelables +-keep public class * extends org.microg.safeparcel.AutoSafeParcelable { + @org.microg.safeparcel.SafeParcelable.Field *; + @org.microg.safeparcel.SafeParceled *; +} + +# Keep asInterface method cause it's accessed from SafeParcel +-keepattributes InnerClasses +-keepclassmembers interface * extends android.os.IInterface { + public static class *; +} +-keep public class * extends android.os.Binder { public static *; } \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a04b84f9..6f0588c1 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -49,15 +49,29 @@ /> - + + + + + + + + + + + + + + + + - @@ -86,7 +100,7 @@ - + diff --git a/android/app/src/main/kotlin/com/example/my_project/MainActivity.kt b/android/app/src/main/kotlin/com/freaccess/hub/MainActivity.kt similarity index 64% rename from android/app/src/main/kotlin/com/example/my_project/MainActivity.kt rename to android/app/src/main/kotlin/com/freaccess/hub/MainActivity.kt index a2cb04a0..10a40dac 100644 --- a/android/app/src/main/kotlin/com/example/my_project/MainActivity.kt +++ b/android/app/src/main/kotlin/com/freaccess/hub/MainActivity.kt @@ -2,5 +2,4 @@ package com.freaccess.hub import io.flutter.embedding.android.FlutterFragmentActivity -class MainActivity: FlutterFragmentActivity() { -} \ No newline at end of file +class MainActivity: FlutterFragmentActivity() {} diff --git a/android/gradle.properties b/android/gradle.properties index ed508580..d1327d41 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,5 @@ org.gradle.jvmargs=-Xmx4608m android.useAndroidX=true android.enableJetifier=true +android.enableR8=true +enableProguardInReleaseBuilds = true diff --git a/android/proguard.txt b/android/proguard.txt new file mode 100644 index 00000000..8f70253a --- /dev/null +++ b/android/proguard.txt @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2016, microG Project Team +# SPDX-License-Identifier: CC0-1.0 + +# Keep AutoSafeParcelables +-keep public class * extends org.microg.safeparcel.AutoSafeParcelable { + @org.microg.safeparcel.SafeParcelable.Field *; + @org.microg.safeparcel.SafeParceled *; +} + +# Keep asInterface method cause it's accessed from SafeParcel +-keepattributes InnerClasses +-keepclassmembers interface * extends android.os.IInterface { + public static class *; +} +-keep public class * extends android.os.Binder { public static *; } \ No newline at end of file diff --git a/assets/fonts/SFPRODISPLAYBOLD.OTF b/assets/fonts/SFPRODISPLAYBOLD.OTF new file mode 100644 index 00000000..025b25c2 Binary files /dev/null and b/assets/fonts/SFPRODISPLAYBOLD.OTF differ diff --git a/assets/fonts/SFPRODISPLAYMEDIUM.OTF b/assets/fonts/SFPRODISPLAYMEDIUM.OTF new file mode 100644 index 00000000..b2f7daca Binary files /dev/null and b/assets/fonts/SFPRODISPLAYMEDIUM.OTF differ diff --git a/assets/fonts/SFPRODISPLAYREGULAR.OTF b/assets/fonts/SFPRODISPLAYREGULAR.OTF new file mode 100644 index 00000000..09aaca9f Binary files /dev/null and b/assets/fonts/SFPRODISPLAYREGULAR.OTF differ diff --git a/integration_test/app_test.dart b/integration_test/app_test.dart index bb1a3f8e..57c1d623 100644 --- a/integration_test/app_test.dart +++ b/integration_test/app_test.dart @@ -1,48 +1,248 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:hub/flutter_flow/random_data_util.dart'; import 'package:hub/main.dart'; +import 'package:hub/shared/utils/storage_util.dart'; import 'package:integration_test/integration_test.dart'; + +late WidgetTester widget; + void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); - group('Authentication Tests', () { - setUp(() async { - await initializeApp(); + group('Initialization', () { + setUpAll(() async => await initializeApp().then((_) => StorageUtil().isLogged = false)); + + testWidgets('Test Welcome', (WidgetTester tester) async { + widget = tester; + + await widget.pumpWidget(const App()); + await widget.pumpAndSettle(); + await _navigateToSignIn(); + await _navigateToSignUp(); + await widget.pumpAndSettle(); + await widget.pumpWidget(const App()); + await widget.pumpAndSettle(); + await _navigateToSignUp(); + await _navigateToSignIn(); + await widget.pumpAndSettle(); + + }); - testWidgets('Test MyApp', (WidgetTester tester) async { - await tester.pumpWidget(const App()); - await _navToSignIn(tester); - await _enterCredentialsAndSignIn(tester); - await _login(tester); - }); + group('Terms of Use', (){}); + }); + group('Authentication', () { + group('Sign in', () { + setUpAll(() async => + await initializeApp().then((_) => StorageUtil().isLogged = false)); + + testWidgets('Test Sign In', (WidgetTester tester) async { + widget = tester; + + await widget.pumpWidget(const App()); + await _navigateToSignIn(); + + await _auth({'emailTextFormField': 'erro@exemplo.com', 'passwordTextFormField': '12345678'}); + await _auth({'emailTextFormField': 'email_app@exemplo.com','passwordTextFormField': '12345678'}); + }); + }); + group('Sign up', () { + setUpAll(() async => + await initializeApp().then((_) => StorageUtil().isLogged = false)); + + + testWidgets('Test Sign Up', (WidgetTester tester) async { + widget = tester; + await tester.pumpWidget(const App()); + late String name; + late String email; + late String password; + late Map credentials; + + await _navigateToSignUp(); + + name = 'app'; + email = 'email_app@exemplo.com'; + password = '12345678'; + credentials = { + 'nameTextFormField': name, + 'emailTextFormField': email, + 'passwordTextFormField': password + }; + await _auth(credentials); + + + name = randomString(7, 7, true, true, true); + email = '$name@example.com'; + password = '12345678'; + credentials = { + 'nameTextFormField': name, + 'emailTextFormField': email, + 'passwordTextFormField': password + }; + await _navigateToSignUp(); + await _auth(credentials); + credentials = { + 'emailTextFormField': email, + 'passwordTextFormField': password + }; + await _auth(credentials); + + }); + }); + group('Sign Out', () { + // setUpAll(() async => + // await initializeApp().then((_) => StorageUtil().isLogged = false)); + }); + group('Forgot Password', () { + setUpAll(() async => await initializeApp().then((_) => StorageUtil().isLogged = false)); + + testWidgets('Test Forgot Password', (WidgetTester tester) async { + widget = tester; + late final String addr = randomString(5, 5, true, true, true); + late Map credentials; + + await tester.pumpWidget(const App()); + + await _navigateToSignIn(); + + await _recoveryPassword(); + credentials = {'recoveryTextFormField': '$addr@exemple.com'}; + await _send(credentials); + + await Future.delayed(const Duration(seconds: 2)); + + await _recoveryPassword(); + credentials = {'recoveryTextFormField': 'email_app@exemple.com'}; + await _send(credentials); + + + }); + }); + + }); + + + + group('Localization', (){ + + }); + group('Networking', (){ + + }); + group('Functionality', (){ + + }); + group('Usability', (){ + + }); + group('Performance', (){ + + }); + group('Security', (){ + + }); + group('Accessibility', (){ + + }); + group('Compatibility', (){ + + }); + group('Internationalization', (){ + + }); + + } -Future _navToSignIn(WidgetTester tester) async { - final navToSignIn = find.byKey(const Key('toggleSignInPage')); - if (navToSignIn.evaluate().isNotEmpty) { - await tester.tap(navToSignIn); - await tester.pumpAndSettle(); + + +Future _navigateBackUsingSystemGesture() async => + IntegrationTestWidgetsFlutterBinding.instance.keyboard.isLogicalKeyPressed(LogicalKeyboardKey.escape); + + +Future _navigateToSignUp() async { + await widget.pumpAndSettle(); + final Finder navToSignUp = find.byKey(const ValueKey('toggleSignUpPage')); + if (navToSignUp.evaluate().isNotEmpty) { + await widget.tap(navToSignUp); + await widget.pumpAndSettle(); } } -Future _enterCredentialsAndSignIn(WidgetTester tester) async { - final emailField = find.byKey(const ValueKey('emailField')); - await tester.enterText(emailField, 'test@example.com'); - await tester.pumpAndSettle(); - - final passwordField = find.byKey(const ValueKey('passwordField')); - await tester.enterText(passwordField, 'password123'); - await tester.pumpAndSettle(); +Future _navigateToSignIn() async { + await widget.pumpAndSettle(); + final Finder navToSignIn = find.byKey(const ValueKey('toggleSignInPage')); + expect(navToSignIn, findsOneWidget); + if (navToSignIn.evaluate().isNotEmpty) { + await widget.tap(navToSignIn); + await widget.pumpAndSettle(); + } } -Future _login(WidgetTester tester) async { - // Encontre o botão de login e clique nele - final signInButton = find.byKey(const Key('loginCallback')); - // expect(signInButton, findsOneWidget); - tester.press(signInButton); +Future _recoveryPassword() async { + await widget.pumpAndSettle(); + final Finder forgotPassword = find.byKey(const ValueKey('ForgotPassword')); + if (forgotPassword.evaluate().isNotEmpty) await widget.tap(forgotPassword); + await widget.ensureVisible(forgotPassword); + await widget.pumpAndSettle(); - await tester.pumpAndSettle(); } + + + +Future _auth(Map credentials) async { + await _enterCredentials(credentials); + await _submit('SubmitButtonWidget'); +} + +Future _send(Map credentials) async { + await _enterCredentials(credentials); + await _submit('SendButtonWidget'); +} + + + +Future _enterCredentials(Map credentials) async { + await widget.pumpAndSettle(); + + for (var entry in credentials.entries) { + final Finder field = find.byKey(ValueKey(entry.key)); + await widget.pumpAndSettle(); + expect(field, findsOneWidget); + await widget.enterText(field, entry.value); + await widget.pumpAndSettle(); + } + + await widget.pumpAndSettle(); +} + +Future _submit(String key) async { + await widget.pumpAndSettle(); + final Finder submitButton = find.byKey(ValueKey(key)); + await widget.pumpAndSettle(); + if (submitButton.evaluate().isNotEmpty) { + await widget.tap(submitButton); + await widget.pumpAndSettle(); + } + + + final Finder ThrowExceptionWidget = find.byKey(const ValueKey('ThrowExceptionWidget')); + await widget.pumpAndSettle(); + if (ThrowExceptionWidget.evaluate().isNotEmpty) { + await widget.ensureVisible(ThrowExceptionWidget); + await widget.tap(ThrowExceptionWidget); + await widget.pumpAndSettle(); + } else { + await _navigateBackUsingSystemGesture(); + } + + +} + + + diff --git a/lib/backend/api_requests/api_calls.dart b/lib/backend/api_requests/api_calls.dart index ab798326..0e86bf14 100644 --- a/lib/backend/api_requests/api_calls.dart +++ b/lib/backend/api_requests/api_calls.dart @@ -3,8 +3,6 @@ import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:hub/backend/notifications/firebase_messaging_service.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/validator_util.dart'; @@ -24,6 +22,7 @@ class PhpGroup { static UpdToken updToken = UpdToken(); static RegisterCall registerCall = RegisterCall(); static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall(); + static ChangePasswordCall changePasswordCall = ChangePasswordCall(); static GetLocalsCall getLocalsCall = GetLocalsCall(); static PostScheduleVisitorCall postScheduleVisitorCall = PostScheduleVisitorCall(); @@ -660,12 +659,51 @@ class RegisterCall { } } + +class ChangePasswordCall { + Future call({ + required final String email, + required final String token, + required final String psswd, + }) async { + final String baseUrl = PhpGroup.getBaseUrl(); + final String devUUID = StorageUtil().devUUID; + final String userUUID = StorageUtil().userUUID; + final String cliID = StorageUtil().cliUUID; + + return ApiManager.instance.makeApiCall( + callName: 'changePassword', + apiUrl: '$baseUrl/alterarSenha.php', + callType: ApiCallType.POST, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + params: { + 'email': email, + 'token': token, + 'senha': psswd, + 'devUUID': devUUID, + 'userUUID': userUUID, + 'cliID': cliID, + }, + bodyType: BodyType.X_WWW_FORM_URL_ENCODED, + returnBody: true, + encodeBodyUtf8: false, + decodeUtf8: false, + cache: false, + isStreamingApi: false, + alwaysAllowBody: false, + ); + } +} + class ForgotPasswordCall { Future call({ final String? email, }) async { final String baseUrl = PhpGroup.getBaseUrl(); + return ApiManager.instance.makeApiCall( callName: 'forgotPassword', apiUrl: '$baseUrl/iforgot.php', diff --git a/lib/backend/notifications/firebase_messaging_service.dart b/lib/backend/notifications/firebase_messaging_service.dart index be23aad5..dfe76047 100644 --- a/lib/backend/notifications/firebase_messaging_service.dart +++ b/lib/backend/notifications/firebase_messaging_service.dart @@ -2,7 +2,6 @@ import 'dart:developer'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/storage_util.dart'; diff --git a/lib/backend/notifications/notification_service.dart b/lib/backend/notifications/notification_service.dart index 2b761b8c..8510eac6 100644 --- a/lib/backend/notifications/notification_service.dart +++ b/lib/backend/notifications/notification_service.dart @@ -1,26 +1,17 @@ -import 'dart:developer'; - import 'package:awesome_notifications/awesome_notifications.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/backend/api_requests/api_manager.dart'; -import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart'; import 'package:hub/components/templates_components/details_component/details_component_widget.dart'; import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/storage_util.dart'; -import 'package:sqflite/sqflite.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 = StorageUtil().cliUUID; diff --git a/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart b/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart index 317a3bfa..c1954b20 100644 --- a/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart +++ b/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart @@ -2,11 +2,9 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/molecular_components/menu_item/menu_item.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/storage_util.dart'; -import '../../../app_state.dart'; class MenuButtonWidget extends MenuEntry { const MenuButtonWidget({ 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 596f50ce..cffebe05 100644 --- a/lib/components/atomic_components/shared_components_atoms/custom_datepicker.dart +++ b/lib/components/atomic_components/shared_components_atoms/custom_datepicker.dart @@ -1,10 +1,10 @@ -import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; +// ignore: must_be_immutable class CustomDatePickerUtil extends StatefulWidget { TextEditingController? controller; final FocusNode? focusNode; @@ -37,7 +37,6 @@ class CustomDatePickerUtil extends StatefulWidget { class _CustomDatePickerState extends State { DateTime? _selectedDate; - TimeOfDay? _selectedTime; @override void initState() { diff --git a/lib/components/atomic_components/shared_components_atoms/custom_input.dart b/lib/components/atomic_components/shared_components_atoms/custom_input.dart index 748448b9..765c2c7e 100644 --- a/lib/components/atomic_components/shared_components_atoms/custom_input.dart +++ b/lib/components/atomic_components/shared_components_atoms/custom_input.dart @@ -2,10 +2,9 @@ import 'package:easy_debounce/easy_debounce.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; -import 'package:hub/flutter_flow/flutter_flow_util.dart'; +// ignore: must_be_immutable class CustomInputUtil extends StatefulWidget { final TextEditingController? controller; final String? labelText; 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 950d43de..d0822749 100644 --- a/lib/components/atomic_components/shared_components_atoms/custom_select.dart +++ b/lib/components/atomic_components/shared_components_atoms/custom_select.dart @@ -1,15 +1,12 @@ -import 'dart:developer'; -import 'dart:math'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:hub/components/organism_components/message_well_component/message_well_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_drop_down.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/form_field_controller.dart'; +// ignore: must_be_immutable class CustomSelect extends StatefulWidget { final List options; final List optionsLabel; @@ -61,9 +58,7 @@ class _CustomSelectState extends State { decoration: const BoxDecoration(), child: FlutterFlowDropDown( fillColor: FlutterFlowTheme.of(context).primaryBackground, - controller: widget.controller ??= - FormFieldController( - widget.dropDownValue ??= ''), + controller: widget.controller, options: widget.options, optionLabels: widget.optionsLabel, onChanged: widget.changed, 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 3dda5950..2377b458 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 @@ -1,14 +1,11 @@ -import 'dart:developer'; -import 'dart:typed_data'; - import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/upload_data.dart'; -import 'package:hub/flutter_flow/uploaded_file.dart'; +// ignore: must_be_immutable class MediaUploadButtonUtil extends StatefulWidget { final Function(FFUploadedFile) onUploadComplete; bool isUploading; 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 08180f3d..4c1667fa 100644 --- a/lib/components/atomic_components/shared_components_atoms/submit_button.dart +++ b/lib/components/atomic_components/shared_components_atoms/submit_button.dart @@ -2,9 +2,8 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; -import 'package:json_path/fun_sdk.dart'; +// ignore: must_be_immutable class SubmitButtonUtil extends StatelessWidget { final String labelText; Future Function()? onPressed; diff --git a/lib/components/atomic_components/shared_components_atoms/tabview.dart b/lib/components/atomic_components/shared_components_atoms/tabview.dart index 6ec30597..3798d6d8 100644 --- a/lib/components/atomic_components/shared_components_atoms/tabview.dart +++ b/lib/components/atomic_components/shared_components_atoms/tabview.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; +// ignore: must_be_immutable class TabViewUtil extends StatelessWidget { final BuildContext context; final dynamic model; diff --git a/lib/components/molecular_components/message_opt_modal/opt_modal_widget.dart b/lib/components/molecular_components/message_opt_modal/opt_modal_widget.dart index fe501dc9..01ee6ea1 100644 --- a/lib/components/molecular_components/message_opt_modal/opt_modal_widget.dart +++ b/lib/components/molecular_components/message_opt_modal/opt_modal_widget.dart @@ -175,7 +175,6 @@ class _OptModalWidgetState extends State { @override Widget build(BuildContext context) { double screenWidth = MediaQuery.of(context).size.width; - double screenHeight = MediaQuery.of(context).size.height; return Center( child: Container( 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 ce905389..368ad6b9 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 @@ -4,6 +4,7 @@ import 'package:hub/components/molecular_components/order_filter_modal/order_fil import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; +// ignore: unused_import import 'package:hub/shared/helpers/secure_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; @@ -178,7 +179,6 @@ class _OrderFilterModalWidgetState extends State { @override Widget build(BuildContext context) { double screenWidth = MediaQuery.of(context).size.width; - double screenHeight = MediaQuery.of(context).size.height; return Center( child: Container( 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 324be78c..07008012 100644 --- a/lib/components/molecular_components/throw_exception/throw_exception_widget.dart +++ b/lib/components/molecular_components/throw_exception/throw_exception_widget.dart @@ -11,6 +11,7 @@ import 'throw_exception_model.dart'; export 'throw_exception_model.dart'; +// ignore: must_be_immutable class ThrowExceptionWidget extends StatefulWidget { ThrowExceptionWidget( {super.key, required this.msg, this.type = EnumThrowException.error}); @@ -100,77 +101,63 @@ class _ThrowExceptionWidgetState extends State @override Widget build(BuildContext context) { - return Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - context.pop(); - }, - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Stack( - children: [ - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Icon( - _getIconByType(context), - color: _getColorByType(context), - size: 150.0, - ), - ), - ], - ).animateOnPageLoad(animationsMap['stackOnPageLoadAnimation']!), - Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - _getTitleByType(context), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, - fontSize: 20.0, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 10.0, 0.0, 0.0), - child: Text( - valueOrDefault( - widget.msg, - 'Message Not Found', - ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ].addToStart(const SizedBox(height: 20.0)), + return InkWell( + key: const ValueKey('ThrowExceptionWidget'), + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + context.pop(); + }, + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Stack( + children: [ + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Icon( + _getIconByType(context), + color: _getColorByType(context), + size: 150.0, ), - ], - ), + ), + ], + ).animateOnPageLoad(animationsMap['stackOnPageLoadAnimation']!), + const SizedBox(height: 20.0), + Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + _getTitleByType(context), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontSize: 20.0, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), + child: Text( + valueOrDefault(widget.msg, 'Message Not Found'), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily), + ), + ), + ), + ], ), - ), - ], - ); - } + ], + ), + ), + ); +} } 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 6c498e52..d3c4fb23 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 @@ -3,11 +3,9 @@ import 'package:hub/components/organism_components/bottom_arrow_linked_locals_co import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/storage_util.dart'; -import 'package:provider/provider.dart'; import '/backend/api_requests/api_calls.dart'; import '/flutter_flow/flutter_flow_theme.dart'; diff --git a/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart b/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart index 02a1377a..3471b1af 100644 --- a/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart +++ b/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart @@ -1,18 +1,11 @@ -import 'dart:developer'; - import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart'; -import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/shared/utils/dialog_util.dart'; -import 'package:hub/shared/utils/log_util.dart'; -import 'package:hub/shared/utils/storage_util.dart'; import '/flutter_flow/custom_functions.dart' as functions; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; +import '../../../shared/services/localization/localization_service.dart'; import 'local_profile_component_model.dart'; export 'local_profile_component_model.dart'; @@ -41,9 +34,10 @@ class _LocalProfileComponentWidgetState _model = createModel(context, () => LocalProfileComponentModel()); _model.setOnUpdate(onUpdate: () => setState(() {})); _model.setStateCallback = () => safeSetState(() {}); - + // WidgetsBinding.instance - .addPostFrameCallback((_) async => await processLocals()); + .addPostFrameCallback((_) async => await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null)); + } @override @@ -53,152 +47,14 @@ class _LocalProfileComponentWidgetState super.dispose(); } - Future processData() async { - try { - final GetDadosCall callback = PhpGroup.getDadosCall; - - var response = await callback.call(); - - final error = response.jsonBody['error']; - - if (error == false) { - final bool whatsapp = response.jsonBody['whatsapp'] ?? false; - final bool provisional = response.jsonBody['provisional'] ?? false; - final bool pets = response.jsonBody['pet'] ?? false; - final String petAmountRegister = - response.jsonBody['petAmountRegister'].toString().isEmpty - ? '0' - : response.jsonBody['petAmountRegister'].toString(); - final String name = response.jsonBody['visitado']['VDO_NOME']; - - StorageUtil().whatsapp = whatsapp; - StorageUtil().provisional = provisional; - StorageUtil().pets = pets; - StorageUtil().petAmountRegister = petAmountRegister; - StorageUtil().userName = name; - - safeSetState(() {}); - return; - } else if (error == true) { - log('() => error: $error'); - DialogUtil.warningDefault(context).whenComplete(() => processLocals()); - safeSetState(() {}); - } - - return; - } catch (e, s) { - log('() => error: $e', stackTrace: s); - DialogUtil.warningDefault(context).whenComplete(() => processLocals()); - } - } - - Future processLocals() async { - try { - final GetLocalsCall callback = PhpGroup.getLocalsCall; - - final ApiCallResponse response = await callback.call(); - - final List locals = response.jsonBody['locais'].toList() ?? []; - - for (var local in locals) { - final String status = local['CLU_STATUS']; - log('() => CLU_STATUS: $status'); - } - - final bool isActive = response.jsonBody['locais'] - .where((local) => local['CLU_STATUS'] == 'A') - .toList() - .isNotEmpty; - final bool isInactived = response.jsonBody['locais'] - .where((local) => - local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A') - .toList() - .isNotEmpty; - final bool isUnique = locals.length == 1; - final bool isBlocked = locals[0]['CLU_STATUS'] == 'B'; - final bool isEnabled = isUnique && isActive; - - final bool isDisabled = isUnique && isBlocked; - final bool isUnselected = StorageUtil().cliUUID.isEmpty && - StorageUtil().cliName.isEmpty & StorageUtil().ownerUUID.isEmpty; - final bool isSelected = - StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty; - final bool isUnavailable = isInactived && isUnselected && isUnique; - - if (!mounted) return; - - if (isDisabled) { - if (mounted) context.go('/welcomePage'); - } else if (isUnavailable) { - log('() => isUnavailable'); - try { - StorageUtil().cliName = locals[0]['CLI_NOME']; - StorageUtil().cliUUID = locals[0]['CLI_ID']; - StorageUtil().ownerUUID = locals[0]['CLU_OWNER_ID']; - var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A'); - if (response.jsonBody['error'] == true) { - StorageUtil().cliUUID = ''; - StorageUtil().cliName = ''; - StorageUtil().ownerUUID = ''; - } - if (response.jsonBody['error'] == false) await processData(); - } catch (e, s) { - DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed( - 'responderVinculo.php', '', 'Responder Vínculo', e, s); - } - } else if (isEnabled) { - log('() => isEnabled'); - StorageUtil().cliName = locals[0]['CLI_NOME']; - StorageUtil().cliUUID = locals[0]['CLI_ID']; - StorageUtil().ownerUUID = locals[0]['CLU_OWNER_ID']; - - await processData(); - } else if (isUnselected) { - log('() => isUnselected'); - await showModalSelectLocal(); - } else if (isSelected) { - log('() => isSelected'); - await processData(); - } else { - log('() => else'); - await showModalSelectLocal(); - } - } catch (e) { - log('() => catch: $e'); - if (mounted) await showModalSelectLocal(); - } - } - - Future showModalSelectLocal() async { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, - isDismissible: false, - showDragHandle: false, - useSafeArea: true, - context: context, - builder: (context) => PopScope( - canPop: false, - child: Padding( - padding: MediaQuery.viewInsetsOf(context), - child: const BottomArrowLinkedLocalsComponentWidget(), - ), - ), - ).then((_) async { - onUpdate(); - }); - - await processData(); - } - void onUpdate() { safeSetState(() { _model.getData(); }); } + + @override Widget build(BuildContext context) { return Container( @@ -230,7 +86,7 @@ class _LocalProfileComponentWidgetState hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { - showModalSelectLocal(); + await LocalizationService.selectLocal(context).then((value) => value == true ? onUpdate() : null); }, child: ClipRRect( borderRadius: BorderRadius.circular(200.0), diff --git a/lib/components/organism_components/menu_component/menu_component_model.dart b/lib/components/organism_components/menu_component/menu_component_model.dart index e7578d45..e6f7c1cb 100644 --- a/lib/components/organism_components/menu_component/menu_component_model.dart +++ b/lib/components/organism_components/menu_component/menu_component_model.dart @@ -1,12 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_model.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/shared/extensions/dialog_extensions.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; +import 'package:hub/shared/services/authentication/authentication_service.dart'; import 'package:hub/shared/utils/storage_util.dart'; -import 'package:sqflite/sqflite.dart'; import '/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart'; import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart'; @@ -244,29 +241,20 @@ class MenuComponentModel extends FlutterFlowModel { }); } - Future signOut(BuildContext context) async { + Future Logout(BuildContext context) async { + final String title = FFLocalizations.of(context).getVariableText( + ptText: 'Sair', + enText: 'Logout', + ); + final String content = FFLocalizations.of(context).getVariableText( + ptText: 'Tem certeza que deseja sair?', + enText: 'Are you sure you want to logout?', + ); showAlertDialog( context, - 'Logout', - FFLocalizations.of(context).getVariableText( - enText: 'Are you sure you want to logout?', - ptText: 'Tem certeza', - ), () async { - PhpGroup.unregisterDevice.call(); - StorageUtil.purge(); - - context.go( - '/welcomePage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, - ), - }, - ); - await SQLiteStorageHelper().purge(); - }); + title, + content, + () async => await AuthenticationService.signOut(context)); } Future openPreferencesSettings(BuildContext context) async { diff --git a/lib/components/organism_components/menu_component/menu_component_widget.dart b/lib/components/organism_components/menu_component/menu_component_widget.dart index 032ca758..cd940d59 100644 --- a/lib/components/organism_components/menu_component/menu_component_widget.dart +++ b/lib/components/organism_components/menu_component/menu_component_widget.dart @@ -3,7 +3,6 @@ import 'package:hub/backend/schema/enums/enums.dart'; import 'package:hub/components/atomic_components/menu_button_item/menu_button_item_widget.dart'; import 'package:hub/components/atomic_components/menu_card_item/menu_card_item.dart'; import 'package:hub/components/molecular_components/menu_item/menu_item.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart'; import '/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_widget.dart'; @@ -555,7 +554,7 @@ class _MenuComponentWidgetState extends State { MenuCardItem( icon: Icons.logout, action: () async { - await _model.signOut(context); + await _model.Logout(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( diff --git a/lib/components/organism_components/message_well_component/message_well_component_widget.dart b/lib/components/organism_components/message_well_component/message_well_component_widget.dart index 40005da6..ad05326e 100644 --- a/lib/components/organism_components/message_well_component/message_well_component_widget.dart +++ b/lib/components/organism_components/message_well_component/message_well_component_widget.dart @@ -1,14 +1,11 @@ import 'dart:async'; import 'dart:collection'; -import 'dart:developer'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; @@ -178,7 +175,7 @@ class _MessageWellComponentWidgetState } Widget _buildMessageItem(BuildContext context, dynamic message, int index) { - final theme = FlutterFlowTheme.of(context); + FlutterFlowTheme.of(context); String formatMessageOrigin(String messageOrigin) { final words = messageOrigin.split(' '); final formattedWords = words.map((word) { diff --git a/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart b/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart index f594143b..672f7c4d 100644 --- a/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart +++ b/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart @@ -1,9 +1,9 @@ -import 'package:hub/backend/api_requests/api_manager.dart'; - import 'package:flutter/material.dart'; +import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; +// ignore: unused_import import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:intl/intl.dart'; 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 19bbfa3a..f64303fb 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 @@ -2,13 +2,13 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart'; import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart'; import 'package:hub/flutter_flow/custom_functions.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; class ScheduleVisitDetailWidget extends StatefulWidget { const ScheduleVisitDetailWidget({ @@ -799,22 +799,12 @@ class _ScheduleVisitDetailWidgetState extends State { false) { context.pop(); } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget( - msg: PhpGroup.postScheduleVisitCall.errorMsg( - (_model.postScheduleVisit?.jsonBody ?? ''), - )!, - ), - ); - }, - ).then((value) => safeSetState(() {})); + final String? msg = PhpGroup.postScheduleVisitCall.errorMsg( + (_model.postScheduleVisit?.jsonBody ?? ''), + ); + 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 231bdfb6..58eb0783 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 @@ -1,8 +1,6 @@ +import 'package:flutter/material.dart'; import 'package:hub/components/organism_components/up_arrow_linked_locals_component/up_arrow_linked_locals_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; - -import 'package:flutter/material.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; class UpArrowLinkedLocalsComponentModel diff --git a/lib/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_model.dart b/lib/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_model.dart index 6622fb27..3d747604 100644 --- a/lib/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_model.dart +++ b/lib/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_model.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import '/backend/api_requests/api_calls.dart'; 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 0c36f135..f306eff7 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 @@ -3,7 +3,6 @@ import 'dart:collection'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:provider/provider.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; diff --git a/lib/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart b/lib/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart index b709cc5b..fb2c4b57 100644 --- a/lib/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart +++ b/lib/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import '/flutter_flow/flutter_flow_theme.dart'; 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 ee959e7f..fbfef1cb 100644 --- a/lib/components/templates_components/details_component/details_component_widget.dart +++ b/lib/components/templates_components/details_component/details_component_widget.dart @@ -1,15 +1,12 @@ import 'dart:collection'; -import 'dart:developer'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/templates_components/details_component/details_component_model.dart'; -import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; -import 'package:provider/provider.dart'; + class DetailsComponentWidget extends StatefulWidget { const DetailsComponentWidget({ @@ -35,7 +32,7 @@ class _DetailsComponentWidgetState extends State { late DetailsComponentModel _model; LinkedHashMap get labelsLinkedHashMap => - LinkedHashMap.from(widget.labelsHashMap ?? {}); + LinkedHashMap.from(widget.labelsHashMap); List> get statusLinkedHashMap => widget.statusHashMap diff --git a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart index 88a2f4b8..70f2ede6 100644 --- a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart +++ b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart @@ -1,17 +1,16 @@ -import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/shared/utils/dialog_util.dart'; -import 'package:hub/shared/utils/log_util.dart'; -import 'package:hub/shared/utils/validator_util.dart'; - -import '/backend/api_requests/api_calls.dart'; -import '/flutter_flow/flutter_flow_theme.dart'; -import '/flutter_flow/flutter_flow_util.dart'; -import '/flutter_flow/flutter_flow_widgets.dart'; import 'package:easy_debounce/easy_debounce.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:hub/shared/services/authentication/authentication_service.dart'; +import 'package:hub/shared/utils/validator_util.dart'; + +import '/flutter_flow/flutter_flow_theme.dart'; +import '/flutter_flow/flutter_flow_util.dart'; +import '/flutter_flow/flutter_flow_widgets.dart'; import 'forgot_password_template_component_model.dart'; + export 'forgot_password_template_component_model.dart'; // @@ -74,7 +73,6 @@ class _ForgotPasswordTemplateComponentWidgetState mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - // This row exists for when the "app bar" is hidden on desktop, having a way back for the user can work well. if (responsiveVisibility( context: context, phone: false, @@ -84,6 +82,7 @@ class _ForgotPasswordTemplateComponentWidgetState padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0), child: InkWell( + key: const ValueKey('BackButton'), splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, @@ -104,19 +103,16 @@ class _ForgotPasswordTemplateComponentWidgetState ), ), 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( + 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'), + useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), ), ), ), @@ -128,9 +124,7 @@ class _ForgotPasswordTemplateComponentWidgetState padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), child: Text( - FFLocalizations.of(context).getText( - 'xxm3ajsy' /* ESQUECEU SUA SENHA? */, - ), + FFLocalizations.of(context).getText('xxm3ajsy' /* ESQUECEU SUA SENHA? */), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Outfit', color: FlutterFlowTheme.of(context).primaryText, @@ -145,9 +139,7 @@ class _ForgotPasswordTemplateComponentWidgetState padding: const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0), child: Text( - FFLocalizations.of(context).getText( - 'wu2f7yzo' /* Não se preucupe nós vamos te a... */, - ), + FFLocalizations.of(context).getText('wu2f7yzo' /* Não se preucupe nós vamos te a... */), style: FlutterFlowTheme.of(context).labelMedium.override( fontFamily: 'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primaryText, @@ -168,6 +160,7 @@ class _ForgotPasswordTemplateComponentWidgetState child: SizedBox( width: double.infinity, child: TextFormField( + key: const ValueKey('recoveryTextFormField'), controller: _model.emailAddressTextController, focusNode: _model.emailAddressFocusNode, onChanged: (_) => EasyDebounce.debounce( @@ -180,11 +173,8 @@ class _ForgotPasswordTemplateComponentWidgetState obscureText: false, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( - 'mtz8l7ft' /* E-mail */, - ), - labelStyle: - FlutterFlowTheme.of(context).labelMedium.override( + labelText: FFLocalizations.of(context).getText('mtz8l7ft' /* E-mail */), + labelStyle: FlutterFlowTheme.of(context).labelMedium.override( fontFamily: 'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primary, fontSize: 14.0, @@ -253,39 +243,14 @@ class _ForgotPasswordTemplateComponentWidgetState padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), child: FFButtonWidget( + key: const ValueKey('SendButtonWidget'), onPressed: (_model.emailAddressTextController.text == '' || !ValidatorUtil.isValidEmail( _model.emailAddressTextController.text)) ? null - : () async { - try { - _model.req = await PhpGroup.forgotPasswordCall.call( - email: _model.emailAddressTextController.text, - ); + : () async => AuthenticationService.forgotPassword(context, _model.emailAddressTextController.text), - if (_model.req?.jsonBody['error'] == false) { - await DialogUtil.success( - context, - FFLocalizations.of(context).getVariableText( - enText: "Send E-mail Successful!", - ptText: "E-mail Enviado com Sucesso!")); - context.pop(); - } else { - await DialogUtil.error( - context, _model.req?.jsonBody['error_msg']); - } - setState(() {}); - } catch (error, stack) { - LogUtil.requestAPIFailed( - "iforgot.php", - _model.emailAddressTextController.text, - "Recuperar Senha", - error, - stack); - await DialogUtil.errorDefault(context); - } - }, text: FFLocalizations.of(context).getText( '74rnd5bu' /* Enviar */, ), diff --git a/lib/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_model.dart b/lib/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_model.dart index 63ce5b0e..db1f6d26 100644 --- a/lib/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_model.dart +++ b/lib/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_model.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hub/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; class LiberationHistoryItemDetailsTemplateComponentModel 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 97b7b058..e9a7606c 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 @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; class ScheduleProvisionalVisitPageModel 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 ad763b85..d5af8a30 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 @@ -529,8 +529,7 @@ class _ScheduleProvisionalVisitPageWidgetState initialDate: getCurrentTimestamp, firstDate: - (getCurrentTimestamp ?? - DateTime(1900)), + (getCurrentTimestamp), lastDate: DateTime(2050), builder: (context, child) { return wrapInMaterialDatePickerTheme( diff --git a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart index 2bde3236..0d45259f 100644 --- a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart +++ b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/validator_util.dart'; 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 cc58b32e..efb7adf1 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 @@ -5,7 +5,6 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/image_util.dart'; import 'package:hub/shared/utils/validator_util.dart'; -import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; import '/backend/api_requests/api_calls.dart'; diff --git a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_model.dart b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_model.dart index 8d2d1561..21b10011 100644 --- a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_model.dart +++ b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_model.dart @@ -1,32 +1,19 @@ -import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/flutter_flow/random_data_util.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; -import 'package:hub/shared/utils/device_util.dart'; -import 'package:hub/shared/utils/dialog_util.dart'; -import 'package:hub/shared/utils/log_util.dart'; -import 'package:hub/shared/utils/storage_util.dart'; +import 'package:flutter/material.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'sign_in_template_component_widget.dart' show SignInTemplateComponentWidget; -import 'package:flutter/material.dart'; class SignInTemplateComponentModel extends FlutterFlowModel { - /// State fields for stateful widgets in this component. final formKey = GlobalKey(); final unfocusNode = FocusNode(); - // State field(s) for emailAddress widget. 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 */, @@ -40,8 +27,6 @@ class SignInTemplateComponentModel } return null; } - - // State field(s) for password widget. FocusNode? passwordFocusNode; TextEditingController? passwordTextController; late bool passwordVisibility; @@ -56,106 +41,10 @@ class SignInTemplateComponentModel return null; } - Future checkLocals({ - String? cliUUID, - required BuildContext context, - required FlutterFlowModel model, - }) async { - final GetLocalsCall callback = PhpGroup.getLocalsCall; - final response = await callback.call(); - if (response.jsonBody['error']) { - DialogUtil.errorDefault(context); - return false; - } - List locals = response.jsonBody['locais'] ?? []; - if (locals.isEmpty) { - return false; - } else { - return true; - } - } - Future signInLoginAction( - BuildContext context, - FlutterFlowModel model, { - String? emailAdress, - String? password, - }) async { - try { - final ApiCallResponse? response; - final LoginCall callback = PhpGroup.loginCall; - StorageUtil().deviceDescription = randomString( - 10, - 10, - true, - false, - false, - ); - - final String? devUUID; - final String userUUID; - final String status; - final String userDevUUID; - final String userName; - final String email; - final String passwd; - - email = emailAdress!; - passwd = password!; - - devUUID = await DeviceUtil.getDevUUID(); - - if ((email != '') && (passwd != '')) { - StorageUtil().email = email; - StorageUtil().passwd = passwd; - StorageUtil().devUUID = devUUID!; - response = await callback.call(); - - if (response.jsonBody['error'] == false) { - userUUID = response.jsonBody['uid']; - status = response.jsonBody['user']['status']; - userDevUUID = response.jsonBody['user']['dev_id']; - userName = response.jsonBody['user']['name']; - - StorageUtil().userUUID = userUUID; - StorageUtil().userDevUUID = userDevUUID; - StorageUtil().status = status; - StorageUtil().userName = userName; - - await checkLocals(context: context, model: model).then((value) { - StorageUtil().haveLocal = value; - StorageUtil().isLogged = true; - toggleApp(context); - }); - } else { - if (response.jsonBody['error'] == null) { - DialogUtil.errorDefault(context); - } else { - DialogUtil.error( - context, response.jsonBody['error_msg'].toString()); - } - } - } - - return; - } catch (e, s) { - DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed( - 'login.php', emailAdress.toString(), "Login", e, s); - } - } - - Future toggleApp(BuildContext context) async { - final haveLocal = StorageUtil().haveLocal; - if (haveLocal == true) { - context.go('/homePage'); - } else if (haveLocal == false) { - context.go('/receptionPage'); - } - } @override void initState(BuildContext context) { 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 b9e0dc69..9bd0b5e1 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 @@ -13,6 +13,7 @@ import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; +import '../../../shared/services/authentication/authentication_service.dart'; import 'sign_in_template_component_model.dart'; export 'sign_in_template_component_model.dart'; @@ -99,15 +100,8 @@ class _SignInTemplateComponentWidgetState } bool _isFormInvalid() { - if (_model.emailAddressTextController.text == '' || - _model.passwordTextController.text == '') { - return true; - } - - if (!ValidatorUtil.isValidEmail(_model.emailAddressTextController.text)) { - return true; - } - + if (_model.emailAddressTextController.text == '' || _model.passwordTextController.text == '') return true; + if (!ValidatorUtil.isValidEmail(_model.emailAddressTextController.text)) return true; return false; } @@ -131,14 +125,11 @@ class _SignInTemplateComponentWidgetState mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 35.0, 0.0, 35.0), + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 35.0, 0.0, 35.0), child: Container( width: 548.0, height: 112.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16.0), - ), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.0)), alignment: const AlignmentDirectional(0.0, 0.0), child: Padding( padding: const EdgeInsets.all(20.0), @@ -148,31 +139,24 @@ class _SignInTemplateComponentWidgetState children: [ Expanded( child: Align( - alignment: - const AlignmentDirectional(0.0, 1.0), + alignment: const AlignmentDirectional(0.0, 1.0), child: Padding( padding: const EdgeInsets.all(3.0), child: Text( - FFLocalizations.of(context) - .getVariableText( - ptText: - 'VAMOS LÁ! ENTRE COM A SUA CONTA', - enText: - 'LET\'S GO! SIGN IN WITH YOUR ACCOUNT', + FFLocalizations.of(context).getVariableText( + ptText: 'VAMOS LÁ! ENTRE COM A SUA CONTA', + enText: 'LET\'S GO! SIGN IN WITH YOUR ACCOUNT', ), textAlign: TextAlign.start, style: FlutterFlowTheme.of(context) .displaySmall .override( fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context) - .primaryText, + color: FlutterFlowTheme.of(context).primaryText, fontSize: 24.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - 'Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), ), ), ), @@ -189,8 +173,7 @@ class _SignInTemplateComponentWidgetState decoration: const BoxDecoration(), child: ClipRRect( borderRadius: BorderRadius.circular(8.0), - child: const AtomImageSvgTheme( - filename: 'login', width: 600, height: 155), + child: const AtomImageSvgTheme(filename: 'login', width: 600, height: 155), ), ), Column( @@ -199,16 +182,12 @@ class _SignInTemplateComponentWidgetState Align( alignment: const AlignmentDirectional(0.0, 0.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 34.0, 0.0, 34.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB(34.0, 0.0, 34.0, 0.0), child: Container( width: double.infinity, - constraints: const BoxConstraints( - maxWidth: 570.0, - ), + constraints: const BoxConstraints(maxWidth: 570.0,), decoration: BoxDecoration( - color: FlutterFlowTheme.of(context) - .primaryBackground, + color: FlutterFlowTheme.of(context).primaryBackground, borderRadius: BorderRadius.circular(12.0), shape: BoxShape.rectangle, ), @@ -218,8 +197,7 @@ class _SignInTemplateComponentWidgetState padding: const EdgeInsets.all(32.0), child: Column( mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Form( key: _model.formKey, @@ -237,7 +215,7 @@ class _SignInTemplateComponentWidgetState width: double.infinity, child: TextFormField( key: const ValueKey( - 'emailField'), + 'emailTextFormField'), controller: _model .emailAddressTextController, focusNode: _model @@ -378,324 +356,159 @@ class _SignInTemplateComponentWidgetState ), ), 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( - 'passwordField'), - controller: _model - .passwordTextController, - cursorColor: - FlutterFlowTheme.of( - context) - .primary, - focusNode: - _model.passwordFocusNode, - onChanged: (_) => - EasyDebounce.debounce( + 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(() {}), + 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) + labelText: FFLocalizations.of(context).getText('2x19ce8k' /* Senha */), + labelStyle: FlutterFlowTheme.of(context) .labelLarge .override( - fontFamily: - 'Plus Jakarta Sans', - color: FlutterFlowTheme - .of(context) - .primaryText, + fontFamily: 'Plus Jakarta Sans', + color: FlutterFlowTheme.of(context).primaryText, fontSize: 16.0, letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - useGoogleFonts: - GoogleFonts - .asMap() - .containsKey( - 'Plus Jakarta Sans'), - ), - enabledBorder: - OutlineInputBorder( + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans')), + enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: - FlutterFlowTheme.of( - context) - .customColor1, - width: 0.25, - ), - borderRadius: - BorderRadius.circular( - 12.0), + color: FlutterFlowTheme.of(context).customColor1, + width: 0.25), + borderRadius: BorderRadius.circular(12.0), ), - focusedBorder: - OutlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0xFF1AAB5F), - width: 0.25, - ), - borderRadius: - BorderRadius.circular( - 12.0), + 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), ), - errorBorder: - OutlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0xFFFF5963), - width: 0.25, - ), - borderRadius: - BorderRadius.circular( - 12.0), - ), - focusedErrorBorder: - OutlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0xFFFF5963), - width: 0.25, - ), - borderRadius: - BorderRadius.circular( - 12.0), + focusedErrorBorder: OutlineInputBorder( + borderSide: const BorderSide( + color: Color(0xFFFF5963), + width: 0.25), + borderRadius: BorderRadius.circular(12.0), ), filled: true, - fillColor: - FlutterFlowTheme.of( - context) - .primaryBackground, + fillColor: FlutterFlowTheme.of(context).primaryBackground, suffixIcon: InkWell( - onTap: () => setState( - () => _model - .passwordVisibility = - !_model - .passwordVisibility, - ), - focusNode: FocusNode( - skipTraversal: true), + onTap: () => setState(() => _model.passwordVisibility = !_model.passwordVisibility), + focusNode: FocusNode(skipTraversal: true), child: Icon( - _model.passwordVisibility - ? Icons - .visibility_outlined - : Icons - .visibility_off_outlined, - color: - FlutterFlowTheme.of( - context) - .accent1, - size: 24.0, - ), + _model.passwordVisibility ? Icons.visibility_outlined : Icons.visibility_off_outlined, + color:FlutterFlowTheme.of(context).accent1, + size: 24.0), ), ), - style: FlutterFlowTheme.of( - context) + style: FlutterFlowTheme.of(context) .bodyLarge .override( - fontFamily: - 'Plus Jakarta Sans', - color: - FlutterFlowTheme.of( - context) - .primaryText, + fontFamily: 'Plus Jakarta Sans', + color: FlutterFlowTheme.of(context).primaryText, fontSize: 16.0, 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 - .passwordTextControllerValidator - .asValidator(context), + validator: _model.passwordTextControllerValidator.asValidator(context), ), ), ), ], ), ), + + Builder( builder: (context) { - if (MediaQuery.sizeOf(context).width < - kBreakpointSmall - ? true - : false) { + if (MediaQuery.sizeOf(context).width < kBreakpointSmall ? true : false) { return Column( mainAxisSize: MainAxisSize.max, children: [ 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: _isFormInvalid() ? null : () async { - await _model - .signInLoginAction( - context, - _model, - emailAdress: _model - .emailAddressTextController - .text, - password: _model - .passwordTextController - .text, + await AuthenticationService.signIn(context, _model, + 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, + 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'), - ), + 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( - onPressed: () async { - await widget - .toggleSignUpPage - ?.call(); - }, - text: FFLocalizations.of( - context) - .getText( - '14u7ipws' /* Cadastrar */, + 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, + 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) + FlutterFlowTheme.of(context) .titleSmall .override( - fontFamily: - 'Plus Jakarta Sans', - color: FlutterFlowTheme.of( - context) - .secondaryText, + 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'), + 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), + borderSide: const BorderSide(color: Colors.transparent, width: 1.0), + borderRadius: BorderRadius.circular(12.0), ), showLoadingIndicator: false, ), @@ -705,109 +518,59 @@ class _SignInTemplateComponentWidgetState } else { return Row( mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Padding( padding: const EdgeInsetsDirectional - .fromSTEB(0.0, 0.0, - 0.0, 16.0), + .fromSTEB(0.0, 0.0,0.0, 16.0), child: FFButtonWidget( - key: const ValueKey< - String>( - 'loginCallback'), - onPressed: - _isFormInvalid() - ? null - : () async { + key: const ValueKey('SubmitButtonWidget'), + onPressed: _isFormInvalid() ? null : () async { try { - await _model - .signInLoginAction( + await AuthenticationService.signIn( context, _model, - emailAdress: _model - .emailAddressTextController - .text, - password: _model - .passwordTextController - .text, + emailAdress: _model.emailAddressTextController.text, + password: _model.passwordTextController.text, ); - setState( - () {}); + setState(() {}); } catch (e, s) { - await DialogUtil - .errorDefault( - context); + await DialogUtil.errorDefault(context); LogUtil.requestAPIFailed( 'login.php', - _model - .emailAddressTextController - .text, + _model.emailAddressTextController.text, "Login", - e, - s); + e, s); } }, - text: FFLocalizations.of( - context) - .getText( - '1x926nsn' /* Entrar */, - ), + 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) + 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: - 16.0, - letterSpacing: - 0.0, - fontWeight: - FontWeight - .w500, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - 'Plus Jakarta Sans'), + 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'), ), 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, ), ), ), @@ -818,79 +581,45 @@ class _SignInTemplateComponentWidgetState .fromSTEB(0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( - onPressed: () async { - await widget - .toggleSignUpPage - ?.call(); - }, - text: FFLocalizations.of( - context) - .getText( - 'jwvd4ai1' /* Cadastrar */, - ), + key: const ValueKey('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, + 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) + 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'), + 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, - width: 1.0, - ), - borderRadius: - BorderRadius - .circular(12.0), + borderSide: const BorderSide(color: Colors.transparent,width: 1.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'), splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, @@ -898,100 +627,42 @@ class _SignInTemplateComponentWidgetState onTap: () async { await showModalBottomSheet( isScrollControlled: true, - backgroundColor: - Colors.transparent, + backgroundColor: Colors.transparent, context: context, builder: (context) { return Padding( - padding: - MediaQuery.viewInsetsOf( - context), - child: - const ForgotPasswordTemplateComponentWidget(), + padding: MediaQuery.viewInsetsOf(context), + child: const ForgotPasswordTemplateComponentWidget(), ); - }, - ).then( - (value) => safeSetState(() {})); - }, + }).then((value) => safeSetState(() {})); + }, child: RichText( - textScaler: MediaQuery.of(context) - .textScaler, + textScaler: MediaQuery.of(context).textScaler, text: TextSpan( children: [ TextSpan( - text: FFLocalizations.of( - context) - .getText( - '05dx91ku' /* Você esqueceu a sua senha? */, - ), - style: TextStyle( - color: FlutterFlowTheme.of( - context) - .primaryText, - ), + text: FFLocalizations.of(context).getText('05dx91ku' /* Você esqueceu a sua senha? */,), + style: TextStyle(color: FlutterFlowTheme.of(context).primaryText), ), TextSpan( - text: FFLocalizations.of( - context) - .getText( - 'p5c6d54y' /* Recupere aqui */, - ), - style: FlutterFlowTheme.of( - context) - .bodyMedium - .override( - fontFamily: - 'Plus Jakarta Sans', - color: - FlutterFlowTheme.of( - context) - .primary, + text: FFLocalizations.of(context).getText('p5c6d54y' /* Recupere aqui */), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: 'Plus Jakarta Sans', + color: FlutterFlowTheme.of(context).primary, fontSize: 14.0, letterSpacing: 0.0, - fontWeight: - FontWeight.normal, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - 'Plus Jakarta Sans'), + fontWeight: FontWeight.normal, + useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), ), - mouseCursor: - SystemMouseCursors.click, - // recognizer: TapGestureRecognizer() - // ..onTap = () async { - // await showModalBottomSheet( - // isScrollControlled: true, - // backgroundColor: Colors.transparent, - // context: context, - // useRootNavigator: true, - // builder: (context) { - // return Padding( - // padding: MediaQuery.viewInsetsOf(context), - // child: const ForgotPasswordTemplateComponentWidget(), - // ); - // }, - // ).then((value) => - // safeSetState( - // () {})); - // }, + mouseCursor: SystemMouseCursors.click, ) ], - style: - FlutterFlowTheme.of(context) + 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)), ), ), ), diff --git a/lib/components/templates_components/sign_up_template_component/sign_up_template_component_model.dart b/lib/components/templates_components/sign_up_template_component/sign_up_template_component_model.dart index c4f839da..c07deb16 100644 --- a/lib/components/templates_components/sign_up_template_component/sign_up_template_component_model.dart +++ b/lib/components/templates_components/sign_up_template_component/sign_up_template_component_model.dart @@ -1,25 +1,17 @@ -import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/flutter_flow/random_data_util.dart'; -import 'package:hub/shared/utils/dialog_util.dart'; -import 'package:hub/shared/utils/log_util.dart'; +import 'package:flutter/material.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'sign_up_template_component_widget.dart' show SignUpTemplateComponentWidget; -import 'package:flutter/material.dart'; class SignUpTemplateComponentModel extends FlutterFlowModel { - /// State fields for stateful widgets in this component. final formKey = GlobalKey(); - // State field(s) for nameRegisterForm widget. 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 */, @@ -29,13 +21,10 @@ class SignUpTemplateComponentModel return null; } - // State field(s) for emailRegisterForm widget. FocusNode? emailRegisterFormFocusNode; TextEditingController? emailRegisterFormTextController; - String? Function(BuildContext, String?)? - emailRegisterFormTextControllerValidator; - String? _emailRegisterFormTextControllerValidator( - BuildContext context, String? val) { + String? Function(BuildContext, String?)? emailRegisterFormTextControllerValidator; + String? _emailRegisterFormTextControllerValidator(BuildContext context, String? val) { if (val == null || val.isEmpty) { return FFLocalizations.of(context).getText( 'mlvw63yj' /* Campo é necessário */, @@ -50,14 +39,11 @@ class SignUpTemplateComponentModel return null; } - // State field(s) for passwordRegisterForm widget. 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).getText( '6nn79lmh' /* Campo é necessário */, @@ -73,18 +59,14 @@ class SignUpTemplateComponentModel return null; } - // Stores action output result for [Action Block - signUpRegisterAction] action in SignUpButtonRegisterForm widget. - bool? signUp; + bool? register; @override void initState(BuildContext context) { - nameRegisterFormTextControllerValidator = - _nameRegisterFormTextControllerValidator; - emailRegisterFormTextControllerValidator = - _emailRegisterFormTextControllerValidator; + nameRegisterFormTextControllerValidator = _nameRegisterFormTextControllerValidator; + emailRegisterFormTextControllerValidator = _emailRegisterFormTextControllerValidator; passwordRegisterFormVisibility = false; - passwordRegisterFormTextControllerValidator = - _passwordRegisterFormTextControllerValidator; + passwordRegisterFormTextControllerValidator = _passwordRegisterFormTextControllerValidator; } @override @@ -99,61 +81,6 @@ class SignUpTemplateComponentModel passwordRegisterFormTextController?.dispose(); } - Future signUpRegisterAction( - BuildContext context, { - required String? name, - String? passwd, - required String? email, - String? device, - }) async { - try { - ApiCallResponse? response; - if ((email != null && email != '') && - (passwd != null && passwd != '' && passwd.length > 7) && - (name != null && name != '')) { - response = await PhpGroup.registerCall.call( - name: name, - password: passwd, - email: email, - token: randomString( - 36, - 36, - false, - false, - true, - ), - uuid: randomString( - 36, - 36, - false, - false, - true, - ), - tipo: device!, - descricao: randomString( - 36, - 36, - true, - false, - false, - ), - ); - if (response.jsonBody['error'] == false) { - return true; - } - DialogUtil.error(context, response.jsonBody['error_msg']); - return false; - } else { - DialogUtil.errorDefault(context); - return false; - } - } catch (e, s) { - DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed( - 'registro.php', email.toString(), "Register", e, s); - return false; - } - } } diff --git a/lib/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart b/lib/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart index 8dd9accf..14003cdb 100644 --- a/lib/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart +++ b/lib/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart @@ -4,35 +4,26 @@ import 'package:flutter_animate/flutter_animate.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart'; import 'package:hub/shared/components/atoms/atom_terms_of_use.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/validator_util.dart'; -import 'package:provider/provider.dart'; import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; +import '../../../shared/services/authentication/authentication_service.dart'; import 'sign_up_template_component_model.dart'; export 'sign_up_template_component_model.dart'; class SignUpTemplateComponentWidget extends StatefulWidget { - const SignUpTemplateComponentWidget({ - super.key, - required this.toggleSignInPage, - }); + const SignUpTemplateComponentWidget({super.key, required this.toggleSignInPage}); final Future Function()? toggleSignInPage; - - @override - State createState() => - _SignUpTemplateComponentWidgetState(); + @override State createState() => _SignUpTemplateComponentWidgetState(); } -class _SignUpTemplateComponentWidgetState - extends State with TickerProviderStateMixin { +class _SignUpTemplateComponentWidgetState extends State with TickerProviderStateMixin { late SignUpTemplateComponentModel _model; - final animationsMap = {}; @override @@ -246,6 +237,8 @@ class _SignUpTemplateComponentWidgetState child: SizedBox( width: double.infinity, child: TextFormField( + key: const ValueKey( + 'nameTextFormField'), controller: _model .nameRegisterFormTextController, focusNode: _model @@ -388,6 +381,8 @@ class _SignUpTemplateComponentWidgetState child: SizedBox( width: double.infinity, child: TextFormField( + key: const ValueKey( + 'emailTextFormField'), controller: _model .emailRegisterFormTextController, focusNode: _model @@ -532,6 +527,8 @@ class _SignUpTemplateComponentWidgetState child: SizedBox( width: double.infinity, child: TextFormField( + key: const ValueKey( + 'passwordTextFormField'), controller: _model .passwordRegisterFormTextController, focusNode: _model @@ -631,6 +628,7 @@ class _SignUpTemplateComponentWidgetState context) .primaryBackground, suffixIcon: InkWell( + key: const ValueKey('passwordVisibilitySuffixIcon'), onTap: () => setState( () => _model .passwordRegisterFormVisibility = @@ -685,41 +683,24 @@ class _SignUpTemplateComponentWidgetState padding: const EdgeInsetsDirectional .fromSTEB(0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( + key: const ValueKey('SubmitButtonWidget'), onPressed: isFormInvalid() ? null : () async { var shouldSetState = false; - _model.signUp = await _model - .signUpRegisterAction( - context, - name: _model - .nameRegisterFormTextController - .text, - passwd: _model - .passwordRegisterFormTextController - .text, - email: _model - .emailRegisterFormTextController - .text, - device: - StorageUtil() - .deviceType, + _model.register = await AuthenticationService.signUp(context, + email: _model.emailRegisterFormTextController.text, + name: _model.nameRegisterFormTextController.text, + passwd: _model.passwordRegisterFormTextController.text, + device: StorageUtil().deviceType, ); shouldSetState = true; - if (_model.signUp == true) { - await widget - .toggleSignInPage - ?.call(); - } else { - if (shouldSetState) { - setState(() {}); - } + if (_model.register == true) await widget.toggleSignInPage?.call(); + else { + if (shouldSetState) setState(() {}); return; } - - if (shouldSetState) { - setState(() {}); - } + if (shouldSetState) setState(() {}); }, text: FFLocalizations.of(context) .getText( @@ -774,14 +755,12 @@ class _SignUpTemplateComponentWidgetState padding: const EdgeInsetsDirectional .fromSTEB(0.0, 12.0, 0.0, 12.0), child: InkWell( + 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, diff --git a/lib/components/templates_components/view_visit_detail/view_visit_detail_model.dart b/lib/components/templates_components/view_visit_detail/view_visit_detail_model.dart index 1188b53b..15e64040 100644 --- a/lib/components/templates_components/view_visit_detail/view_visit_detail_model.dart +++ b/lib/components/templates_components/view_visit_detail/view_visit_detail_model.dart @@ -1,10 +1,9 @@ -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; +import 'package:flutter/material.dart'; import 'package:hub/shared/utils/storage_util.dart'; import '/backend/api_requests/api_calls.dart'; import '/flutter_flow/flutter_flow_util.dart'; import 'view_visit_detail_widget.dart' show ViewVisitDetailWidget; -import 'package:flutter/material.dart'; class ViewVisitDetailModel extends FlutterFlowModel { late final String devUUID; diff --git a/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_model.dart b/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_model.dart index d0695010..a8efa6c4 100644 --- a/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_model.dart +++ b/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_model.dart @@ -1,9 +1,7 @@ +import 'package:flutter/material.dart'; import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; - -import 'package:flutter/material.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; class VisitorSearchModalTemplateComponentModel 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 584b48fe..3978059b 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 @@ -12,7 +12,6 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:provider/provider.dart'; class VisitorSearchModalTemplateComponentWidget extends StatefulWidget { const VisitorSearchModalTemplateComponentWidget({ @@ -34,7 +33,6 @@ class _VisitorSearchModalTemplateComponentWidgetState with TickerProviderStateMixin { late VisitorSearchModalTemplateComponentModel _model; - @override safeSetState(VoidCallback callback) { super.setState(callback); _model.onUpdate(); 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 21411d4f..5c0f0aa0 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 @@ -26,11 +26,8 @@ class WelcomeTemplateComponentWidget extends StatefulWidget { _WelcomeTemplateComponentWidgetState(); } -class _WelcomeTemplateComponentWidgetState - extends State - with TickerProviderStateMixin { +class _WelcomeTemplateComponentWidgetState extends State with TickerProviderStateMixin { late WelcomeTemplateComponentModel _model; - final animationsMap = {}; @override @@ -44,38 +41,39 @@ class _WelcomeTemplateComponentWidgetState super.initState(); _model = createModel(context, () => WelcomeTemplateComponentModel()); - animationsMap.addAll({ - 'containerOnPageLoadAnimation': AnimationInfo( - trigger: AnimationTrigger.onPageLoad, - effectsBuilder: () => [ - VisibilityEffect(duration: 1.ms), - FadeEffect( - curve: Curves.easeInOut, - delay: 0.0.ms, - duration: 300.0.ms, - begin: 0.0, - end: 1.0, - ), - MoveEffect( - curve: Curves.easeInOut, - delay: 0.0.ms, - duration: 300.0.ms, - begin: const Offset(0.0, 140.0), - end: const Offset(0.0, 0.0), - ), - ScaleEffect( - curve: Curves.easeInOut, - delay: 0.0.ms, - duration: 300.0.ms, - begin: const Offset(0.9, 0.9), - end: const Offset(1.0, 1.0), - ), - TiltEffect( - curve: Curves.easeInOut, - delay: 0.0.ms, - duration: 300.0.ms, - begin: const Offset(-0.349, 0), - end: const Offset(0, 0), + animationsMap.addAll( + { + 'containerOnPageLoadAnimation': AnimationInfo( + trigger: AnimationTrigger.onPageLoad, + effectsBuilder: () => [ + VisibilityEffect(duration: 1.ms), + FadeEffect( + curve: Curves.easeInOut, + delay: 0.0.ms, + duration: 300.0.ms, + begin: 0.0, + end: 1.0, + ), + MoveEffect( + curve: Curves.easeInOut, + delay: 0.0.ms, + duration: 300.0.ms, + begin: const Offset(0.0, 140.0), + end: const Offset(0.0, 0.0), + ), + ScaleEffect( + curve: Curves.easeInOut, + delay: 0.0.ms, + duration: 300.0.ms, + begin: const Offset(0.9, 0.9), + end: const Offset(1.0, 1.0), + ), + TiltEffect( + curve: Curves.easeInOut, + delay: 0.0.ms, + duration: 300.0.ms, + begin: const Offset(-0.349, 0), + end: const Offset(0, 0), ), ], ), @@ -85,7 +83,6 @@ class _WelcomeTemplateComponentWidgetState @override void dispose() { _model.maybeDispose(); - super.dispose(); } @@ -115,10 +112,7 @@ class _WelcomeTemplateComponentWidgetState child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text( - FFLocalizations.of(context).getText( - 'dsc9tuc8' /* UMA EXPERIÊCIA COMPLETA */, - ), + Text( FFLocalizations.of(context).getText('dsc9tuc8' /* UMA EXPERIÊCIA COMPLETA */), textAlign: TextAlign.start, style: FlutterFlowTheme.of(context) .displaySmall @@ -128,28 +122,22 @@ class _WelcomeTemplateComponentWidgetState fontSize: 24.0, letterSpacing: 0.0, fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), ), ), Align( alignment: const AlignmentDirectional(0.0, -1.0), - child: Text( - FFLocalizations.of(context).getText( - '5bgqn16z' /* COM CONFORTO ONDE VOCÊ ESTIVER... */, - ), + child: Text(FFLocalizations.of(context).getText('5bgqn16z' /* COM CONFORTO ONDE VOCÊ ESTIVER... */), textAlign: TextAlign.start, style: FlutterFlowTheme.of(context) .displaySmall .override( fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context) - .primaryText, + color: FlutterFlowTheme.of(context).primaryText, fontSize: 15.0, letterSpacing: 0.0, fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), + useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), ), ), ), @@ -166,8 +154,7 @@ class _WelcomeTemplateComponentWidgetState decoration: const BoxDecoration(), child: ClipRRect( borderRadius: BorderRadius.circular(0.0), - child: const AtomImageSvgTheme( - filename: 'welcome', width: 600, height: double.infinity), + child: const AtomImageSvgTheme(filename: 'welcome', width: 600, height: double.infinity), ), ), Align( @@ -184,10 +171,7 @@ class _WelcomeTemplateComponentWidgetState BoxShadow( blurRadius: 0.0, color: Colors.transparent, - offset: Offset( - 0.0, - 0.0, - ), + offset: Offset(0.0,0.0), ) ], borderRadius: BorderRadius.circular(12.0), @@ -203,35 +187,23 @@ class _WelcomeTemplateComponentWidgetState children: [ Builder( builder: (context) { - if (MediaQuery.sizeOf(context).width < - kBreakpointSmall - ? true - : false) { + if (MediaQuery.sizeOf(context).width < kBreakpointSmall ? true : false) { return Column( mainAxisSize: MainAxisSize.max, children: [ 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( - '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), + 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( @@ -325,7 +297,10 @@ class _WelcomeTemplateComponentWidgetState padding: const EdgeInsetsDirectional .fromSTEB(0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( + key: const ValueKey('toggleSignInPage'), + onPressed: () async { + await widget.toggleSignInPage ?.call(); }, @@ -378,6 +353,7 @@ class _WelcomeTemplateComponentWidgetState padding: const EdgeInsetsDirectional .fromSTEB(0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( + key: const ValueKey('toggleSignUpPage'), onPressed: () async { await widget.toggleSignUpPage ?.call(); diff --git a/lib/flutter_flow/internationalization.dart b/lib/flutter_flow/internationalization.dart index fc8877a3..ffb64dcd 100644 --- a/lib/flutter_flow/internationalization.dart +++ b/lib/flutter_flow/internationalization.dart @@ -1321,8 +1321,8 @@ final kTranslationsMap = >>[ 'en': '', }, 'mqw2z9f3': { - 'pt': '', - 'en': '', + 'pt': 'INSIRA A NOVA SENHA', + 'en': 'ENTER NEW PASSWORD', }, // misc 'asjd2q3k2j4l21': { diff --git a/lib/flutter_flow/nav/nav.dart b/lib/flutter_flow/nav/nav.dart index 08f590b9..82f65f6b 100644 --- a/lib/flutter_flow/nav/nav.dart +++ b/lib/flutter_flow/nav/nav.dart @@ -5,13 +5,13 @@ import 'package:flutter/material.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/delivery_schedule_page/delivery_schedule_widget.dart'; import 'package:hub/pages/fast_pass_page/fast_pass_page_widget.dart'; +import 'package:hub/pages/forgot_password_page/forgot_password_screen.dart'; import 'package:hub/pages/message_history_page/message_history_page_widget.dart'; import 'package:hub/pages/package_order_page/package_order_page.dart'; import 'package:hub/pages/pets_page/pets_page_widget.dart'; import 'package:hub/pages/provisional_schedule_page/provisional_schedule_widget.dart'; import 'package:hub/pages/reception_page/reception_page_widget.dart'; import 'package:hub/pages/reservation_page/reservation_page_widget.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:provider/provider.dart'; @@ -90,14 +90,24 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) { : const ReceptionPageWidget() : const WelcomePageWidget(), ), + FFRoute( + 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); + + return ForgotPasswordScreen( + key: UniqueKey(), + email: email, + token: token, + ); + } + ), FFRoute( name: 'homePage', path: '/homePage', - builder: (context, params) { - return HomePageWidget( - key: UniqueKey(), - ); - }, + builder: (context, params) => HomePageWidget(key: UniqueKey()), ), FFRoute( name: 'receptionPage', diff --git a/lib/main.dart b/lib/main.dart index 009bf551..a8aa71e9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,8 @@ +import 'dart:async'; import 'dart:developer'; import 'dart:io'; +import 'package:app_links/app_links.dart'; import 'package:app_tracking_transparency/app_tracking_transparency.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart'; @@ -20,9 +22,11 @@ import 'package:responsive_framework/responsive_framework.dart'; final GlobalKey navigatorKey = GlobalKey(); void main() async { + await initializeApp(); runApp(const App()); FirebaseMessaging.onBackgroundMessage(_backgroundHandlerMessage); + } Future initializeApp() async { @@ -109,11 +113,14 @@ class App extends StatefulWidget { } class _AppState extends State { + Locale? _locale = FFLocalizations.getStoredLocale(); ThemeMode _themeMode = FlutterFlowTheme.themeMode; late AppStateNotifier _appStateNotifier; late GoRouter _router; bool displaySplashImage = true; + late AppLinks _appLinks; + StreamSubscription? _linkSubscription; final ThemeData _darkTheme = ThemeData( brightness: Brightness.dark, @@ -131,7 +138,6 @@ class _AppState extends State { }), ), ); - final ThemeData _theme = ThemeData( brightness: Brightness.light, scrollbarTheme: ScrollbarThemeData( @@ -148,20 +154,16 @@ class _AppState extends State { }), ), ); - - final Iterable>? localizationsDelegates = - const [ - FFLocalizationsDelegate(), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ]; - + final Iterable>? localizationsDelegates = const [ + FFLocalizationsDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ]; final Iterable supportedLocales = const [ Locale('pt'), Locale('en'), ]; - Widget Function(BuildContext, Widget?)? builder = (context, widget) { const String HD4K = '4K'; const String ULTRAWIDE = 'ULTRAWIDE'; @@ -179,9 +181,9 @@ class _AppState extends State { ); }; - @override - void initState() { + @override void initState() { super.initState(); + initDeepLinks(); FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); @@ -192,6 +194,38 @@ class _AppState extends State { _setupFirebaseMessaging(); } + @override void dispose() { + _linkSubscription?.cancel(); + super.dispose(); + } + + + Future initDeepLinks() async { + _appLinks = AppLinks(); + + // Handle links + _linkSubscription = _appLinks.uriLinkStream.listen((uri) { + debugPrint('onAppLink: $uri'); + openAppLink(uri); + }); + } + + void openAppLink(Uri uri) { + log('openAppLink'); + log(uri.toString()); + + final String email = uri.queryParameters['email'] ?? ''; + final String token = uri.queryParameters['token'] ?? ''; + + log('Email: $email'); + log('Token: $token'); + + // Use the extracted email and token as needed + // navigatorKey.currentState?.pushNamed('/forgotPassword', arguments: {'email': email, 'token': token}); + if (email.isNotEmpty && token.isNotEmpty) + StorageUtil().context?.push('/forgotPassword', extra: {'email': email, 'token': token}); + + } void _setupFirebaseMessaging() async { FirebaseMessaging messaging = FirebaseMessaging.instance; @@ -220,12 +254,10 @@ class _AppState extends State { } }); } - void setLocale(String language) { setState(() => _locale = createLocale(language)); FFLocalizations.storeLocale(language); } - void setThemeMode(ThemeMode mode) { setState(() { _themeMode = mode; @@ -233,9 +265,11 @@ class _AppState extends State { }); } + @override Widget build(BuildContext context) { return MaterialApp.router( + key: navigatorKey, title: 'FRE ACCESS HUB', builder: builder, localizationsDelegates: localizationsDelegates, @@ -247,4 +281,5 @@ class _AppState extends State { routerConfig: _router, ); } + } diff --git a/lib/pages/acess_history_page/acess_history_page_model.dart b/lib/pages/acess_history_page/acess_history_page_model.dart index 89ca0b9d..e32d744e 100644 --- a/lib/pages/acess_history_page/acess_history_page_model.dart +++ b/lib/pages/acess_history_page/acess_history_page_model.dart @@ -4,7 +4,6 @@ import 'package:hub/components/molecular_components/message_opt_modal/opt_modal_ import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/request_manager.dart'; import 'package:hub/pages/acess_history_page/acess_history_page_widget.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; class AcessHistoryPageModel extends FlutterFlowModel { diff --git a/lib/pages/acess_history_page/acess_history_page_widget.dart b/lib/pages/acess_history_page/acess_history_page_widget.dart index b9234979..9c612497 100644 --- a/lib/pages/acess_history_page/acess_history_page_widget.dart +++ b/lib/pages/acess_history_page/acess_history_page_widget.dart @@ -15,6 +15,7 @@ import 'package:hub/shared/utils/log_util.dart'; import 'package:rxdart/rxdart.dart'; @immutable +// ignore: must_be_immutable class AccessHistoryScreen extends StatefulWidget { late Map opt = { 'personType': '.*', 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 03878c06..3f2b66fb 100644 --- a/lib/pages/fast_pass_page/fast_pass_page_widget.dart +++ b/lib/pages/fast_pass_page/fast_pass_page_widget.dart @@ -3,11 +3,8 @@ import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; -import 'package:hub/app_state.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/webview_util.dart'; import 'package:url_launcher/url_launcher_string.dart'; @@ -21,8 +18,8 @@ class FastPassPageWidget extends StatefulWidget { } class _FastPassPageWidgetState extends State { + late WebViewController _controllerAndroid; late InAppWebViewController _controllerIOS; - late WebViewController _controllerAll; Future> initVariables() async { final email = StorageUtil().email; @@ -71,32 +68,19 @@ class _FastPassPageWidgetState extends State { return Platform.isIOS ? InAppWebView( initialUrlRequest: URLRequest(url: WebUri(url)), - initialSettings: InAppWebViewSettings( - allowsBackForwardNavigationGestures: true, - javaScriptEnabled: true, - ), - onWebViewCreated: (controller) async { - _controllerIOS = controller; - }, + initialSettings: InAppWebViewSettings(allowsBackForwardNavigationGestures: true, javaScriptEnabled: true,), + 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(); - } + if (uri.toString().contains('/hub/home')) context.pop(); }, ) : WebViewWidget( - controller: _controllerAll = WebViewController() + controller: _controllerAndroid = WebViewController() ..clearCache() ..clearLocalStorage() ..setJavaScriptMode(JavaScriptMode.unrestricted) @@ -105,43 +89,35 @@ class _FastPassPageWidgetState extends State { NavigationDelegate( onProgress: (int progress) {}, 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); + _controllerAndroid.runJavaScript(token); + _controllerAndroid.runJavaScript(data); + _controllerAndroid.runJavaScript(backNavigation); }, onPageFinished: (String url) { bool isDarkMode = SchedulerBinding .instance .platformDispatcher - .platformBrightness == - Brightness.dark; + .platformBrightness == Brightness.dark; if (isDarkMode) { - _controllerAll.runJavaScript( - WebviewUtil.jsEnableDarkMode); + _controllerAndroid.runJavaScript(WebviewUtil.jsEnableDarkMode); } }, onNavigationRequest: (NavigationRequest request) { if (request.url.startsWith('http') || - request.url.startsWith( - 'https://api.whatsapp.com/send') || + request.url.startsWith('https://api.whatsapp.com/send') || request.url.startsWith('https://wa.me')) { - launchUrlString(request.url); - return NavigationDecision.prevent; - } + launchUrlString(request.url); + return NavigationDecision.prevent; + } return NavigationDecision.prevent; }, onUrlChange: (url) { - if (url.url.toString().contains('/hub/home')) { - context.pop(); - } + if (url.url.toString().contains('/hub/home')) context.pop(); }), ) ..loadRequest(Uri.parse(url)), diff --git a/lib/pages/forgot_password_page/forgot_password_model.dart b/lib/pages/forgot_password_page/forgot_password_model.dart new file mode 100644 index 00000000..8d1e3572 --- /dev/null +++ b/lib/pages/forgot_password_page/forgot_password_model.dart @@ -0,0 +1,77 @@ +import 'package:flutter/material.dart'; + +import '../../shared/utils/validator_util.dart'; +import '/flutter_flow/flutter_flow_util.dart'; +import 'forgot_password_screen.dart'; + +class ForgotPasswordScreenModel extends FlutterFlowModel { + final formKey = GlobalKey(); + + FocusNode? passwordRegisterFormFocusNode; + TextEditingController? passwordRegisterFormTextController; + late bool passwordRegisterFormVisibility; + String? Function(BuildContext, String?)? passwordRegisterFormTextControllerValidator; + String? _passwordRegisterFormTextControllerValidator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getText( + '6nn79lmh' /* Campo é necessário */, + ); + } + return null; + } + + FocusNode? passwordConfirmFormFocusNode; + TextEditingController? passwordConfirmFormTextController; + late bool passwordConfirmFormVisibility; + 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', + enText: 'Field is required', + ); + } + if (val != passwordRegisterFormTextController?.text) { + return FFLocalizations.of(context).getVariableText( + ptText: 'As senhas não coincidem', + enText: 'Passwords do not match', + ); + } + if (val.length < 8) { + return FFLocalizations.of(context).getText( + 'duq5gpp6' /* A senha deve ter pelo menos 8 ... */, + ); + } + return null; + } + + bool? register; + + + + + bool isFormInvalid() { + final password = passwordRegisterFormTextController?.text ?? ''; + final confirmPassword = passwordConfirmFormTextController?.text ?? ''; + return password.isEmpty || confirmPassword.isEmpty || password != confirmPassword + || !ValidatorUtil.isValidPassword(password) || !ValidatorUtil.isValidPassword(confirmPassword); + } + + + + @override void initState(BuildContext context) { + + + + passwordRegisterFormVisibility = false; + passwordRegisterFormTextControllerValidator = _passwordRegisterFormTextControllerValidator; + passwordConfirmFormVisibility = false; + passwordConfirmFormTextControllerValidator = _passwordConfirmFormTextControllerValidator; + } + @override void dispose() { + passwordRegisterFormFocusNode?.dispose(); + passwordRegisterFormTextController?.dispose(); + passwordConfirmFormFocusNode?.dispose(); + passwordConfirmFormTextController?.dispose(); + } +} diff --git a/lib/pages/forgot_password_page/forgot_password_screen.dart b/lib/pages/forgot_password_page/forgot_password_screen.dart new file mode 100644 index 00000000..ea6a9343 --- /dev/null +++ b/lib/pages/forgot_password_page/forgot_password_screen.dart @@ -0,0 +1,340 @@ + + +import 'package:easy_debounce/easy_debounce.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_animate/flutter_animate.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:hub/flutter_flow/nav/nav.dart'; + +import '../../components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart'; +import '../../flutter_flow/flutter_flow_animations.dart'; +import '../../flutter_flow/flutter_flow_icon_button.dart'; +import '../../flutter_flow/flutter_flow_model.dart'; +import '../../flutter_flow/flutter_flow_theme.dart'; +import '../../flutter_flow/flutter_flow_widgets.dart'; +import '../../flutter_flow/internationalization.dart'; +import '../../shared/services/authentication/authentication_service.dart'; +import '../../shared/utils/validator_util.dart'; +import 'forgot_password_model.dart'; + +class ForgotPasswordScreen extends StatefulWidget { + const ForgotPasswordScreen({super.key, required this.email, required this.token}); + final String email; + final String token; + + @override State createState() => _ForgotPasswordScreenState(); +} + +class _ForgotPasswordScreenState extends State with TickerProviderStateMixin { + late ForgotPasswordScreenModel _model; + final animationsMap = {}; + + @override void setState(VoidCallback callback) { + super.setState(callback); + _model.onUpdate(); + } + @override void initState() { + super.initState(); + _model = createModel(context, () => ForgotPasswordScreenModel()); + + _model.passwordRegisterFormTextController ??= TextEditingController(); + _model.passwordRegisterFormFocusNode ??= FocusNode(); + _model.passwordRegisterFormFocusNode!.addListener(() => setState(() {})); + + _model.passwordConfirmFormTextController ??= TextEditingController(); + _model.passwordConfirmFormFocusNode ??= FocusNode(); + _model.passwordConfirmFormFocusNode!.addListener(() => setState(() {})); + + animationsMap.addAll({ + 'containerOnPageLoadAnimation': AnimationInfo( + trigger: AnimationTrigger.onPageLoad, + effectsBuilder: () => [ + VisibilityEffect(duration: 1.ms), + FadeEffect( + curve: Curves.easeInOut, + delay: 0.0.ms, + duration: 300.0.ms, + begin: 0.0, + end: 1.0, + ), + MoveEffect( + curve: Curves.easeInOut, + delay: 0.0.ms, + duration: 300.0.ms, + begin: const Offset(0.0, 140.0), + end: const Offset(0.0, 0.0), + ), + ScaleEffect( + curve: Curves.easeInOut, + delay: 0.0.ms, + duration: 300.0.ms, + begin: const Offset(0.9, 0.9), + end: const Offset(1.0, 1.0), + ), + TiltEffect( + curve: Curves.easeInOut, + delay: 0.0.ms, + duration: 300.0.ms, + begin: const Offset(-0.349, 0), + end: const Offset(0, 0), + ), + ], + ), + }); + } + @override void dispose() { + _model.maybeDispose(); + + super.dispose(); + } + @override Widget build(BuildContext context) { + final MediaQueryData mediaQuery = MediaQuery.of(context); + return Scaffold( + appBar: buildAppBar(context), + body: buildBody(context), + ); + } + + AppBar buildAppBar(BuildContext context) { + return AppBar( + automaticallyImplyLeading: false, + forceMaterialTransparency: true, + leading: FlutterFlowIconButton( + borderColor: Colors.transparent, + borderRadius: 30.0, + borderWidth: 1.0, + buttonSize: 60.0, + icon: Icon( + Icons.keyboard_arrow_left, + color: FlutterFlowTheme.of(context).primaryText, + size: 30.0, + ), + onPressed: () async { + context.pop(); + }, + ), + title: Text( + FFLocalizations.of(context).getVariableText( + ptText: 'Recuperar Senha', + enText: 'Recover Password', + + ), + style: FlutterFlowTheme.of(context).headlineMedium.override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 15.0, + fontWeight: FontWeight.bold, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), + ), + ), + actions: const [], + centerTitle: true, + elevation: 0.0, + ); + } + + Row buildBody(BuildContext context) { + late final String message = FFLocalizations.of(context).getVariableText( + ptText: 'Qual será a sua nova senha? Insira abaixo e confirme.', + enText: 'What will be your new password? Enter it below and confirm.', + ); + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + flex: 6, + child: Container( + width: 100.0, + height: double.infinity, + decoration: BoxDecoration(color: FlutterFlowTheme.of(context).primaryBackground), + alignment: const AlignmentDirectional(0.0, -1.0), + child: Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 291.0, + height: 167.0, + decoration: const BoxDecoration(), + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: const AtomImageSvgTheme(filename: 'register', width: 600, height: 155), + ), + ), + Padding( + padding: const EdgeInsets.all(34.0), + child: Material( + child: Container( + width: double.infinity, + constraints: const BoxConstraints(maxWidth: 570.0), + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + borderRadius: BorderRadius.circular(12.0), + ), + child: Padding( + padding: const EdgeInsets.all(32.0), + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + 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, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), + ), + ), + ), + ), + Form( + key: _model.formKey, + autovalidateMode: AutovalidateMode.onUserInteraction, + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + _buildPasswordField( + context, + controller: _model.passwordRegisterFormTextController, + focusNode: _model.passwordRegisterFormFocusNode, + visibility: _model.passwordRegisterFormVisibility, + onVisibilityToggle: () => setState(() => _model.passwordRegisterFormVisibility = !_model.passwordRegisterFormVisibility), + ), + _buildPasswordField( + context, + controller: _model.passwordConfirmFormTextController, + focusNode: _model.passwordConfirmFormFocusNode, + visibility: _model.passwordConfirmFormVisibility, + onVisibilityToggle: () => setState(() => _model.passwordConfirmFormVisibility = !_model.passwordConfirmFormVisibility), + ), + ], + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0), + child: FFButtonWidget( + key: const ValueKey('SubmitButtonWidget'), + onPressed: _model.isFormInvalid() ? null : () async { + await AuthenticationService.changePassword(context, widget.email, _model.passwordRegisterFormTextController!.text, widget.token); + setState(() {}); + }, + text: FFLocalizations.of(context).getVariableText( + ptText: 'Enviar', + enText: 'Submit', + ), + options: FFButtonOptions( + 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')), + 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, + ), + showLoadingIndicator: true, + ), + ), + ], + ), + ), + ).animateOnPageLoad(animationsMap['containerOnPageLoadAnimation']!), + ), + ), + ], + ), + ), + ), + ), + ), + ], + ); + } + + + Widget _buildPasswordField(BuildContext context, {required TextEditingController? controller, required FocusNode? focusNode, required bool visibility, required VoidCallback onVisibilityToggle}){ + return Padding( + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0), + child: SizedBox( + width: double.infinity, + child: TextFormField( + key: const ValueKey('passwordTextFormField'), + controller: controller, + focusNode: focusNode, + onChanged: (_) => EasyDebounce.debounce( + '_model.passwordRegisterFormTextController', + const Duration(milliseconds: 500), + () => setState(() {}), + ), + autofocus: false, + autofillHints: const [AutofillHints.password], + obscureText: !visibility, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText('0firji8'), + labelStyle: FlutterFlowTheme.of(context).labelLarge.override( + fontFamily: 'Plus Jakarta Sans', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 16.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), + ), + 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), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: const BorderSide(color: Color(0xFFFF5963), width: 0.25), + borderRadius: BorderRadius.circular(12.0), + ), + filled: true, + fillColor: FlutterFlowTheme.of(context).primaryBackground, + suffixIcon: InkWell( + key: const ValueKey('passwordVisibilitySuffixIcon'), + onTap: onVisibilityToggle, + focusNode: FocusNode(skipTraversal: true), + child: Icon( + visibility ? 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: 16.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), + ), + validator: _model.passwordRegisterFormTextControllerValidator.asValidator(context), + ), + ), + ); + } + +} \ No newline at end of file diff --git a/lib/pages/home_page/home_page_widget.dart b/lib/pages/home_page/home_page_widget.dart index a045dfff..b144b185 100644 --- a/lib/pages/home_page/home_page_widget.dart +++ b/lib/pages/home_page/home_page_widget.dart @@ -1,4 +1,3 @@ -import 'dart:developer'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -11,8 +10,6 @@ import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/pages/home_page/home_page_model.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/widgets/drawer_widget/drawer_widget.dart'; diff --git a/lib/pages/liberation_history/liberation_history_model.dart b/lib/pages/liberation_history/liberation_history_model.dart index bc339f98..46d4fac5 100644 --- a/lib/pages/liberation_history/liberation_history_model.dart +++ b/lib/pages/liberation_history/liberation_history_model.dart @@ -1,10 +1,8 @@ +import 'package:flutter/material.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/request_manager.dart'; - -import 'package:flutter/material.dart'; import 'package:hub/pages/liberation_history/liberation_history_widget.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; class LiberationHistoryModel extends FlutterFlowModel { diff --git a/lib/pages/liberation_history/liberation_history_widget.dart b/lib/pages/liberation_history/liberation_history_widget.dart index 953a102f..6b15532f 100644 --- a/lib/pages/liberation_history/liberation_history_widget.dart +++ b/lib/pages/liberation_history/liberation_history_widget.dart @@ -1,4 +1,3 @@ -import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -14,7 +13,6 @@ import 'package:hub/pages/liberation_history/liberation_history_model.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/validator_util.dart'; -import 'package:provider/provider.dart'; class LiberationHistoryWidget extends StatefulWidget { const LiberationHistoryWidget({super.key}); 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 66f17cc2..21471970 100644 --- a/lib/pages/message_history_page/message_history_page_model.dart +++ b/lib/pages/message_history_page/message_history_page_model.dart @@ -1,10 +1,8 @@ +import 'package:flutter/material.dart'; import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/request_manager.dart'; - -import 'package:flutter/material.dart'; import 'package:hub/pages/message_history_page/message_history_page_widget.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; class MessageHistoryPageModel 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 8a149975..e7c83d82 100644 --- a/lib/pages/message_history_page/message_history_page_widget.dart +++ b/lib/pages/message_history_page/message_history_page_widget.dart @@ -8,7 +8,6 @@ import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/message_history_page/message_history_page_model.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; -import 'package:provider/provider.dart'; class MessageHistoryPageWidget extends StatefulWidget { const MessageHistoryPageWidget({super.key}); diff --git a/lib/pages/package_order_page/package_order_page.dart b/lib/pages/package_order_page/package_order_page.dart index 527ccbeb..f184983f 100644 --- a/lib/pages/package_order_page/package_order_page.dart +++ b/lib/pages/package_order_page/package_order_page.dart @@ -9,7 +9,6 @@ import 'package:hub/components/templates_components/details_component/details_co import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/storage_util.dart'; diff --git a/lib/pages/pets_page/pets_history_screen.dart b/lib/pages/pets_page/pets_history_screen.dart index 34b7a39e..a1d9cdf0 100644 --- a/lib/pages/pets_page/pets_history_screen.dart +++ b/lib/pages/pets_page/pets_history_screen.dart @@ -3,14 +3,10 @@ import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/pages/liberation_history/liberation_history_model.dart'; import 'package:hub/pages/pets_page/pets_page_model.dart'; -import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/storage_util.dart'; -import 'package:hub/shared/utils/validator_util.dart'; class PetsHistoryScreen extends StatefulWidget { const PetsHistoryScreen({super.key, required this.model}); diff --git a/lib/pages/pets_page/pets_page_model.dart b/lib/pages/pets_page/pets_page_model.dart index 9606c4ff..958c5f09 100644 --- a/lib/pages/pets_page/pets_page_model.dart +++ b/lib/pages/pets_page/pets_page_model.dart @@ -1,10 +1,10 @@ import 'dart:convert'; import 'dart:developer'; + import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/components/templates_components/details_component/details_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; @@ -12,10 +12,8 @@ import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/form_field_controller.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/pets_page/pets_page_widget.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/image_util.dart'; -import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/validator_util.dart'; diff --git a/lib/pages/pets_page/pets_page_widget.dart b/lib/pages/pets_page/pets_page_widget.dart index abaefcdf..c965d7ef 100644 --- a/lib/pages/pets_page/pets_page_widget.dart +++ b/lib/pages/pets_page/pets_page_widget.dart @@ -1,28 +1,21 @@ -import 'dart:convert'; import 'package:flutter/material.dart'; - import 'package:google_fonts/google_fonts.dart'; -import 'package:http/http.dart'; - import 'package:hub/components/atomic_components/shared_components_atoms/appbar.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/custom_input.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/custom_select.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/media_upload_button.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/submit_button.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart'; - import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/form_field_controller.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/pets_page/pets_history_screen.dart'; import 'package:hub/pages/pets_page/pets_page_model.dart'; - -import 'package:hub/shared/utils/image_util.dart'; -import 'package:hub/shared/utils/validator_util.dart'; import 'package:material_symbols_icons/symbols.dart'; +// ignore: must_be_immutable class PetsPageWidget extends StatefulWidget { dynamic pet; diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index 77563d07..b04f9635 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -1,15 +1,17 @@ -import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart'; -import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/shared/helpers/secure_storage_helper.dart'; import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; +import 'package:hub/shared/services/authentication/authentication_service.dart'; +import 'package:hub/shared/services/localization/localization_service.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:share_plus/share_plus.dart'; +import '../../shared/utils/snackbar_util.dart'; + class PreferencesPageModel with ChangeNotifier { final unfocusNode = FocusNode(); bool fingerprint = false; @@ -50,7 +52,7 @@ class PreferencesPageModel with ChangeNotifier { ptText: 'Notificação alterada com sucesso', ); context.pop(); - _showSnackBar(context, content); + SnackBarUtil.showSnackBar(context, content); notify = await _toggleBoolInDb('notify'); notifyListeners(); } catch (err) { @@ -59,7 +61,7 @@ class PreferencesPageModel with ChangeNotifier { ptText: 'Erro ao alterar notificação', ); context.pop(); - _showSnackBar(context, content, isError: true); + SnackBarUtil.showSnackBar(context, content, isError: true); } } @@ -82,20 +84,20 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Access pass changed successfully', ptText: 'Senha de acesso alterada com sucesso', ); - _showSnackBar(context, content); + SnackBarUtil.showSnackBar(context, content); } else { content = FFLocalizations.of(context).getVariableText( ptText: 'Erro ao alterar senha de acesso', enText: 'Error changing access pass', ); - _showSnackBar(context, content, isError: true); + SnackBarUtil.showSnackBar(context, content, isError: true); } }).catchError((e, s) { final String content = FFLocalizations.of(context).getVariableText( ptText: 'Erro ao alterar senha de acesso', enText: 'Error changing access pass', ); - _showSnackBar(context, content, isError: true); + SnackBarUtil.showSnackBar(context, content, isError: true); }).whenComplete(() => notifyListeners()); } @@ -118,20 +120,20 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Panic password changed successfully', ptText: 'Senha de pânico alterada com sucesso', ); - _showSnackBar(context, content); + SnackBarUtil.showSnackBar(context, content); } else { content = FFLocalizations.of(context).getVariableText( ptText: 'Erro ao alterar senha de pânico', enText: 'Error changing panic password', ); - _showSnackBar(context, content, isError: true); + SnackBarUtil.showSnackBar(context, content, isError: true); } }).catchError((e, s) { final String content = FFLocalizations.of(context).getVariableText( ptText: 'Erro ao alterar senha de pânico', enText: 'Error changing panic password', ); - _showSnackBar(context, content, isError: true); + SnackBarUtil.showSnackBar(context, content, isError: true); }).whenComplete(() => notifyListeners()); } @@ -151,7 +153,7 @@ class PreferencesPageModel with ChangeNotifier { fingerprint = await _toggleBoolInDb('fingerprint'); notifyListeners(); - _showSnackBar(context, content); + SnackBarUtil.showSnackBar(context, content); } fingerprint ? onChange(null) : _showPassKey(context, onChange); @@ -166,48 +168,7 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Are you sure you want to delete your account?', ptText: 'Tem certeza que deseja deletar sua conta?', ); - onConfirm() async { - String content; - try { - await PhpGroup.deleteAccount.call().then((value) { - if (value.jsonBody['error'] == false) { - content = FFLocalizations.of(context).getVariableText( - enText: 'Account deleted successfully', - ptText: 'Conta deletada com sucesso', - ); - - StorageUtil.purge(); - - context.pop(); - context.go( - '/welcomePage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, - ), - }, - ); - } - }).catchError((err) { - context.pop(); - content = FFLocalizations.of(context).getVariableText( - enText: 'Error deleting account', - ptText: 'Erro ao deletar conta', - ); - _showSnackBar(context, content); - }); - notifyListeners(); - } catch (err) { - context.pop(); - content = FFLocalizations.of(context).getVariableText( - enText: 'Error deleting account', - ptText: 'Erro ao deletar conta', - ); - _showSnackBar(context, content, isError: true); - } - } + onConfirm() async => AuthenticationService.deleteAccount(context); showAlertDialog(context, title, content, onConfirm); } @@ -221,20 +182,7 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Are you sure you want to logout?', ptText: 'Tem certeza que deseja sair?', ); - onConfirm() async { - StorageUtil.purge(); - - context.go( - '/welcomePage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, - ), - }, - ); - } + onConfirm() async => AuthenticationService.signOut(context); showAlertDialog(context, title, content, onConfirm); } @@ -248,57 +196,12 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Are you sure you want to unlink your device?', ptText: 'Tem certeza que deseja desvincular seu dispositivo?', ); - onConfirm() async { - String content; - try { - content = FFLocalizations.of(context).getVariableText( - enText: 'Device unlinked successfully', - ptText: 'Dispositivo desvinculado com sucesso', - ); - - await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) { - if (value.jsonBody['error'] == false) { - StorageUtil().cliName = ''; - StorageUtil().cliUUID = ''; - // StorageUtil().ownerUUID = ''; - - context.pop(); - - context.go( - '/homePage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, - ), - }, - ); - - _showSnackBar(context, content); - } - }).catchError((err, stack) { - context.pop(); - content = FFLocalizations.of(context).getVariableText( - enText: 'Error unlinking device', - ptText: 'Erro ao desvincular dispositivo', - ); - _showSnackBar(context, content, isError: true); - }); - } catch (err, stack) { - context.pop(); - log(err.toString(), stackTrace: stack); - content = FFLocalizations.of(context).getVariableText( - enText: 'Error unlinking device', - ptText: 'Erro ao desvincular dispositivo', - ); - _showSnackBar(context, content, isError: true); - } - } + onConfirm() async => LocalizationService.unlinkLocal(context); showAlertDialog(context, title, content, onConfirm); } + Future initVariables() async { fingerprint = await _getBoolFromDb('fingerprint'); person = await _getBoolFromDb('person'); @@ -321,38 +224,11 @@ class PreferencesPageModel with ChangeNotifier { return newValue; } - void _showAlertDialog(BuildContext context, String title, String content, - Function() onConfirm) { - showAlertDialog( - context, - 'Delete account', - 'Are you sure you want to delete your account?', - onConfirm(), - ); - } - void _showSnackBar(BuildContext context, String text, - {bool isError = false}) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - text, - style: TextStyle(color: FlutterFlowTheme.of(context).info), - ), - backgroundColor: isError - ? FlutterFlowTheme.of(context).error - : FlutterFlowTheme.of(context).success, - duration: const Duration(seconds: 3), - behavior: SnackBarBehavior.floating, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30), - ), - ), - ); - } - 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, @@ -373,7 +249,8 @@ class PreferencesPageModel with ChangeNotifier { enText: 'Error changing key', ptText: 'Erro ao alterar senha', ); - _showSnackBar(context, content, isError: true); + SnackBarUtil.showSnackBar(context, content, isError: true); }).whenComplete(() => notifyListeners()); } + } diff --git a/lib/pages/preferences_settings_page/preferences_settings_widget.dart b/lib/pages/preferences_settings_page/preferences_settings_widget.dart index ebd23d55..761b9e45 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_widget.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_widget.dart @@ -3,10 +3,8 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/preferences_settings_page/preferences_settings_model.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:provider/provider.dart'; 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 8edbff92..a69c39eb 100644 --- a/lib/pages/qr_code_page/qr_code_page_model.dart +++ b/lib/pages/qr_code_page/qr_code_page_model.dart @@ -1,9 +1,9 @@ import 'dart:async'; import 'dart:typed_data'; + import 'package:flutter/material.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/pages/qr_code_page/qr_code_page_widget.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:qr_flutter/qr_flutter.dart'; 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 f5ac5a24..32ae343c 100644 --- a/lib/pages/qr_code_page/qr_code_page_widget.dart +++ b/lib/pages/qr_code_page/qr_code_page_widget.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:barcode_widget/barcode_widget.dart'; -// import 'package:barcode_widget/barcode_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_animate/flutter_animate.dart'; @@ -15,12 +14,10 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/qr_code_page/qr_code_page_model.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; + import 'package:hub/shared/utils/biometric_util.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; -// import 'package:percent_indicator/percent_indicator.dart'; import 'package:qr_flutter/qr_flutter.dart'; diff --git a/lib/pages/reception_page/reception_page_widget.dart b/lib/pages/reception_page/reception_page_widget.dart index 3d0a2700..5ab81e6d 100644 --- a/lib/pages/reception_page/reception_page_widget.dart +++ b/lib/pages/reception_page/reception_page_widget.dart @@ -1,19 +1,17 @@ import 'dart:developer'; import 'package:awesome_notifications/awesome_notifications.dart'; -import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/backend/notifications/firebase_messaging_service.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart'; -import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/reception_page/reception_page_model.dart'; -import 'package:hub/shared/utils/dialog_util.dart'; +import 'package:hub/shared/services/localization/localization_service.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:provider/provider.dart'; @@ -36,8 +34,7 @@ class _ReceptionPageWidgetState extends State }(); FirebaseMessagingService().updateDeviceToken(); - - processLocals(); + LocalizationService.checkLocals(context); } @override @@ -47,42 +44,16 @@ class _ReceptionPageWidgetState extends State super.dispose(); } - Future processLocals() async { - try { - final GetLocalsCall callback = PhpGroup.getLocalsCall; - var response = await callback.call(); - if (response.jsonBody['error'] == false) { - final List locals = response.jsonBody['locais'] ?? []; - final bool isEmpty = locals.isEmpty; - final bool isActive = locals - .where((local) => local['CLU_STATUS'] != 'B') - .toList() - .isNotEmpty; - final bool isEnable = !isEmpty && isActive; - if (isEnable) { - StorageUtil().haveLocal = true; - StorageUtil().isLogged = true; - await WidgetsBinding.instance.endOfFrame; - // dispose(); - StorageUtil().cliUUID = ''; - StorageUtil().ownerUUID = ''; - StorageUtil().context?.go('/homePage'); - } - } - } catch (e, s) { - log(e.toString(), stackTrace: s); - } - } @override void didChangeAppLifecycleState(AppLifecycleState state) { log('() => state: $state'); if (state == AppLifecycleState.resumed) { setState(() { - processLocals(); + LocalizationService.checkLocals(context); }); } } diff --git a/lib/pages/reservation_page/reservation_page_widget.dart b/lib/pages/reservation_page/reservation_page_widget.dart index aca8a20d..5c430325 100644 --- a/lib/pages/reservation_page/reservation_page_widget.dart +++ b/lib/pages/reservation_page/reservation_page_widget.dart @@ -3,14 +3,10 @@ import 'dart:io' show Platform; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; -import 'package:hub/app_state.dart'; import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/shared/helpers/secure_storage_helper.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/webview_util.dart'; -import 'package:sqflite/sqflite.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:webview_flutter/webview_flutter.dart'; @@ -22,7 +18,6 @@ class ReservationPageWidget extends StatefulWidget { } class _ReservationPageWidgetState extends State { - late InAppWebViewController _controllerIOS; late WebViewController _controllerAll; Future> initVariables() async { @@ -79,7 +74,6 @@ class _ReservationPageWidgetState extends State { javaScriptEnabled: true, ), onWebViewCreated: (controller) async { - _controllerIOS = controller; }, onLoadStop: (controller, url) async { await controller.evaluateJavascript( 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 7ecc9943..01789f5c 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 @@ -1,9 +1,7 @@ -import 'dart:developer'; import 'package:auto_size_text/auto_size_text.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/scheduler.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -23,7 +21,6 @@ import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_p import 'package:hub/pages/schedule_complete_visit_page/visit_history_page_widget.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/share_util.dart'; -import 'package:provider/provider.dart'; class ScheduleComplete extends StatefulWidget { const ScheduleComplete({super.key}); @@ -1501,17 +1498,16 @@ Widget scheduleVisit(BuildContext context, ScheduleCompleteVisitPageModel model, devDesc: model.textController3.text, idVisitante: model.visitorStrList, dtInicio: model - .convertDateFormat(model.textController1.text ?? ''), + .convertDateFormat(model.textController1.text), dtFim: model - .convertDateFormat(model.textController2.text ?? ''), + .convertDateFormat(model.textController2.text), unica: model.switchValue == true ? 'Sim' : 'Não', idMotivo: extractIdToStr(model.dropDownValue1!), idNAC: extractIdToStr(model.dropDownValue2!), obs: model.textController3.text, ) - .catchError((e) async { - await DialogUtil.errorDefault(context); - }).then((value) async { + .catchError((e) async => await DialogUtil.errorDefault(context)) + .then((value) async { if (PhpGroup.postScheduleVisitCall.error( (value.jsonBody ?? ''), ) == @@ -1604,7 +1600,7 @@ Widget scheduleVisit(BuildContext context, ScheduleCompleteVisitPageModel model, labelsHashMap: { 'Nome': model.visitorJsonList[0]['VTE_NOME'], 'Start': model.textController1.text, - 'End': model.textController2.text ?? '', + 'End': model.textController2.text, 'Reason': (RegExp(r'MOT_DESCRICAO:\s*([^,]+)') .firstMatch( model.dropDownValue1.toString()) 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 c90bd2f3..8dd2f534 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 @@ -5,7 +5,6 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart'; import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart'; -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/mixins/status_mixin.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; diff --git a/lib/pages/sign_in_page/sign_in_page_widget.dart b/lib/pages/sign_in_page/sign_in_page_widget.dart index ecb7180d..a826572e 100644 --- a/lib/pages/sign_in_page/sign_in_page_widget.dart +++ b/lib/pages/sign_in_page/sign_in_page_widget.dart @@ -1,5 +1,6 @@ import 'package:hub/shared/mixins/switcher_mixin.dart'; +import '../../shared/utils/storage_util.dart'; import '/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; @@ -34,6 +35,7 @@ class _SignInPageWidgetState extends State { @override Widget build(BuildContext context) { + StorageUtil().context = context; return GestureDetector( onTap: () => _model.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(_model.unfocusNode) diff --git a/lib/pages/sign_up_page/sign_up_page_widget.dart b/lib/pages/sign_up_page/sign_up_page_widget.dart index 7402c828..bb786c31 100644 --- a/lib/pages/sign_up_page/sign_up_page_widget.dart +++ b/lib/pages/sign_up_page/sign_up_page_widget.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:hub/shared/mixins/switcher_mixin.dart'; +import '../../shared/utils/storage_util.dart'; import '/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; @@ -35,6 +36,7 @@ class _SignUpPageWidgetState extends State { @override Widget build(BuildContext context) { + StorageUtil().context = context; return GestureDetector( onTap: () => _model.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(_model.unfocusNode) diff --git a/lib/pages/welcome_page/welcome_page_widget.dart b/lib/pages/welcome_page/welcome_page_widget.dart index 8a4be699..544ef3a7 100644 --- a/lib/pages/welcome_page/welcome_page_widget.dart +++ b/lib/pages/welcome_page/welcome_page_widget.dart @@ -1,13 +1,17 @@ -import 'package:hub/shared/helpers/secure_storage_helper.dart'; +import 'dart:async'; +import 'dart:developer'; + +import 'package:app_links/app_links.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/scheduler.dart'; import 'package:hub/shared/mixins/switcher_mixin.dart'; import 'package:hub/shared/utils/storage_util.dart'; import '/components/templates_components/welcome_template_component/welcome_template_component_widget.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/scheduler.dart'; import 'welcome_page_model.dart'; + export 'welcome_page_model.dart'; class WelcomePageWidget extends StatefulWidget with Switcher { @@ -22,8 +26,7 @@ class _WelcomePageWidgetState extends State { final scaffoldKey = GlobalKey(); - @override - void initState() { + @override void initState() { super.initState(); _model = createModel(context, () => WelcomePageModel()); @@ -42,15 +45,17 @@ class _WelcomePageWidgetState extends State { }); } - @override - void dispose() { + @override void dispose() { _model.dispose(); super.dispose(); } + + @override Widget build(BuildContext context) { + StorageUtil().context = context; return GestureDetector( onTap: () => _model.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(_model.unfocusNode) diff --git a/lib/shared/extensions/context_entensions.dart b/lib/shared/extensions/context_entensions.dart deleted file mode 100644 index 3a877a1c..00000000 --- a/lib/shared/extensions/context_entensions.dart +++ /dev/null @@ -1,11 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:hub/shared/utils/storage_util.dart'; - -export 'context_entensions.dart' show ContextExtensions; - -extension ContextExtensions on BuildContext { - void setStateStatic(VoidCallback callback) { - final element = findAncestorStateOfType>(); - element?.setState(callback); - } -} diff --git a/lib/shared/helpers/secure_storage_helper.dart b/lib/shared/helpers/secure_storage_helper.dart index 5992d1b7..9f87fae0 100644 --- a/lib/shared/helpers/secure_storage_helper.dart +++ b/lib/shared/helpers/secure_storage_helper.dart @@ -108,6 +108,7 @@ class SecureStorageHelper extends ChangeNotifier implements Storage { Future purge() async { log('SecureStorageHelper -> Purging secure storage'); await _secureStorage.deleteAll(); + CacheUtil.instance.clear(); } } diff --git a/lib/shared/services/authentication/authentication_service.dart b/lib/shared/services/authentication/authentication_service.dart new file mode 100644 index 00000000..ceb8ab31 --- /dev/null +++ b/lib/shared/services/authentication/authentication_service.dart @@ -0,0 +1,224 @@ + + +import 'package:flutter/material.dart'; +import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:hub/shared/utils/snackbar_util.dart'; + +import '../../../backend/api_requests/api_calls.dart'; +import '../../../flutter_flow/flutter_flow_util.dart'; +import '../../../flutter_flow/random_data_util.dart'; +import '../../utils/device_util.dart'; +import '../../utils/dialog_util.dart'; +import '../../utils/log_util.dart'; +import '../../utils/storage_util.dart'; + +class AuthenticationService { + + + + static Future login(BuildContext context) async { + final GetLocalsCall callback = PhpGroup.getLocalsCall; + + final response = await callback.call(); + + if (response.jsonBody['error']) { + DialogUtil.errorDefault(context); + return; + } + List locals = response.jsonBody['locais'] ?? []; + + if (locals.isEmpty) { + StorageUtil().haveLocal = false; + context.go('/receptionPage'); + } else { + StorageUtil().haveLocal = true; + context.go('/homePage'); + } + StorageUtil().isLogged = true; + + } + + static Future signIn(BuildContext context, FlutterFlowModel model, {String? emailAdress, String? password,}) async { + try { + final ApiCallResponse? response; + final LoginCall callback = PhpGroup.loginCall; + StorageUtil().deviceDescription = randomString( + 10, + 10, + true, + false, + false, + ); + + final String? devUUID; + final String userUUID; + final String status; + final String userDevUUID; + final String userName; + final String email; + final String passwd; + + email = emailAdress!; + passwd = password!; + devUUID = await DeviceUtil.getDevUUID(); + + if ((email != '') && (passwd != '')) { + StorageUtil().email = email; + StorageUtil().passwd = passwd; + StorageUtil().devUUID = devUUID!; + response = await callback.call(); + + if (response.jsonBody['error'] == false) { + userUUID = response.jsonBody['uid']; + status = response.jsonBody['user']['status']; + userDevUUID = response.jsonBody['user']['dev_id']; + userName = response.jsonBody['user']['name']; + + StorageUtil().userUUID = userUUID; + StorageUtil().userDevUUID = userDevUUID; + StorageUtil().status = status; + StorageUtil().userName = userName; + + await login(context); + } else { + if (response.jsonBody['error'] == null) { + DialogUtil.errorDefault(context); + } else { + DialogUtil.error( + context, response.jsonBody['error_msg'].toString()); + } + } + } + + return; + } catch (e, s) { + DialogUtil.errorDefault(context); + LogUtil.requestAPIFailed( + 'login.php', emailAdress.toString(), "Login", e, s); + } + } + + static Future signUp(BuildContext context, {required String? name, String? passwd, required String? email, String? device,}) async { + try { + ApiCallResponse? response; + if ((email != null && email != '') && (passwd != null && passwd != '' && passwd.length > 7) && (name != null && name != '')) { + response = await PhpGroup.registerCall.call( + name: name, + password: passwd, + email: email, + token: randomString(36, 36, false, false, true), + uuid: randomString(36, 36, false, false, true), + tipo: device!, + descricao: randomString(36, 36, true, false, false), + ); + + if (response.jsonBody['error'] == false) return true; + DialogUtil.error(context, response.jsonBody['error_msg']); + return false; + } else { + DialogUtil.errorDefault(context); + return false; + } + } catch (e, s) { + DialogUtil.errorDefault(context); + LogUtil.requestAPIFailed('registro.php', email.toString(), "Register", e, s); + return false; + } + } + + static Future signOut(BuildContext context) async { + await PhpGroup.unregisterDevice.call(); + await StorageUtil.purge(); + context.go( + '/welcomePage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } + + static Future forgotPassword(BuildContext context, String email) async { + 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!"); + + response = await callback.call(email: email); + + if (response.jsonBody['error'] == false) { + DialogUtil.success(context, message); + } else { + DialogUtil.error(context, response.jsonBody['error_msg']); + } + } catch (e, s) { + DialogUtil.errorDefault(context); + LogUtil.requestAPIFailed( + 'forgotPassword.php', email, "Forgot Password", e, s); + } + } + + static Future changePassword(BuildContext context, String email, String password, String token) async { + 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( + enText: "Password changed successfully!", + ptText: "Senha alterada com sucesso!", + ); + DialogUtil.success(context, message); + context.go('/homePage'); + } else { + final String message = response.jsonBody['error_msg']; + DialogUtil.error(context, message); + } + + + } + + static Future deleteAccount(BuildContext context) async { + String content; + try { + await PhpGroup.deleteAccount.call().then((value) { + if (value.jsonBody['error'] == false) { + content = FFLocalizations.of(context).getVariableText( + enText: 'Account deleted successfully', + ptText: 'Conta deletada com sucesso', + ); + StorageUtil.purge(); + context.pop(); + context.go( + '/welcomePage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } + }).catchError((err) { + context.pop(); + content = FFLocalizations.of(context).getVariableText( + enText: 'Error deleting account', + ptText: 'Erro ao deletar conta', + ); + SnackBarUtil.showSnackBar(context, content); + }); + } catch (err) { + context.pop(); + content = FFLocalizations.of(context).getVariableText( + enText: 'Error deleting account', + ptText: 'Erro ao deletar conta', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + } + } + +} \ No newline at end of file diff --git a/lib/shared/services/localization/localization_service.dart b/lib/shared/services/localization/localization_service.dart new file mode 100644 index 00000000..fdb9523e --- /dev/null +++ b/lib/shared/services/localization/localization_service.dart @@ -0,0 +1,243 @@ + +import 'dart:developer'; + +import 'package:flutter/material.dart'; +import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; +import 'package:hub/shared/utils/storage_util.dart'; + +import '../../../backend/api_requests/api_calls.dart'; +import '../../../components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart'; +import '../../../flutter_flow/flutter_flow_util.dart'; +import '../../utils/log_util.dart'; +import '../../utils/snackbar_util.dart'; + +class LocalizationService { + + + + + static Future checkLocals(BuildContext context) async { + try { + final GetLocalsCall callback = PhpGroup.getLocalsCall; + + var response = await callback.call(); + + if (response.jsonBody['error'] == false) { + final List locals = response.jsonBody['locais'] ?? []; + final bool isEmpty = locals.isEmpty; + final bool isActive = locals + .where((local) => local['CLU_STATUS'] != 'B') + .toList() + .isNotEmpty; + final bool isEnable = !isEmpty && isActive; + + if (isEnable) { + StorageUtil().haveLocal = true; + StorageUtil().isLogged = true; + await WidgetsBinding.instance.endOfFrame; + StorageUtil().cliUUID = ''; + StorageUtil().ownerUUID = ''; + StorageUtil().context?.go('/homePage'); + } + } + } catch (e, s) { + log(e.toString(), stackTrace: s); + } + } + + static Future processLocals(BuildContext context) async{ + try { + final GetLocalsCall callback = PhpGroup.getLocalsCall; + + final ApiCallResponse response = await callback.call(); + + final List locals = response.jsonBody['locais'].toList() ?? []; + + for (var local in locals) { + final String status = local['CLU_STATUS']; + log('() => CLU_STATUS: $status'); + } + + final bool isActive = locals + .where((local) => local['CLU_STATUS'] == 'A') + .toList() + .isNotEmpty; + final bool isInactived = locals + .where((local) => local['CLI_ID'] != StorageUtil().cliUUID && local['CLU_STATUS'] == 'A').toList().isNotEmpty; + final bool isPending = locals + .where((local) => + local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A') + .toList() + .isNotEmpty; + final bool isUnique = locals.length == 1; + final bool isBlocked = locals[0]['CLU_STATUS'] == 'B'; + final bool isEnabled = isUnique && isActive; + + final bool isDisabled = isUnique && isBlocked; + final bool isUnselected = StorageUtil().cliUUID.isEmpty && + StorageUtil().cliName.isEmpty & StorageUtil().ownerUUID.isEmpty; + final bool isSelected = + StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty && isInactived; + final bool isUnavailable = isPending && isUnselected && isUnique; + + + + + if (isDisabled) { + context.go('/welcomePage'); + return true; + } else if (isUnavailable) { + log('() => isUnavailable'); + try { + StorageUtil().cliUUID = locals[0]['CLI_ID']; + StorageUtil().ownerUUID = locals[0]['CLU_OWNER_ID']; + var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A'); + if (response.jsonBody['error'] == true) { + StorageUtil().cliUUID = ''; + StorageUtil().cliName = ''; + StorageUtil().ownerUUID = ''; + return false; + } + if (response.jsonBody['error'] == false) return await processData(context).then( (value) => value); + } catch (e, s) { + DialogUtil.errorDefault(context); + LogUtil.requestAPIFailed( + 'responderVinculo.php', '', 'Responder Vínculo', e, s); + return false; + } + } else if (isEnabled) { + log('() => isEnabled'); + final dynamic local = locals[0]; + StorageUtil().cliName = local['CLI_NOME']; + StorageUtil().userName = local['USU_NOME']; + StorageUtil().cliUUID = local['CLI_ID']; + StorageUtil().ownerUUID = local['CLU_OWNER_ID']; + + return await processData(context); + + + } else if (isUnselected) { + log('() => isUnselected'); + return await selectLocal(context); + } else if (isSelected) { + log('() => isSelected'); + return await processData(context); + } else { + log('() => else'); + return await selectLocal(context); + } + } catch (e) { + log('() => catch: $e'); + return await selectLocal(context); + } + return false; + } + + static Future processData(BuildContext context) async { + + try { + final GetDadosCall callback = PhpGroup.getDadosCall; + + var response = await callback.call(); + + final error = response.jsonBody['error']; + + if (error == false) { + final bool whatsapp = response.jsonBody['whatsapp'] ?? false; + final bool provisional = response.jsonBody['provisional'] ?? false; + final bool pets = response.jsonBody['pet'] ?? false; + final String petAmountRegister = + response.jsonBody['petAmountRegister'].toString().isEmpty + ? '0' + : response.jsonBody['petAmountRegister'].toString(); + final String name = response.jsonBody['visitado']['VDO_NOME']; + StorageUtil().whatsapp = whatsapp; + StorageUtil().provisional = provisional; + StorageUtil().pets = pets; + StorageUtil().petAmountRegister = petAmountRegister; + StorageUtil().userName = name; + return true; + } else if (error == true) { + log('() => error: $error'); + DialogUtil.warningDefault(context).whenComplete(() => selectLocal(context)); + return false; + } + + return false; + } catch (e, s) { + log('() => error: $e', stackTrace: s); + DialogUtil.warningDefault(context).whenComplete(() => selectLocal(context)); + return false; + } + } + + static Future selectLocal(BuildContext context) async { + return await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + enableDrag: false, + isDismissible: false, + showDragHandle: false, + useSafeArea: true, + context: context, + builder: (context) => PopScope( + canPop: false, + child: Padding( + padding: MediaQuery.viewInsetsOf(context), + child: const BottomArrowLinkedLocalsComponentWidget(), + ), + ), + ).then((_) async => await processData(context)); + } + + static Future unlinkLocal(BuildContext context) async { + String content; + try { + content = FFLocalizations.of(context).getVariableText( + enText: 'Device unlinked successfully', + ptText: 'Dispositivo desvinculado com sucesso', + ); + + await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) { + if (value.jsonBody['error'] == false) { + StorageUtil().cliName = ''; + StorageUtil().cliUUID = ''; + // StorageUtil().ownerUUID = ''; + + context.pop(); + + context.go( + '/homePage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + + SnackBarUtil.showSnackBar(context, content); + } + }).catchError((err, stack) { + context.pop(); + content = FFLocalizations.of(context).getVariableText( + enText: 'Error unlinking device', + ptText: 'Erro ao desvincular dispositivo', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + }); + } catch (err, stack) { + context.pop(); + log(err.toString(), stackTrace: stack); + content = FFLocalizations.of(context).getVariableText( + enText: 'Error unlinking device', + ptText: 'Erro ao desvincular dispositivo', + ); + SnackBarUtil.showSnackBar(context, content, isError: true); + } + } + + +} \ No newline at end of file diff --git a/lib/shared/utils/device_util.dart b/lib/shared/utils/device_util.dart index 42519099..285e4fe2 100644 --- a/lib/shared/utils/device_util.dart +++ b/lib/shared/utils/device_util.dart @@ -1,11 +1,6 @@ -import '/backend/schema/structs/index.dart'; -import 'dart:developer'; -import '/backend/schema/enums/enums.dart'; -import '/flutter_flow/flutter_flow_theme.dart'; -import '/flutter_flow/flutter_flow_util.dart'; -import '/flutter_flow/custom_functions.dart'; // Imports custom functions -import 'package:flutter/material.dart'; + import 'dart:io'; + import 'package:device_info_plus/device_info_plus.dart'; class DeviceUtil { diff --git a/lib/shared/utils/image_util.dart b/lib/shared/utils/image_util.dart index fe728e0d..4c55c0dd 100644 --- a/lib/shared/utils/image_util.dart +++ b/lib/shared/utils/image_util.dart @@ -1,12 +1,11 @@ // Automatic FlutterFlow imports +import 'dart:convert'; import 'dart:io'; +import 'dart:typed_data'; import 'package:path_provider/path_provider.dart'; -import 'package:flutter/material.dart'; -import 'dart:convert'; -import 'dart:typed_data'; import '../../flutter_flow/uploaded_file.dart'; class ImageUtils { diff --git a/lib/shared/utils/share_util.dart b/lib/shared/utils/share_util.dart index 842c5102..31cc52ef 100644 --- a/lib/shared/utils/share_util.dart +++ b/lib/shared/utils/share_util.dart @@ -1,4 +1,3 @@ -import 'package:hub/shared/helpers/sqlite_storage_helper.dart'; import 'package:hub/shared/utils/storage_util.dart'; import 'package:share_plus/share_plus.dart'; diff --git a/lib/shared/utils/snackbar_util.dart b/lib/shared/utils/snackbar_util.dart new file mode 100644 index 00000000..60618d7a --- /dev/null +++ b/lib/shared/utils/snackbar_util.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; + +import '../../flutter_flow/flutter_flow_theme.dart'; + +class SnackBarUtil { + + + static void showSnackBar(BuildContext context, String text, {bool isError = false}) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + text, + style: TextStyle(color: FlutterFlowTheme.of(context).info), + ), + backgroundColor: isError + ? FlutterFlowTheme.of(context).error + : FlutterFlowTheme.of(context).success, + duration: const Duration(seconds: 3), + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + ); + } + + +} \ No newline at end of file diff --git a/lib/shared/utils/storage_util.dart b/lib/shared/utils/storage_util.dart index ebe919b5..fc783391 100644 --- a/lib/shared/utils/storage_util.dart +++ b/lib/shared/utils/storage_util.dart @@ -131,6 +131,7 @@ class StorageUtil { isFirstRun = false; await _sharedPreferences.prefs?.setBool('milestone', false); _secureStorage.purge(); + _sqliteStorage.purge(); } } diff --git a/lib/shared/utils/validator_util.dart b/lib/shared/utils/validator_util.dart index 18424821..41fafcd7 100644 --- a/lib/shared/utils/validator_util.dart +++ b/lib/shared/utils/validator_util.dart @@ -1,4 +1,3 @@ -import 'dart:developer'; import 'package:intl/intl.dart'; diff --git a/pubspec.lock b/pubspec.lock index 886ddab0..2bebfb29 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,14 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 - url: "https://pub.dev" - source: hosted - version: "72.0.0" _flutterfire_internals: dependency: transitive description: @@ -17,19 +9,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.37" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.3.2" - analyzer: - dependency: transitive + app_links: + dependency: "direct main" description: - name: analyzer - sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 + name: app_links + sha256: ad1a6d598e7e39b46a34f746f9a8b011ee147e4c275d407fa457e7a62f84dd99 url: "https://pub.dev" source: hosted - version: "6.7.0" + version: "6.3.2" + app_links_linux: + dependency: transitive + description: + name: app_links_linux + sha256: f5f7173a78609f3dfd4c2ff2c95bd559ab43c80a87dc6a095921d96c05688c81 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + app_links_platform_interface: + dependency: transitive + description: + name: app_links_platform_interface + sha256: "05f5379577c513b534a29ddea68176a4d4802c46180ee8e2e966257158772a3f" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + app_links_web: + dependency: transitive + description: + name: app_links_web + sha256: af060ed76183f9e2b87510a9480e56a5352b6c249778d07bd2c95fc35632a555 + url: "https://pub.dev" + source: hosted + version: "1.0.4" app_tracking_transparency: dependency: "direct main" description: @@ -110,70 +121,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" - build: - dependency: transitive - description: - name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - build_config: - dependency: transitive - description: - name: build_config - sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 - url: "https://pub.dev" - source: hosted - version: "1.1.1" - build_daemon: - dependency: transitive - description: - name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" - url: "https://pub.dev" - source: hosted - version: "2.4.2" - build_runner: - dependency: "direct dev" - description: - name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" - url: "https://pub.dev" - source: hosted - version: "2.4.13" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 - url: "https://pub.dev" - source: hosted - version: "7.3.2" - built_collection: - dependency: transitive - description: - name: built_collection - sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" - url: "https://pub.dev" - source: hosted - version: "5.1.1" - built_value: - dependency: transitive - description: - name: built_value - sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb - url: "https://pub.dev" - source: hosted - version: "8.9.2" cached_network_image: dependency: "direct main" description: @@ -270,14 +217,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" - code_builder: - dependency: transitive - description: - name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 - url: "https://pub.dev" - source: hosted - version: "4.10.0" collection: dependency: "direct main" description: @@ -302,14 +241,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" crop_your_image: dependency: "direct main" description: @@ -350,14 +281,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" - dart_style: - dependency: transitive - description: - name: dart_style - sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" - url: "https://pub.dev" - source: hosted - version: "2.3.7" dbus: dependency: transitive description: @@ -831,27 +754,11 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" - source: hosted - version: "4.0.0" fuchsia_remote_debug_protocol: dependency: transitive description: flutter source: sdk version: "0.0.0" - glob: - dependency: transitive - description: - name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.dev" - source: hosted - version: "2.1.2" go_router: dependency: "direct main" description: @@ -884,14 +791,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.11.1" - graphs: + gtk: dependency: transitive description: - name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + name: gtk + sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.1.0" http: dependency: "direct main" description: @@ -900,14 +807,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" - source: hosted - version: "3.2.1" http_parser: dependency: transitive description: @@ -1001,14 +900,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.19.0" - io: - dependency: transitive - description: - name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.dev" - source: hosted - version: "1.0.4" iregexp: dependency: transitive description: @@ -1121,14 +1012,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" - macros: - dependency: transitive - description: - name: macros - sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" - url: "https://pub.dev" - source: hosted - version: "0.1.2-main.4" matcher: dependency: transitive description: @@ -1185,14 +1068,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" - mockito: - dependency: "direct dev" - description: - name: mockito - sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" - url: "https://pub.dev" - source: hosted - version: "5.4.4" nested: dependency: transitive description: @@ -1217,14 +1092,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" page_transition: dependency: "direct main" description: @@ -1385,14 +1252,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" process: dependency: transitive description: @@ -1409,22 +1268,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.2" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 - url: "https://pub.dev" - source: hosted - version: "1.3.0" qr: dependency: transitive description: @@ -1545,35 +1388,11 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" - shelf: - dependency: transitive - description: - name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.dev" - source: hosted - version: "1.4.1" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" - url: "https://pub.dev" - source: hosted - version: "2.0.0" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_gen: - dependency: transitive - description: - name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" - url: "https://pub.dev" - source: hosted - version: "1.5.0" source_span: dependency: transitive description: @@ -1686,14 +1505,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.6.1" - timing: - dependency: transitive - description: - name: timing - sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" - url: "https://pub.dev" - source: hosted - version: "1.0.1" typed_data: dependency: transitive description: @@ -1814,14 +1625,6 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.5" - watcher: - dependency: transitive - description: - name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" - source: hosted - version: "1.1.0" web: dependency: transitive description: @@ -1830,22 +1633,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.1" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" - source: hosted - version: "0.1.6" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" - url: "https://pub.dev" - source: hosted - version: "3.0.1" webdriver: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index bd5d341e..1f196133 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,6 +21,7 @@ dependencies: webview_flutter: ^4.8.0 rxdart: ^0.27.7 collection: 1.18.0 + app_links: ^6.3.2 crop_your_image: 1.1.0 csv: 6.0.0 device_info_plus: 10.1.0 @@ -90,7 +91,6 @@ dependencies: # video_player_web: 2.3.1 material_symbols_icons: ^4.2784.0 fluttertoast: ^8.2.8 - cupertino_icons: ^1.0.0 flutter_bloc: ^8.1.6 flutter_riverpod: ^2.5.1 @@ -112,10 +112,10 @@ dev_dependencies: flutter_lints: 4.0.0 image: 4.2.0 lints: 4.0.0 +# build_runner: ^2.4.13 +# mockito: ^5.4.4 integration_test: sdk: flutter - build_runner: ^2.4.13 - mockito: ^5.4.4 flutter_test: sdk: flutter @@ -134,7 +134,6 @@ flutter_launcher_icons: flutter: - uses-material-design: true assets: @@ -161,4 +160,4 @@ fonts: - asset: assets/fonts/icons.ttf - family: Menu fonts: - - asset: assets/fonts/menu.ttf + - asset: assets/fonts/menu.ttf \ No newline at end of file