add forgot password screen

This commit is contained in:
J. A. Messias 2024-10-08 08:51:38 -03:00
parent 909ac01852
commit d980d36544
89 changed files with 1751 additions and 1733 deletions

View File

@ -52,6 +52,7 @@ android {
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
multiDexEnabled true multiDexEnabled true
consumerProguardFiles 'proguard.txt'
} }
compileOptions { compileOptions {

15
android/app/proguard.txt Normal file
View File

@ -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 *; }

View File

@ -49,15 +49,29 @@
/> />
<!-- <meta-data android:name="flutter_deeplinking_enabled" android:value="true" /> --> <meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="freaccess.com.br" android:pathPrefix="/freaccess/alterarSenha.php" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="freaccess" />
</intent-filter>
<intent-filter android:autoVerify="true"> <intent-filter android:autoVerify="true">
<action android:name="mensagem" /> <action android:name="mensagem" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="frehub" android:host="frehub.com" /> <data android:scheme="frehub" android:host="frehub.com" />
@ -86,7 +100,7 @@
<meta-data <meta-data
android:name="com.google.firebase.messaging.default_notification_icon" android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/notification_icon" /> android:resource="@drawable/notification_icon" />
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

View File

@ -2,5 +2,4 @@ package com.freaccess.hub
import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity() { class MainActivity: FlutterFragmentActivity() {}
}

View File

@ -1,3 +1,5 @@
org.gradle.jvmargs=-Xmx4608m org.gradle.jvmargs=-Xmx4608m
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
android.enableR8=true
enableProguardInReleaseBuilds = true

15
android/proguard.txt Normal file
View File

@ -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 *; }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,48 +1,248 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.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/main.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:integration_test/integration_test.dart'; import 'package:integration_test/integration_test.dart';
late WidgetTester widget;
void main() { void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); IntegrationTestWidgetsFlutterBinding.ensureInitialized();
group('Authentication Tests', () { group('Initialization', () {
setUp(() async { setUpAll(() async => await initializeApp().then((_) => StorageUtil().isLogged = false));
await initializeApp();
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 { group('Terms of Use', (){});
await tester.pumpWidget(const App());
await _navToSignIn(tester);
await _enterCredentialsAndSignIn(tester);
await _login(tester);
});
}); });
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<String, dynamic> 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<String, dynamic> 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<void> _navToSignIn(WidgetTester tester) async {
final navToSignIn = find.byKey(const Key('toggleSignInPage'));
if (navToSignIn.evaluate().isNotEmpty) { Future<void> _navigateBackUsingSystemGesture() async =>
await tester.tap(navToSignIn); IntegrationTestWidgetsFlutterBinding.instance.keyboard.isLogicalKeyPressed(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
Future<void> _navigateToSignUp() async {
await widget.pumpAndSettle();
final Finder navToSignUp = find.byKey(const ValueKey<String>('toggleSignUpPage'));
if (navToSignUp.evaluate().isNotEmpty) {
await widget.tap(navToSignUp);
await widget.pumpAndSettle();
} }
} }
Future<void> _enterCredentialsAndSignIn(WidgetTester tester) async { Future<void> _navigateToSignIn() async {
final emailField = find.byKey(const ValueKey('emailField')); await widget.pumpAndSettle();
await tester.enterText(emailField, 'test@example.com'); final Finder navToSignIn = find.byKey(const ValueKey<String>('toggleSignInPage'));
await tester.pumpAndSettle(); expect(navToSignIn, findsOneWidget);
if (navToSignIn.evaluate().isNotEmpty) {
final passwordField = find.byKey(const ValueKey('passwordField')); await widget.tap(navToSignIn);
await tester.enterText(passwordField, 'password123'); await widget.pumpAndSettle();
await tester.pumpAndSettle(); }
} }
Future<void> _login(WidgetTester tester) async { Future<void> _recoveryPassword() async {
// Encontre o botão de login e clique nele await widget.pumpAndSettle();
final signInButton = find.byKey(const Key('loginCallback')); final Finder forgotPassword = find.byKey(const ValueKey<String>('ForgotPassword'));
// expect(signInButton, findsOneWidget); if (forgotPassword.evaluate().isNotEmpty) await widget.tap(forgotPassword);
tester.press(signInButton); await widget.ensureVisible(forgotPassword);
await widget.pumpAndSettle();
await tester.pumpAndSettle();
} }
Future<void> _auth(Map<String, dynamic> credentials) async {
await _enterCredentials(credentials);
await _submit('SubmitButtonWidget');
}
Future<void> _send(Map<String, dynamic> credentials) async {
await _enterCredentials(credentials);
await _submit('SendButtonWidget');
}
Future<void> _enterCredentials(Map<String, dynamic> credentials) async {
await widget.pumpAndSettle();
for (var entry in credentials.entries) {
final Finder field = find.byKey(ValueKey<String>(entry.key));
await widget.pumpAndSettle();
expect(field, findsOneWidget);
await widget.enterText(field, entry.value);
await widget.pumpAndSettle();
}
await widget.pumpAndSettle();
}
Future<void> _submit(String key) async {
await widget.pumpAndSettle();
final Finder submitButton = find.byKey(ValueKey<String>(key));
await widget.pumpAndSettle();
if (submitButton.evaluate().isNotEmpty) {
await widget.tap(submitButton);
await widget.pumpAndSettle();
}
final Finder ThrowExceptionWidget = find.byKey(const ValueKey<String>('ThrowExceptionWidget'));
await widget.pumpAndSettle();
if (ThrowExceptionWidget.evaluate().isNotEmpty) {
await widget.ensureVisible(ThrowExceptionWidget);
await widget.tap(ThrowExceptionWidget);
await widget.pumpAndSettle();
} else {
await _navigateBackUsingSystemGesture();
}
}

View File

@ -3,8 +3,6 @@ import 'dart:convert';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:hub/backend/notifications/firebase_messaging_service.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/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart'; import 'package:hub/shared/utils/validator_util.dart';
@ -24,6 +22,7 @@ class PhpGroup {
static UpdToken updToken = UpdToken(); static UpdToken updToken = UpdToken();
static RegisterCall registerCall = RegisterCall(); static RegisterCall registerCall = RegisterCall();
static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall(); static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall();
static ChangePasswordCall changePasswordCall = ChangePasswordCall();
static GetLocalsCall getLocalsCall = GetLocalsCall(); static GetLocalsCall getLocalsCall = GetLocalsCall();
static PostScheduleVisitorCall postScheduleVisitorCall = static PostScheduleVisitorCall postScheduleVisitorCall =
PostScheduleVisitorCall(); PostScheduleVisitorCall();
@ -660,11 +659,50 @@ class RegisterCall {
} }
} }
class ChangePasswordCall {
Future<ApiCallResponse> 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 { class ForgotPasswordCall {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? email, final String? email,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = PhpGroup.getBaseUrl();
const String version = 'FRE-ACCESS-HUB';
return ApiManager.instance.makeApiCall( return ApiManager.instance.makeApiCall(
callName: 'forgotPassword', callName: 'forgotPassword',
@ -675,6 +713,7 @@ class ForgotPasswordCall {
}, },
params: { params: {
'email': email, 'email': email,
'appVersion': version,
}, },
bodyType: BodyType.X_WWW_FORM_URL_ENCODED, bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
returnBody: true, returnBody: true,

View File

@ -2,7 +2,6 @@ import 'dart:developer';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:hub/backend/api_requests/api_calls.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/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';

View File

@ -1,26 +1,17 @@
import 'dart:developer';
import 'package:awesome_notifications/awesome_notifications.dart'; import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_calls.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/details_component/details_component_widget.dart';
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_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_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.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/dialog_util.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
import 'package:sqflite/sqflite.dart';
Future<void> onMessageReceived( Future<void> onMessageReceived(Map<String, dynamic> payload, String? extra, String? handleClick) async {
Map<String, dynamic> payload, String? extra, String? handleClick) async {
final localId = jsonDecode(payload['local']!)['CLI_ID']; final localId = jsonDecode(payload['local']!)['CLI_ID'];
final cliUUID = StorageUtil().cliUUID; final cliUUID = StorageUtil().cliUUID;

View File

@ -2,11 +2,9 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/molecular_components/menu_item/menu_item.dart'; import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.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/dialog_util.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
import '../../../app_state.dart';
class MenuButtonWidget extends MenuEntry { class MenuButtonWidget extends MenuEntry {
const MenuButtonWidget({ const MenuButtonWidget({

View File

@ -1,10 +1,10 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
// ignore: must_be_immutable
class CustomDatePickerUtil extends StatefulWidget { class CustomDatePickerUtil extends StatefulWidget {
TextEditingController? controller; TextEditingController? controller;
final FocusNode? focusNode; final FocusNode? focusNode;
@ -37,7 +37,6 @@ class CustomDatePickerUtil extends StatefulWidget {
class _CustomDatePickerState extends State<CustomDatePickerUtil> { class _CustomDatePickerState extends State<CustomDatePickerUtil> {
DateTime? _selectedDate; DateTime? _selectedDate;
TimeOfDay? _selectedTime;
@override @override
void initState() { void initState() {

View File

@ -2,10 +2,9 @@ import 'package:easy_debounce/easy_debounce.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
// ignore: must_be_immutable
class CustomInputUtil extends StatefulWidget { class CustomInputUtil extends StatefulWidget {
final TextEditingController? controller; final TextEditingController? controller;
final String? labelText; final String? labelText;

View File

@ -1,15 +1,12 @@
import 'dart:developer';
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.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_drop_down.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/form_field_controller.dart'; import 'package:hub/flutter_flow/form_field_controller.dart';
// ignore: must_be_immutable
class CustomSelect extends StatefulWidget { class CustomSelect extends StatefulWidget {
final List<String> options; final List<String> options;
final List<String> optionsLabel; final List<String> optionsLabel;
@ -61,9 +58,7 @@ class _CustomSelectState extends State<CustomSelect> {
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: FlutterFlowDropDown<String>( child: FlutterFlowDropDown<String>(
fillColor: FlutterFlowTheme.of(context).primaryBackground, fillColor: FlutterFlowTheme.of(context).primaryBackground,
controller: widget.controller ??= controller: widget.controller,
FormFieldController<String>(
widget.dropDownValue ??= ''),
options: widget.options, options: widget.options,
optionLabels: widget.optionsLabel, optionLabels: widget.optionsLabel,
onChanged: widget.changed, onChanged: widget.changed,

View File

@ -1,14 +1,11 @@
import 'dart:developer';
import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/upload_data.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 { class MediaUploadButtonUtil extends StatefulWidget {
final Function(FFUploadedFile) onUploadComplete; final Function(FFUploadedFile) onUploadComplete;
bool isUploading; bool isUploading;

View File

@ -2,9 +2,8 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.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 { class SubmitButtonUtil extends StatelessWidget {
final String labelText; final String labelText;
Future Function()? onPressed; Future Function()? onPressed;

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart';
// ignore: must_be_immutable
class TabViewUtil extends StatelessWidget { class TabViewUtil extends StatelessWidget {
final BuildContext context; final BuildContext context;
final dynamic model; final dynamic model;

View File

@ -175,7 +175,6 @@ class _OptModalWidgetState extends State<OptModalWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width; double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;
return Center( return Center(
child: Container( child: Container(

View File

@ -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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.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/helpers/secure_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
@ -178,7 +179,6 @@ class _OrderFilterModalWidgetState extends State<OrderFilterModalWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width; double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;
return Center( return Center(
child: Container( child: Container(

View File

@ -11,6 +11,7 @@ import 'throw_exception_model.dart';
export 'throw_exception_model.dart'; export 'throw_exception_model.dart';
// ignore: must_be_immutable
class ThrowExceptionWidget extends StatefulWidget { class ThrowExceptionWidget extends StatefulWidget {
ThrowExceptionWidget( ThrowExceptionWidget(
{super.key, required this.msg, this.type = EnumThrowException.error}); {super.key, required this.msg, this.type = EnumThrowException.error});
@ -100,77 +101,63 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return InkWell(
mainAxisSize: MainAxisSize.max, key: const ValueKey('ThrowExceptionWidget'),
mainAxisAlignment: MainAxisAlignment.center, splashColor: Colors.transparent,
children: [ focusColor: Colors.transparent,
Padding( hoverColor: Colors.transparent,
padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0), highlightColor: Colors.transparent,
child: InkWell( onTap: () async {
splashColor: Colors.transparent, context.pop();
focusColor: Colors.transparent, },
hoverColor: Colors.transparent, child: SingleChildScrollView(
highlightColor: Colors.transparent, child: Column(
onTap: () async { mainAxisSize: MainAxisSize.max,
context.pop(); mainAxisAlignment: MainAxisAlignment.center,
}, children: [
child: Column( Stack(
mainAxisSize: MainAxisSize.max, children: <Widget>[
mainAxisAlignment: MainAxisAlignment.center, Align(
children: [ alignment: const AlignmentDirectional(0.0, 0.0),
Stack( child: Icon(
children: [ _getIconByType(context),
Align( color: _getColorByType(context),
alignment: const AlignmentDirectional(0.0, 0.0), size: 150.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<String>(
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)),
), ),
], ),
), ],
).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<String>(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),
),
),
),
],
), ),
), ],
], ),
); ),
} );
}
} }

View File

@ -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/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/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.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/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart';
import '/backend/api_requests/api_calls.dart'; import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';

View File

@ -1,18 +1,11 @@
import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.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/custom_functions.dart' as functions;
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
import '../../../shared/services/localization/localization_service.dart';
import 'local_profile_component_model.dart'; import 'local_profile_component_model.dart';
export 'local_profile_component_model.dart'; export 'local_profile_component_model.dart';
@ -41,9 +34,10 @@ class _LocalProfileComponentWidgetState
_model = createModel(context, () => LocalProfileComponentModel()); _model = createModel(context, () => LocalProfileComponentModel());
_model.setOnUpdate(onUpdate: () => setState(() {})); _model.setOnUpdate(onUpdate: () => setState(() {}));
_model.setStateCallback = () => safeSetState(() {}); _model.setStateCallback = () => safeSetState(() {});
//
WidgetsBinding.instance WidgetsBinding.instance
.addPostFrameCallback((_) async => await processLocals()); .addPostFrameCallback((_) async => await LocalizationService.processLocals(context).then((value) => value == true ? onUpdate() : null));
} }
@override @override
@ -53,152 +47,14 @@ class _LocalProfileComponentWidgetState
super.dispose(); super.dispose();
} }
Future<void> 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<void> processLocals() async {
try {
final GetLocalsCall callback = PhpGroup.getLocalsCall;
final ApiCallResponse response = await callback.call();
final List<dynamic> 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<void> 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() { void onUpdate() {
safeSetState(() { safeSetState(() {
_model.getData(); _model.getData();
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -230,7 +86,7 @@ class _LocalProfileComponentWidgetState
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: () async { onTap: () async {
showModalSelectLocal(); await LocalizationService.selectLocal(context).then((value) => value == true ? onUpdate() : null);
}, },
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(200.0), borderRadius: BorderRadius.circular(200.0),

View File

@ -1,12 +1,9 @@
import 'package:flutter/material.dart'; 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/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_model.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/extensions/dialog_extensions.dart'; import 'package:hub/shared/extensions/dialog_extensions.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart'; import 'package:hub/shared/services/authentication/authentication_service.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.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/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart'; import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart';
@ -244,29 +241,20 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
}); });
} }
Future<void> signOut(BuildContext context) async { Future<void> 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( showAlertDialog(
context, context,
'Logout', title,
FFLocalizations.of(context).getVariableText( content,
enText: 'Are you sure you want to logout?', () async => await AuthenticationService.signOut(context));
ptText: 'Tem certeza',
), () async {
PhpGroup.unregisterDevice.call();
StorageUtil.purge();
context.go(
'/welcomePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
await SQLiteStorageHelper().purge();
});
} }
Future openPreferencesSettings(BuildContext context) async { Future openPreferencesSettings(BuildContext context) async {

View File

@ -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_button_item/menu_button_item_widget.dart';
import 'package:hub/components/atomic_components/menu_card_item/menu_card_item.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/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_list_view_component/menu_list_view_component_widget.dart';
import '/components/organism_components/menu_staggered_view_component/menu_staggered_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<MenuComponentWidget> {
MenuCardItem( MenuCardItem(
icon: Icons.logout, icon: Icons.logout,
action: () async { action: () async {
await _model.signOut(context); await _model.Logout(context);
setState(() {}); setState(() {});
}, },
title: FFLocalizations.of(context).getVariableText( title: FFLocalizations.of(context).getVariableText(

View File

@ -1,14 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'dart:collection'; import 'dart:collection';
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hub/backend/api_requests/api_calls.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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.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:provider/provider.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
@ -178,7 +175,7 @@ class _MessageWellComponentWidgetState
} }
Widget _buildMessageItem(BuildContext context, dynamic message, int index) { Widget _buildMessageItem(BuildContext context, dynamic message, int index) {
final theme = FlutterFlowTheme.of(context); FlutterFlowTheme.of(context);
String formatMessageOrigin(String messageOrigin) { String formatMessageOrigin(String messageOrigin) {
final words = messageOrigin.split(' '); final words = messageOrigin.split(' ');
final formattedWords = words.map((word) { final formattedWords = words.map((word) {

View File

@ -1,9 +1,9 @@
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:flutter/material.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/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_model.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/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';

View File

@ -2,13 +2,13 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/backend/api_requests/api_calls.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/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart';
import 'package:hub/flutter_flow/custom_functions.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_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/utils/dialog_util.dart';
class ScheduleVisitDetailWidget extends StatefulWidget { class ScheduleVisitDetailWidget extends StatefulWidget {
const ScheduleVisitDetailWidget({ const ScheduleVisitDetailWidget({
@ -799,22 +799,12 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
false) { false) {
context.pop(); context.pop();
} else { } else {
await showModalBottomSheet( final String? msg = PhpGroup.postScheduleVisitCall.errorMsg(
isScrollControlled: true, (_model.postScheduleVisit?.jsonBody ?? ''),
backgroundColor: Colors.transparent, );
enableDrag: false, await DialogUtil.error(context, msg!).then((value) => safeSetState(() {}));
context: context,
builder: (context) {
return Padding(
padding: MediaQuery.viewInsetsOf(context),
child: ThrowExceptionWidget(
msg: PhpGroup.postScheduleVisitCall.errorMsg(
(_model.postScheduleVisit?.jsonBody ?? ''),
)!,
),
);
},
).then((value) => safeSetState(() {}));
} }
setState(() {}); setState(() {});

View File

@ -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/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: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'; import 'package:hub/shared/utils/storage_util.dart';
class UpArrowLinkedLocalsComponentModel class UpArrowLinkedLocalsComponentModel

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/nav/nav.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 'package:hub/shared/utils/storage_util.dart';
import '/backend/api_requests/api_calls.dart'; import '/backend/api_requests/api_calls.dart';

View File

@ -3,7 +3,6 @@ import 'dart:collection';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.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_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';

View File

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/nav/nav.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 'package:hub/shared/utils/storage_util.dart';
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';

View File

@ -1,15 +1,12 @@
import 'dart:collection'; import 'dart:collection';
import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/templates_components/details_component/details_component_model.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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.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 { class DetailsComponentWidget extends StatefulWidget {
const DetailsComponentWidget({ const DetailsComponentWidget({
@ -35,7 +32,7 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
late DetailsComponentModel _model; late DetailsComponentModel _model;
LinkedHashMap<String, String> get labelsLinkedHashMap => LinkedHashMap<String, String> get labelsLinkedHashMap =>
LinkedHashMap.from(widget.labelsHashMap ?? {}); LinkedHashMap.from(widget.labelsHashMap);
List<LinkedHashMap<String, Color>> get statusLinkedHashMap => List<LinkedHashMap<String, Color>> get statusLinkedHashMap =>
widget.statusHashMap widget.statusHashMap

View File

@ -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:easy_debounce/easy_debounce.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.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'; import 'forgot_password_template_component_model.dart';
export 'forgot_password_template_component_model.dart'; export 'forgot_password_template_component_model.dart';
// //
@ -74,7 +73,6 @@ class _ForgotPasswordTemplateComponentWidgetState
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ 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( if (responsiveVisibility(
context: context, context: context,
phone: false, phone: false,
@ -84,6 +82,7 @@ class _ForgotPasswordTemplateComponentWidgetState
padding: padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0), const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0),
child: InkWell( child: InkWell(
key: const ValueKey<String>('BackButton'),
splashColor: Colors.transparent, splashColor: Colors.transparent,
focusColor: Colors.transparent, focusColor: Colors.transparent,
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
@ -104,19 +103,16 @@ class _ForgotPasswordTemplateComponentWidgetState
), ),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0),
12.0, 0.0, 0.0, 0.0),
child: Text( child: Text(
'', '',
style: style: FlutterFlowTheme.of(context).bodyMedium.override(
FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Plus Jakarta Sans', fontFamily: 'Plus Jakarta Sans',
color: const Color(0xFF15161E), color: const Color(0xFF15161E),
fontSize: 14.0, fontSize: 14.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
.containsKey('Plus Jakarta Sans'),
), ),
), ),
), ),
@ -128,9 +124,7 @@ class _ForgotPasswordTemplateComponentWidgetState
padding: padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0),
child: Text( child: Text(
FFLocalizations.of(context).getText( FFLocalizations.of(context).getText('xxm3ajsy' /* ESQUECEU SUA SENHA? */),
'xxm3ajsy' /* ESQUECEU SUA SENHA? */,
),
style: FlutterFlowTheme.of(context).headlineMedium.override( style: FlutterFlowTheme.of(context).headlineMedium.override(
fontFamily: 'Outfit', fontFamily: 'Outfit',
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
@ -145,9 +139,7 @@ class _ForgotPasswordTemplateComponentWidgetState
padding: padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0), const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0),
child: Text( child: Text(
FFLocalizations.of(context).getText( FFLocalizations.of(context).getText('wu2f7yzo' /* Não se preucupe nós vamos te a... */),
'wu2f7yzo' /* Não se preucupe nós vamos te a... */,
),
style: FlutterFlowTheme.of(context).labelMedium.override( style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans', fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
@ -168,6 +160,7 @@ class _ForgotPasswordTemplateComponentWidgetState
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: TextFormField( child: TextFormField(
key: const ValueKey<String>('recoveryTextFormField'),
controller: _model.emailAddressTextController, controller: _model.emailAddressTextController,
focusNode: _model.emailAddressFocusNode, focusNode: _model.emailAddressFocusNode,
onChanged: (_) => EasyDebounce.debounce( onChanged: (_) => EasyDebounce.debounce(
@ -180,11 +173,8 @@ class _ForgotPasswordTemplateComponentWidgetState
obscureText: false, obscureText: false,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText('mtz8l7ft' /* E-mail */),
'mtz8l7ft' /* E-mail */, labelStyle: FlutterFlowTheme.of(context).labelMedium.override(
),
labelStyle:
FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans', fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primary, color: FlutterFlowTheme.of(context).primary,
fontSize: 14.0, fontSize: 14.0,
@ -253,39 +243,14 @@ class _ForgotPasswordTemplateComponentWidgetState
padding: padding:
const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0),
child: FFButtonWidget( child: FFButtonWidget(
key: const ValueKey<String>('SendButtonWidget'),
onPressed: (_model.emailAddressTextController.text == '' || onPressed: (_model.emailAddressTextController.text == '' ||
!ValidatorUtil.isValidEmail( !ValidatorUtil.isValidEmail(
_model.emailAddressTextController.text)) _model.emailAddressTextController.text))
? null ? null
: () async { : () async => AuthenticationService.forgotPassword(context, _model.emailAddressTextController.text),
try {
_model.req = await PhpGroup.forgotPasswordCall.call(
email: _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( text: FFLocalizations.of(context).getText(
'74rnd5bu' /* Enviar */, '74rnd5bu' /* Enviar */,
), ),

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; 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/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/flutter_flow/flutter_flow_model.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
class LiberationHistoryItemDetailsTemplateComponentModel class LiberationHistoryItemDetailsTemplateComponentModel

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_manager.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/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_util.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'; import 'package:hub/shared/utils/storage_util.dart';
class ScheduleProvisionalVisitPageModel class ScheduleProvisionalVisitPageModel

View File

@ -529,8 +529,7 @@ class _ScheduleProvisionalVisitPageWidgetState
initialDate: initialDate:
getCurrentTimestamp, getCurrentTimestamp,
firstDate: firstDate:
(getCurrentTimestamp ?? (getCurrentTimestamp),
DateTime(1900)),
lastDate: DateTime(2050), lastDate: DateTime(2050),
builder: (context, child) { builder: (context, child) {
return wrapInMaterialDatePickerTheme( return wrapInMaterialDatePickerTheme(

View File

@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; 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/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart'; import 'package:hub/shared/utils/validator_util.dart';

View File

@ -5,7 +5,6 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/image_util.dart'; import 'package:hub/shared/utils/image_util.dart';
import 'package:hub/shared/utils/validator_util.dart'; import 'package:hub/shared/utils/validator_util.dart';
import 'package:provider/provider.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import '/backend/api_requests/api_calls.dart'; import '/backend/api_requests/api_calls.dart';

View File

@ -1,32 +1,19 @@
import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:flutter/material.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 '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
import 'sign_in_template_component_widget.dart' import 'sign_in_template_component_widget.dart'
show SignInTemplateComponentWidget; show SignInTemplateComponentWidget;
import 'package:flutter/material.dart';
class SignInTemplateComponentModel class SignInTemplateComponentModel
extends FlutterFlowModel<SignInTemplateComponentWidget> { extends FlutterFlowModel<SignInTemplateComponentWidget> {
/// State fields for stateful widgets in this component.
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
final unfocusNode = FocusNode(); final unfocusNode = FocusNode();
// State field(s) for emailAddress widget.
FocusNode? emailAddressFocusNode; FocusNode? emailAddressFocusNode;
TextEditingController? emailAddressTextController; TextEditingController? emailAddressTextController;
String? Function(BuildContext, String?)? emailAddressTextControllerValidator; String? Function(BuildContext, String?)? emailAddressTextControllerValidator;
SignInTemplateComponentModel(); SignInTemplateComponentModel();
String? _emailAddressTextControllerValidator( String? _emailAddressTextControllerValidator(BuildContext context, String? val) {
BuildContext context, String? val) {
if (val == null || val.isEmpty) { if (val == null || val.isEmpty) {
return FFLocalizations.of(context).getText( return FFLocalizations.of(context).getText(
'xhnawzcb' /* Campo é necessário */, 'xhnawzcb' /* Campo é necessário */,
@ -40,8 +27,6 @@ class SignInTemplateComponentModel
} }
return null; return null;
} }
// State field(s) for password widget.
FocusNode? passwordFocusNode; FocusNode? passwordFocusNode;
TextEditingController? passwordTextController; TextEditingController? passwordTextController;
late bool passwordVisibility; late bool passwordVisibility;
@ -56,106 +41,10 @@ class SignInTemplateComponentModel
return null; return null;
} }
Future<bool> 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<dynamic> 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 @override
void initState(BuildContext context) { void initState(BuildContext context) {

View File

@ -13,6 +13,7 @@ import '/flutter_flow/flutter_flow_animations.dart';
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart'; import '/flutter_flow/flutter_flow_widgets.dart';
import '../../../shared/services/authentication/authentication_service.dart';
import 'sign_in_template_component_model.dart'; import 'sign_in_template_component_model.dart';
export 'sign_in_template_component_model.dart'; export 'sign_in_template_component_model.dart';
@ -99,15 +100,8 @@ class _SignInTemplateComponentWidgetState
} }
bool _isFormInvalid() { bool _isFormInvalid() {
if (_model.emailAddressTextController.text == '' || if (_model.emailAddressTextController.text == '' || _model.passwordTextController.text == '') return true;
_model.passwordTextController.text == '') { if (!ValidatorUtil.isValidEmail(_model.emailAddressTextController.text)) return true;
return true;
}
if (!ValidatorUtil.isValidEmail(_model.emailAddressTextController.text)) {
return true;
}
return false; return false;
} }
@ -131,14 +125,11 @@ class _SignInTemplateComponentWidgetState
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(0.0, 35.0, 0.0, 35.0),
0.0, 35.0, 0.0, 35.0),
child: Container( child: Container(
width: 548.0, width: 548.0,
height: 112.0, height: 112.0,
decoration: BoxDecoration( decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.0)),
borderRadius: BorderRadius.circular(16.0),
),
alignment: const AlignmentDirectional(0.0, 0.0), alignment: const AlignmentDirectional(0.0, 0.0),
child: Padding( child: Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
@ -148,31 +139,24 @@ class _SignInTemplateComponentWidgetState
children: [ children: [
Expanded( Expanded(
child: Align( child: Align(
alignment: alignment: const AlignmentDirectional(0.0, 1.0),
const AlignmentDirectional(0.0, 1.0),
child: Padding( child: Padding(
padding: const EdgeInsets.all(3.0), padding: const EdgeInsets.all(3.0),
child: Text( child: Text(
FFLocalizations.of(context) FFLocalizations.of(context).getVariableText(
.getVariableText( ptText: 'VAMOS LÁ! ENTRE COM A SUA CONTA',
ptText: enText: 'LET\'S GO! SIGN IN WITH YOUR ACCOUNT',
'VAMOS LÁ! ENTRE COM A SUA CONTA',
enText:
'LET\'S GO! SIGN IN WITH YOUR ACCOUNT',
), ),
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.displaySmall .displaySmall
.override( .override(
fontFamily: 'Plus Jakarta Sans', fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context) color: FlutterFlowTheme.of(context).primaryText,
.primaryText,
fontSize: 24.0, fontSize: 24.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
.containsKey(
'Plus Jakarta Sans'),
), ),
), ),
), ),
@ -189,8 +173,7 @@ class _SignInTemplateComponentWidgetState
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
child: const AtomImageSvgTheme( child: const AtomImageSvgTheme(filename: 'login', width: 600, height: 155),
filename: 'login', width: 600, height: 155),
), ),
), ),
Column( Column(
@ -199,16 +182,12 @@ class _SignInTemplateComponentWidgetState
Align( Align(
alignment: const AlignmentDirectional(0.0, 0.0), alignment: const AlignmentDirectional(0.0, 0.0),
child: Padding( child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(34.0, 0.0, 34.0, 0.0),
34.0, 0.0, 34.0, 0.0),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
constraints: const BoxConstraints( constraints: const BoxConstraints(maxWidth: 570.0,),
maxWidth: 570.0,
),
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context) color: FlutterFlowTheme.of(context).primaryBackground,
.primaryBackground,
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
), ),
@ -218,8 +197,7 @@ class _SignInTemplateComponentWidgetState
padding: const EdgeInsets.all(32.0), padding: const EdgeInsets.all(32.0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Form( Form(
key: _model.formKey, key: _model.formKey,
@ -237,7 +215,7 @@ class _SignInTemplateComponentWidgetState
width: double.infinity, width: double.infinity,
child: TextFormField( child: TextFormField(
key: const ValueKey<String>( key: const ValueKey<String>(
'emailField'), 'emailTextFormField'),
controller: _model controller: _model
.emailAddressTextController, .emailAddressTextController,
focusNode: _model focusNode: _model
@ -378,324 +356,159 @@ class _SignInTemplateComponentWidgetState
), ),
), ),
Padding( Padding(
padding: padding: const EdgeInsetsDirectional .fromSTEB(0.0, 0.0, 0.0, 16.0),
const EdgeInsetsDirectional
.fromSTEB(
0.0, 0.0, 0.0, 16.0),
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: TextFormField( child: TextFormField(
key: const ValueKey<String>( key: const ValueKey<String>('passwordTextFormField'),
'passwordField'), controller: _model.passwordTextController,
controller: _model cursorColor: FlutterFlowTheme.of(context).primary,
.passwordTextController, focusNode: _model.passwordFocusNode,
cursorColor: onChanged: (_) => EasyDebounce.debounce(
FlutterFlowTheme.of(
context)
.primary,
focusNode:
_model.passwordFocusNode,
onChanged: (_) =>
EasyDebounce.debounce(
'_model.passwordTextController', '_model.passwordTextController',
const Duration( const Duration(milliseconds: 500),
milliseconds: 500), () => setState(() {})
() => setState(() {}),
), ),
autofocus: true, autofocus: true,
autofillHints: const [ autofillHints: const [AutofillHints.password],
AutofillHints.password textInputAction: TextInputAction.send,
], obscureText: !_model.passwordVisibility,
textInputAction:
TextInputAction.send,
obscureText: !_model
.passwordVisibility,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
labelText: labelText: FFLocalizations.of(context).getText('2x19ce8k' /* Senha */),
FFLocalizations.of( labelStyle: FlutterFlowTheme.of(context)
context)
.getText(
'2x19ce8k' /* Senha */,
),
labelStyle: FlutterFlowTheme
.of(context)
.labelLarge .labelLarge
.override( .override(
fontFamily: fontFamily: 'Plus Jakarta Sans',
'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primaryText,
color: FlutterFlowTheme
.of(context)
.primaryText,
fontSize: 16.0, fontSize: 16.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: fontWeight: FontWeight.w500,
FontWeight.w500, useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans')),
useGoogleFonts: enabledBorder: OutlineInputBorder(
GoogleFonts
.asMap()
.containsKey(
'Plus Jakarta Sans'),
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: color: FlutterFlowTheme.of(context).customColor1,
FlutterFlowTheme.of( width: 0.25),
context) borderRadius: BorderRadius.circular(12.0),
.customColor1,
width: 0.25,
),
borderRadius:
BorderRadius.circular(
12.0),
), ),
focusedBorder: focusedBorder: OutlineInputBorder(
OutlineInputBorder( borderSide: const BorderSide(
borderSide: color:Color(0xFF1AAB5F),
const BorderSide( width: 0.25),
color: borderRadius: BorderRadius.circular(12.0)),
Color(0xFF1AAB5F), errorBorder: OutlineInputBorder(
width: 0.25, borderSide: const BorderSide(
), color: Color(0xFFFF5963),
borderRadius: width: 0.25),
BorderRadius.circular( borderRadius: BorderRadius.circular(12.0),
12.0),
), ),
errorBorder: focusedErrorBorder: OutlineInputBorder(
OutlineInputBorder( borderSide: const BorderSide(
borderSide: color: Color(0xFFFF5963),
const BorderSide( width: 0.25),
color: borderRadius: BorderRadius.circular(12.0),
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, filled: true,
fillColor: fillColor: FlutterFlowTheme.of(context).primaryBackground,
FlutterFlowTheme.of(
context)
.primaryBackground,
suffixIcon: InkWell( suffixIcon: InkWell(
onTap: () => setState( onTap: () => setState(() => _model.passwordVisibility = !_model.passwordVisibility),
() => _model focusNode: FocusNode(skipTraversal: true),
.passwordVisibility =
!_model
.passwordVisibility,
),
focusNode: FocusNode(
skipTraversal: true),
child: Icon( child: Icon(
_model.passwordVisibility _model.passwordVisibility ? Icons.visibility_outlined : Icons.visibility_off_outlined,
? Icons color:FlutterFlowTheme.of(context).accent1,
.visibility_outlined size: 24.0),
: Icons
.visibility_off_outlined,
color:
FlutterFlowTheme.of(
context)
.accent1,
size: 24.0,
),
), ),
), ),
style: FlutterFlowTheme.of( style: FlutterFlowTheme.of(context)
context)
.bodyLarge .bodyLarge
.override( .override(
fontFamily: fontFamily: 'Plus Jakarta Sans',
'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primaryText,
color:
FlutterFlowTheme.of(
context)
.primaryText,
fontSize: 16.0, fontSize: 16.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: fontWeight: FontWeight.w500,
FontWeight.w500, useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
'Plus Jakarta Sans'),
), ),
validator: _model validator: _model.passwordTextControllerValidator.asValidator(context),
.passwordTextControllerValidator
.asValidator(context),
), ),
), ),
), ),
], ],
), ),
), ),
Builder( Builder(
builder: (context) { builder: (context) {
if (MediaQuery.sizeOf(context).width < if (MediaQuery.sizeOf(context).width < kBreakpointSmall ? true : false) {
kBreakpointSmall
? true
: false) {
return Column( return Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Padding( Padding(
padding: padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0),
const EdgeInsetsDirectional
.fromSTEB(
0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
key: const ValueKey<String>('SubmitButtonWidget'),
onPressed: _isFormInvalid() onPressed: _isFormInvalid()
? null ? null
: () async { : () async {
await _model await AuthenticationService.signIn(context, _model,
.signInLoginAction( emailAdress: _model.emailAddressTextController.text,
context, password: _model.passwordTextController.text,
_model,
emailAdress: _model
.emailAddressTextController
.text,
password: _model
.passwordTextController
.text,
); );
setState(() {}); setState(() {});
}, },
text: FFLocalizations.of( text: FFLocalizations.of(context).getText('k44tm7wo' /* Entrar */),
context)
.getText(
'k44tm7wo' /* Entrar */,
),
options: FFButtonOptions( options: FFButtonOptions(
width: double.infinity, width: double.infinity,
height: 44.0, height: 44.0,
padding: padding: const EdgeInsetsDirectional.fromSTEB(0.0,0.0, 0.0, 0.0),
const EdgeInsetsDirectional iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0,0.0, 0.0, 0.0),
.fromSTEB(0.0, color: FlutterFlowTheme.of(context).primary,
0.0, 0.0, 0.0), textStyle: FlutterFlowTheme.of(context).titleSmall.override(
iconPadding: fontFamily: 'Plus Jakarta Sans',
const EdgeInsetsDirectional color: FlutterFlowTheme.of(context).info,
.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, fontSize: 16.0,
letterSpacing: letterSpacing: 0.0,
0.0, fontWeight: FontWeight.w500,
fontWeight: useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans')),
FontWeight
.w500,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
'Plus Jakarta Sans'),
),
elevation: 3.0, elevation: 3.0,
borderSide: borderSide: const BorderSide(
const BorderSide( color: Colors.transparent,
color: width: 1.0),
Colors.transparent, borderRadius: BorderRadius.circular(12.0),
width: 1.0, disabledColor: FlutterFlowTheme.of(context).customColor5,
), disabledTextColor: Colors.white,
borderRadius:
BorderRadius.circular(
12.0),
disabledColor:
FlutterFlowTheme.of(
context)
.customColor5,
disabledTextColor:
Colors.white,
), ),
showLoadingIndicator: false, showLoadingIndicator: false,
), ),
), ),
Padding( Padding(
padding: padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0),
const EdgeInsetsDirectional
.fromSTEB(
0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: () async { key: const ValueKey<String>('toggleSignUpPage'),
await widget onPressed: () async => await widget.toggleSignUpPage?.call(),
.toggleSignUpPage text: FFLocalizations.of(context).getText('14u7ipws' /* Cadastrar */,
?.call();
},
text: FFLocalizations.of(
context)
.getText(
'14u7ipws' /* Cadastrar */,
), ),
options: FFButtonOptions( options: FFButtonOptions(
width: double.infinity, width: double.infinity,
height: 44.0, height: 44.0,
padding: padding: const EdgeInsetsDirectional.fromSTEB(0.0,0.0, 0.0, 0.0),
const EdgeInsetsDirectional iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
.fromSTEB(0.0, color: FlutterFlowTheme.of(context).customColor1,
0.0, 0.0, 0.0),
iconPadding:
const EdgeInsetsDirectional
.fromSTEB(0.0,
0.0, 0.0, 0.0),
color:
FlutterFlowTheme.of(
context)
.customColor1,
textStyle: textStyle:
FlutterFlowTheme.of( FlutterFlowTheme.of(context)
context)
.titleSmall .titleSmall
.override( .override(
fontFamily: fontFamily: 'Plus Jakarta Sans',
'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).secondaryText,
color: FlutterFlowTheme.of(
context)
.secondaryText,
fontSize: 16.0, fontSize: 16.0,
letterSpacing: letterSpacing: 0.0,
0.0, fontWeight: FontWeight.w500,
fontWeight: useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
FontWeight
.w500,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
'Plus Jakarta Sans'),
), ),
elevation: 3.0, elevation: 3.0,
borderSide: borderSide: const BorderSide(color: Colors.transparent, width: 1.0),
const BorderSide( borderRadius: BorderRadius.circular(12.0),
color:
Colors.transparent,
width: 1.0,
),
borderRadius:
BorderRadius.circular(
12.0),
), ),
showLoadingIndicator: false, showLoadingIndicator: false,
), ),
@ -705,109 +518,59 @@ class _SignInTemplateComponentWidgetState
} else { } else {
return Row( return Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceEvenly,
MainAxisAlignment.spaceEvenly,
children: [ children: [
Expanded( Expanded(
child: Padding( child: Padding(
padding: padding:
const EdgeInsetsDirectional const EdgeInsetsDirectional
.fromSTEB(0.0, 0.0, .fromSTEB(0.0, 0.0,0.0, 16.0),
0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
key: const ValueKey< key: const ValueKey<String>('SubmitButtonWidget'),
String>( onPressed: _isFormInvalid() ? null : () async {
'loginCallback'),
onPressed:
_isFormInvalid()
? null
: () async {
try { try {
await _model await AuthenticationService.signIn(
.signInLoginAction(
context, context,
_model, _model,
emailAdress: _model emailAdress: _model.emailAddressTextController.text,
.emailAddressTextController password: _model.passwordTextController.text,
.text,
password: _model
.passwordTextController
.text,
); );
setState( setState(() {});
() {});
} catch (e, s) { } catch (e, s) {
await DialogUtil await DialogUtil.errorDefault(context);
.errorDefault(
context);
LogUtil.requestAPIFailed( LogUtil.requestAPIFailed(
'login.php', 'login.php',
_model _model.emailAddressTextController.text,
.emailAddressTextController
.text,
"Login", "Login",
e, e, s);
s);
} }
}, },
text: FFLocalizations.of( text: FFLocalizations.of(context).getText('1x926nsn'),
context)
.getText(
'1x926nsn' /* Entrar */,
),
options: FFButtonOptions( options: FFButtonOptions(
width: double.infinity, width: double.infinity,
height: 44.0, height: 44.0,
padding: padding: const EdgeInsetsDirectional.fromSTEB(0.0,0.0, 0.0, 0.0),
const EdgeInsetsDirectional iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
.fromSTEB(0.0, color: FlutterFlowTheme.of(context).accent1,
0.0, 0.0, 0.0), textStyle: FlutterFlowTheme.of(context)
iconPadding:
const EdgeInsetsDirectional
.fromSTEB(0.0,
0.0, 0.0, 0.0),
color:
FlutterFlowTheme.of(
context)
.accent1,
textStyle:
FlutterFlowTheme.of(
context)
.titleSmall .titleSmall
.override( .override(
fontFamily: fontFamily: 'Plus Jakarta Sans',
'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).info,
color: FlutterFlowTheme.of( fontSize: 16.0,
context) letterSpacing: 0.0,
.info, fontWeight: FontWeight.w500,
fontSize: useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
16.0,
letterSpacing:
0.0,
fontWeight:
FontWeight
.w500,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
'Plus Jakarta Sans'),
), ),
elevation: 3.0, elevation: 3.0,
borderSide: borderSide: const BorderSide(
const BorderSide( color: Colors.transparent,
color: Colors
.transparent,
width: 1.0, width: 1.0,
), ),
borderRadius: borderRadius: BorderRadius.circular(12.0),
BorderRadius disabledColor: const Color(0xE81AAB5F),
.circular(12.0),
disabledColor:
const Color(
0xE81AAB5F),
), ),
showLoadingIndicator: showLoadingIndicator: true,
true,
), ),
), ),
), ),
@ -818,79 +581,45 @@ class _SignInTemplateComponentWidgetState
.fromSTEB(0.0, 0.0, .fromSTEB(0.0, 0.0,
0.0, 16.0), 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: () async { key: const ValueKey<String>('toggleSignUpPage'),
await widget onPressed: () async => await widget.toggleSignUpPage?.call(),
.toggleSignUpPage text: FFLocalizations.of(context).getText('jwvd4ai1' /* Cadastrar */),
?.call();
},
text: FFLocalizations.of(
context)
.getText(
'jwvd4ai1' /* Cadastrar */,
),
options: FFButtonOptions( options: FFButtonOptions(
width: double.infinity, width: double.infinity,
height: 44.0, height: 44.0,
padding: padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
const EdgeInsetsDirectional iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
.fromSTEB(0.0, color: FlutterFlowTheme.of(context).customColor1,
0.0, 0.0, 0.0),
iconPadding:
const EdgeInsetsDirectional
.fromSTEB(0.0,
0.0, 0.0, 0.0),
color:
FlutterFlowTheme.of(
context)
.customColor1,
textStyle: textStyle:
FlutterFlowTheme.of( FlutterFlowTheme
context) .of(context)
.titleSmall .titleSmall
.override( .override(
fontFamily: fontFamily: 'Plus Jakarta Sans',
'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).secondaryText,
color: FlutterFlowTheme.of( fontSize: 16.0,
context) letterSpacing: 0.0,
.secondaryText, fontWeight: FontWeight.w500,
fontSize: useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
16.0,
letterSpacing:
0.0,
fontWeight:
FontWeight
.w500,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
'Plus Jakarta Sans'),
), ),
elevation: 3.0, elevation: 3.0,
borderSide: borderSide: const BorderSide(color: Colors.transparent,width: 1.0,),
const BorderSide( borderRadius: BorderRadius.circular(12.0),
color: Colors
.transparent,
width: 1.0,
),
borderRadius:
BorderRadius
.circular(12.0),
), ),
showLoadingIndicator: showLoadingIndicator: false,
false,
), ),
), ),
), ),
].divide( ].divide(const SizedBox(width: 7.0)));
const SizedBox(width: 7.0)),
);
} }
}, },
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional padding: const EdgeInsetsDirectional.fromSTEB(0.0, 12.0, 0.0, 12.0),
.fromSTEB(0.0, 12.0, 0.0, 12.0),
child: InkWell( child: InkWell(
key: const ValueKey<String>('ForgotPassword'),
splashColor: Colors.transparent, splashColor: Colors.transparent,
focusColor: Colors.transparent, focusColor: Colors.transparent,
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
@ -898,100 +627,42 @@ class _SignInTemplateComponentWidgetState
onTap: () async { onTap: () async {
await showModalBottomSheet( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: backgroundColor: Colors.transparent,
Colors.transparent,
context: context, context: context,
builder: (context) { builder: (context) {
return Padding( return Padding(
padding: padding: MediaQuery.viewInsetsOf(context),
MediaQuery.viewInsetsOf( child: const ForgotPasswordTemplateComponentWidget(),
context),
child:
const ForgotPasswordTemplateComponentWidget(),
); );
}, }).then((value) => safeSetState(() {}));
).then( },
(value) => safeSetState(() {}));
},
child: RichText( child: RichText(
textScaler: MediaQuery.of(context) textScaler: MediaQuery.of(context).textScaler,
.textScaler,
text: TextSpan( text: TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: FFLocalizations.of( text: FFLocalizations.of(context).getText('05dx91ku' /* Você esqueceu a sua senha? */,),
context) style: TextStyle(color: FlutterFlowTheme.of(context).primaryText),
.getText(
'05dx91ku' /* Você esqueceu a sua senha? */,
),
style: TextStyle(
color: FlutterFlowTheme.of(
context)
.primaryText,
),
), ),
TextSpan( TextSpan(
text: FFLocalizations.of( text: FFLocalizations.of(context).getText('p5c6d54y' /* Recupere aqui */),
context) style: FlutterFlowTheme.of(context).bodyMedium.override(
.getText( fontFamily: 'Plus Jakarta Sans',
'p5c6d54y' /* Recupere aqui */, color: FlutterFlowTheme.of(context).primary,
),
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily:
'Plus Jakarta Sans',
color:
FlutterFlowTheme.of(
context)
.primary,
fontSize: 14.0, fontSize: 14.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: fontWeight: FontWeight.normal,
FontWeight.normal, useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
'Plus Jakarta Sans'),
), ),
mouseCursor: mouseCursor: SystemMouseCursors.click,
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(
// () {}));
// },
) )
], ],
style: style: FlutterFlowTheme.of(context)
FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
FlutterFlowTheme.of(
context)
.bodyMediumFamily,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily)),
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
), ),
), ),
), ),

View File

@ -1,25 +1,17 @@
import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:flutter/material.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 '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
import 'sign_up_template_component_widget.dart' import 'sign_up_template_component_widget.dart'
show SignUpTemplateComponentWidget; show SignUpTemplateComponentWidget;
import 'package:flutter/material.dart';
class SignUpTemplateComponentModel class SignUpTemplateComponentModel
extends FlutterFlowModel<SignUpTemplateComponentWidget> { extends FlutterFlowModel<SignUpTemplateComponentWidget> {
/// State fields for stateful widgets in this component.
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
// State field(s) for nameRegisterForm widget.
FocusNode? nameRegisterFormFocusNode; FocusNode? nameRegisterFormFocusNode;
TextEditingController? nameRegisterFormTextController; TextEditingController? nameRegisterFormTextController;
String? Function(BuildContext, String?)? String? Function(BuildContext, String?)? nameRegisterFormTextControllerValidator;
nameRegisterFormTextControllerValidator; String? _nameRegisterFormTextControllerValidator(BuildContext context, String? val) {
String? _nameRegisterFormTextControllerValidator(
BuildContext context, String? val) {
if (val == null || val.isEmpty) { if (val == null || val.isEmpty) {
return FFLocalizations.of(context).getText( return FFLocalizations.of(context).getText(
'3bs10dfq' /* Campo é necessário */, '3bs10dfq' /* Campo é necessário */,
@ -29,13 +21,10 @@ class SignUpTemplateComponentModel
return null; return null;
} }
// State field(s) for emailRegisterForm widget.
FocusNode? emailRegisterFormFocusNode; FocusNode? emailRegisterFormFocusNode;
TextEditingController? emailRegisterFormTextController; TextEditingController? emailRegisterFormTextController;
String? Function(BuildContext, String?)? String? Function(BuildContext, String?)? emailRegisterFormTextControllerValidator;
emailRegisterFormTextControllerValidator; String? _emailRegisterFormTextControllerValidator(BuildContext context, String? val) {
String? _emailRegisterFormTextControllerValidator(
BuildContext context, String? val) {
if (val == null || val.isEmpty) { if (val == null || val.isEmpty) {
return FFLocalizations.of(context).getText( return FFLocalizations.of(context).getText(
'mlvw63yj' /* Campo é necessário */, 'mlvw63yj' /* Campo é necessário */,
@ -50,14 +39,11 @@ class SignUpTemplateComponentModel
return null; return null;
} }
// State field(s) for passwordRegisterForm widget.
FocusNode? passwordRegisterFormFocusNode; FocusNode? passwordRegisterFormFocusNode;
TextEditingController? passwordRegisterFormTextController; TextEditingController? passwordRegisterFormTextController;
late bool passwordRegisterFormVisibility; late bool passwordRegisterFormVisibility;
String? Function(BuildContext, String?)? String? Function(BuildContext, String?)? passwordRegisterFormTextControllerValidator;
passwordRegisterFormTextControllerValidator; String? _passwordRegisterFormTextControllerValidator(BuildContext context, String? val) {
String? _passwordRegisterFormTextControllerValidator(
BuildContext context, String? val) {
if (val == null || val.isEmpty) { if (val == null || val.isEmpty) {
return FFLocalizations.of(context).getText( return FFLocalizations.of(context).getText(
'6nn79lmh' /* Campo é necessário */, '6nn79lmh' /* Campo é necessário */,
@ -73,18 +59,14 @@ class SignUpTemplateComponentModel
return null; return null;
} }
// Stores action output result for [Action Block - signUpRegisterAction] action in SignUpButtonRegisterForm widget. bool? register;
bool? signUp;
@override @override
void initState(BuildContext context) { void initState(BuildContext context) {
nameRegisterFormTextControllerValidator = nameRegisterFormTextControllerValidator = _nameRegisterFormTextControllerValidator;
_nameRegisterFormTextControllerValidator; emailRegisterFormTextControllerValidator = _emailRegisterFormTextControllerValidator;
emailRegisterFormTextControllerValidator =
_emailRegisterFormTextControllerValidator;
passwordRegisterFormVisibility = false; passwordRegisterFormVisibility = false;
passwordRegisterFormTextControllerValidator = passwordRegisterFormTextControllerValidator = _passwordRegisterFormTextControllerValidator;
_passwordRegisterFormTextControllerValidator;
} }
@override @override
@ -99,61 +81,6 @@ class SignUpTemplateComponentModel
passwordRegisterFormTextController?.dispose(); passwordRegisterFormTextController?.dispose();
} }
Future<bool> 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;
}
}
} }

View File

@ -4,35 +4,26 @@ import 'package:flutter_animate/flutter_animate.dart';
import 'package:google_fonts/google_fonts.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/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/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/storage_util.dart';
import 'package:hub/shared/utils/validator_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_animations.dart';
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart'; import '/flutter_flow/flutter_flow_widgets.dart';
import '../../../shared/services/authentication/authentication_service.dart';
import 'sign_up_template_component_model.dart'; import 'sign_up_template_component_model.dart';
export 'sign_up_template_component_model.dart'; export 'sign_up_template_component_model.dart';
class SignUpTemplateComponentWidget extends StatefulWidget { class SignUpTemplateComponentWidget extends StatefulWidget {
const SignUpTemplateComponentWidget({ const SignUpTemplateComponentWidget({super.key, required this.toggleSignInPage});
super.key,
required this.toggleSignInPage,
});
final Future Function()? toggleSignInPage; final Future Function()? toggleSignInPage;
@override State<SignUpTemplateComponentWidget> createState() => _SignUpTemplateComponentWidgetState();
@override
State<SignUpTemplateComponentWidget> createState() =>
_SignUpTemplateComponentWidgetState();
} }
class _SignUpTemplateComponentWidgetState class _SignUpTemplateComponentWidgetState extends State<SignUpTemplateComponentWidget> with TickerProviderStateMixin {
extends State<SignUpTemplateComponentWidget> with TickerProviderStateMixin {
late SignUpTemplateComponentModel _model; late SignUpTemplateComponentModel _model;
final animationsMap = <String, AnimationInfo>{}; final animationsMap = <String, AnimationInfo>{};
@override @override
@ -246,6 +237,8 @@ class _SignUpTemplateComponentWidgetState
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: TextFormField( child: TextFormField(
key: const ValueKey<String>(
'nameTextFormField'),
controller: _model controller: _model
.nameRegisterFormTextController, .nameRegisterFormTextController,
focusNode: _model focusNode: _model
@ -388,6 +381,8 @@ class _SignUpTemplateComponentWidgetState
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: TextFormField( child: TextFormField(
key: const ValueKey<String>(
'emailTextFormField'),
controller: _model controller: _model
.emailRegisterFormTextController, .emailRegisterFormTextController,
focusNode: _model focusNode: _model
@ -532,6 +527,8 @@ class _SignUpTemplateComponentWidgetState
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: TextFormField( child: TextFormField(
key: const ValueKey<String>(
'passwordTextFormField'),
controller: _model controller: _model
.passwordRegisterFormTextController, .passwordRegisterFormTextController,
focusNode: _model focusNode: _model
@ -631,6 +628,7 @@ class _SignUpTemplateComponentWidgetState
context) context)
.primaryBackground, .primaryBackground,
suffixIcon: InkWell( suffixIcon: InkWell(
key: const ValueKey<String>('passwordVisibilitySuffixIcon'),
onTap: () => setState( onTap: () => setState(
() => _model () => _model
.passwordRegisterFormVisibility = .passwordRegisterFormVisibility =
@ -685,41 +683,24 @@ class _SignUpTemplateComponentWidgetState
padding: const EdgeInsetsDirectional padding: const EdgeInsetsDirectional
.fromSTEB(0.0, 0.0, 0.0, 16.0), .fromSTEB(0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
key: const ValueKey<String>('SubmitButtonWidget'),
onPressed: isFormInvalid() onPressed: isFormInvalid()
? null ? null
: () async { : () async {
var shouldSetState = false; var shouldSetState = false;
_model.signUp = await _model _model.register = await AuthenticationService.signUp(context,
.signUpRegisterAction( email: _model.emailRegisterFormTextController.text,
context, name: _model.nameRegisterFormTextController.text,
name: _model passwd: _model.passwordRegisterFormTextController.text,
.nameRegisterFormTextController device: StorageUtil().deviceType,
.text,
passwd: _model
.passwordRegisterFormTextController
.text,
email: _model
.emailRegisterFormTextController
.text,
device:
StorageUtil()
.deviceType,
); );
shouldSetState = true; shouldSetState = true;
if (_model.signUp == true) { if (_model.register == true) await widget.toggleSignInPage?.call();
await widget else {
.toggleSignInPage if (shouldSetState) setState(() {});
?.call();
} else {
if (shouldSetState) {
setState(() {});
}
return; return;
} }
if (shouldSetState) setState(() {});
if (shouldSetState) {
setState(() {});
}
}, },
text: FFLocalizations.of(context) text: FFLocalizations.of(context)
.getText( .getText(
@ -774,14 +755,12 @@ class _SignUpTemplateComponentWidgetState
padding: const EdgeInsetsDirectional padding: const EdgeInsetsDirectional
.fromSTEB(0.0, 12.0, 0.0, 12.0), .fromSTEB(0.0, 12.0, 0.0, 12.0),
child: InkWell( child: InkWell(
key: const ValueKey<String>('toggleSignInPage'),
splashColor: Colors.transparent, splashColor: Colors.transparent,
focusColor: Colors.transparent, focusColor: Colors.transparent,
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: () async { onTap: () async => await widget.toggleSignInPage?.call(),
await widget.toggleSignInPage
?.call();
},
child: RichText( child: RichText(
textScaler: MediaQuery.of(context) textScaler: MediaQuery.of(context)
.textScaler, .textScaler,

View File

@ -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 'package:hub/shared/utils/storage_util.dart';
import '/backend/api_requests/api_calls.dart'; import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
import 'view_visit_detail_widget.dart' show ViewVisitDetailWidget; import 'view_visit_detail_widget.dart' show ViewVisitDetailWidget;
import 'package:flutter/material.dart';
class ViewVisitDetailModel extends FlutterFlowModel<ViewVisitDetailWidget> { class ViewVisitDetailModel extends FlutterFlowModel<ViewVisitDetailWidget> {
late final String devUUID; late final String devUUID;

View File

@ -1,9 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_manager.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/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: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'; import 'package:hub/shared/utils/storage_util.dart';
class VisitorSearchModalTemplateComponentModel class VisitorSearchModalTemplateComponentModel

View File

@ -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_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:provider/provider.dart';
class VisitorSearchModalTemplateComponentWidget extends StatefulWidget { class VisitorSearchModalTemplateComponentWidget extends StatefulWidget {
const VisitorSearchModalTemplateComponentWidget({ const VisitorSearchModalTemplateComponentWidget({
@ -34,7 +33,6 @@ class _VisitorSearchModalTemplateComponentWidgetState
with TickerProviderStateMixin { with TickerProviderStateMixin {
late VisitorSearchModalTemplateComponentModel _model; late VisitorSearchModalTemplateComponentModel _model;
@override
safeSetState(VoidCallback callback) { safeSetState(VoidCallback callback) {
super.setState(callback); super.setState(callback);
_model.onUpdate(); _model.onUpdate();

View File

@ -26,11 +26,8 @@ class WelcomeTemplateComponentWidget extends StatefulWidget {
_WelcomeTemplateComponentWidgetState(); _WelcomeTemplateComponentWidgetState();
} }
class _WelcomeTemplateComponentWidgetState class _WelcomeTemplateComponentWidgetState extends State<WelcomeTemplateComponentWidget> with TickerProviderStateMixin {
extends State<WelcomeTemplateComponentWidget>
with TickerProviderStateMixin {
late WelcomeTemplateComponentModel _model; late WelcomeTemplateComponentModel _model;
final animationsMap = <String, AnimationInfo>{}; final animationsMap = <String, AnimationInfo>{};
@override @override
@ -44,38 +41,39 @@ class _WelcomeTemplateComponentWidgetState
super.initState(); super.initState();
_model = createModel(context, () => WelcomeTemplateComponentModel()); _model = createModel(context, () => WelcomeTemplateComponentModel());
animationsMap.addAll({ animationsMap.addAll(
'containerOnPageLoadAnimation': AnimationInfo( <String, AnimationInfo>{
trigger: AnimationTrigger.onPageLoad, 'containerOnPageLoadAnimation': AnimationInfo(
effectsBuilder: () => [ trigger: AnimationTrigger.onPageLoad,
VisibilityEffect(duration: 1.ms), effectsBuilder: () => [
FadeEffect( VisibilityEffect(duration: 1.ms),
curve: Curves.easeInOut, FadeEffect(
delay: 0.0.ms, curve: Curves.easeInOut,
duration: 300.0.ms, delay: 0.0.ms,
begin: 0.0, duration: 300.0.ms,
end: 1.0, begin: 0.0,
), end: 1.0,
MoveEffect( ),
curve: Curves.easeInOut, MoveEffect(
delay: 0.0.ms, curve: Curves.easeInOut,
duration: 300.0.ms, delay: 0.0.ms,
begin: const Offset(0.0, 140.0), duration: 300.0.ms,
end: const Offset(0.0, 0.0), begin: const Offset(0.0, 140.0),
), end: const Offset(0.0, 0.0),
ScaleEffect( ),
curve: Curves.easeInOut, ScaleEffect(
delay: 0.0.ms, curve: Curves.easeInOut,
duration: 300.0.ms, delay: 0.0.ms,
begin: const Offset(0.9, 0.9), duration: 300.0.ms,
end: const Offset(1.0, 1.0), begin: const Offset(0.9, 0.9),
), end: const Offset(1.0, 1.0),
TiltEffect( ),
curve: Curves.easeInOut, TiltEffect(
delay: 0.0.ms, curve: Curves.easeInOut,
duration: 300.0.ms, delay: 0.0.ms,
begin: const Offset(-0.349, 0), duration: 300.0.ms,
end: const Offset(0, 0), begin: const Offset(-0.349, 0),
end: const Offset(0, 0),
), ),
], ],
), ),
@ -85,7 +83,6 @@ class _WelcomeTemplateComponentWidgetState
@override @override
void dispose() { void dispose() {
_model.maybeDispose(); _model.maybeDispose();
super.dispose(); super.dispose();
} }
@ -115,10 +112,7 @@ class _WelcomeTemplateComponentWidgetState
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text( FFLocalizations.of(context).getText('dsc9tuc8' /* UMA EXPERIÊCIA COMPLETA */),
FFLocalizations.of(context).getText(
'dsc9tuc8' /* UMA EXPERIÊCIA COMPLETA */,
),
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.displaySmall .displaySmall
@ -128,28 +122,22 @@ class _WelcomeTemplateComponentWidgetState
fontSize: 24.0, fontSize: 24.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
.containsKey('Plus Jakarta Sans'),
), ),
), ),
Align( Align(
alignment: const AlignmentDirectional(0.0, -1.0), alignment: const AlignmentDirectional(0.0, -1.0),
child: Text( child: Text(FFLocalizations.of(context).getText('5bgqn16z' /* COM CONFORTO ONDE VOCÊ ESTIVER... */),
FFLocalizations.of(context).getText(
'5bgqn16z' /* COM CONFORTO ONDE VOCÊ ESTIVER... */,
),
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.displaySmall .displaySmall
.override( .override(
fontFamily: 'Plus Jakarta Sans', fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context) color: FlutterFlowTheme.of(context).primaryText,
.primaryText,
fontSize: 15.0, fontSize: 15.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
.containsKey('Plus Jakarta Sans'),
), ),
), ),
), ),
@ -166,8 +154,7 @@ class _WelcomeTemplateComponentWidgetState
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(0.0), borderRadius: BorderRadius.circular(0.0),
child: const AtomImageSvgTheme( child: const AtomImageSvgTheme(filename: 'welcome', width: 600, height: double.infinity),
filename: 'welcome', width: 600, height: double.infinity),
), ),
), ),
Align( Align(
@ -184,10 +171,7 @@ class _WelcomeTemplateComponentWidgetState
BoxShadow( BoxShadow(
blurRadius: 0.0, blurRadius: 0.0,
color: Colors.transparent, color: Colors.transparent,
offset: Offset( offset: Offset(0.0,0.0),
0.0,
0.0,
),
) )
], ],
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
@ -203,35 +187,23 @@ class _WelcomeTemplateComponentWidgetState
children: [ children: [
Builder( Builder(
builder: (context) { builder: (context) {
if (MediaQuery.sizeOf(context).width < if (MediaQuery.sizeOf(context).width < kBreakpointSmall ? true : false) {
kBreakpointSmall
? true
: false) {
return Column( return Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Padding( Padding(
padding: padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0),
const EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
key: const ValueKey<String>( key: const ValueKey<String>('toggleSignInPage'),
'toggleSignInPage'),
onPressed: () async { onPressed: () async {
await widget.toggleSignInPage?.call(); await widget.toggleSignInPage?.call();
}, },
text: text: FFLocalizations.of(context).getText( 'dynet730' /* Entrar */),
FFLocalizations.of(context).getText(
'dynet730' /* Entrar */,
),
options: FFButtonOptions( options: FFButtonOptions(
width: double.infinity, width: double.infinity,
height: 44.0, height: 44.0,
padding: const EdgeInsetsDirectional padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
.fromSTEB(0.0, 0.0, 0.0, 0.0), iconPadding: 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) color: FlutterFlowTheme.of(context)
.primary, .primary,
textStyle: FlutterFlowTheme.of( textStyle: FlutterFlowTheme.of(
@ -325,7 +297,10 @@ class _WelcomeTemplateComponentWidgetState
padding: const EdgeInsetsDirectional padding: const EdgeInsetsDirectional
.fromSTEB(0.0, 0.0, 0.0, 16.0), .fromSTEB(0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
key: const ValueKey<String>('toggleSignInPage'),
onPressed: () async { onPressed: () async {
await widget.toggleSignInPage await widget.toggleSignInPage
?.call(); ?.call();
}, },
@ -378,6 +353,7 @@ class _WelcomeTemplateComponentWidgetState
padding: const EdgeInsetsDirectional padding: const EdgeInsetsDirectional
.fromSTEB(0.0, 0.0, 0.0, 16.0), .fromSTEB(0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
key: const ValueKey<String>('toggleSignUpPage'),
onPressed: () async { onPressed: () async {
await widget.toggleSignUpPage await widget.toggleSignUpPage
?.call(); ?.call();

View File

@ -1321,8 +1321,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
'en': '', 'en': '',
}, },
'mqw2z9f3': { 'mqw2z9f3': {
'pt': '', 'pt': 'INSIRA A NOVA SENHA',
'en': '', 'en': 'ENTER NEW PASSWORD',
}, },
// misc // misc
'asjd2q3k2j4l21': { 'asjd2q3k2j4l21': {

View File

@ -5,13 +5,13 @@ import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/delivery_schedule_page/delivery_schedule_widget.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/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/message_history_page/message_history_page_widget.dart';
import 'package:hub/pages/package_order_page/package_order_page.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/pets_page/pets_page_widget.dart';
import 'package:hub/pages/provisional_schedule_page/provisional_schedule_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/reception_page/reception_page_widget.dart';
import 'package:hub/pages/reservation_page/reservation_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:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -90,14 +90,24 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
: const ReceptionPageWidget() : const ReceptionPageWidget()
: const WelcomePageWidget(), : 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( FFRoute(
name: 'homePage', name: 'homePage',
path: '/homePage', path: '/homePage',
builder: (context, params) { builder: (context, params) => HomePageWidget(key: UniqueKey()),
return HomePageWidget(
key: UniqueKey(),
);
},
), ),
FFRoute( FFRoute(
name: 'receptionPage', name: 'receptionPage',

View File

@ -1,6 +1,8 @@
import 'dart:async';
import 'dart:developer'; import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'package:app_links/app_links.dart';
import 'package:app_tracking_transparency/app_tracking_transparency.dart'; import 'package:app_tracking_transparency/app_tracking_transparency.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart';
@ -20,9 +22,11 @@ import 'package:responsive_framework/responsive_framework.dart';
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>(); final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
void main() async { void main() async {
await initializeApp(); await initializeApp();
runApp(const App()); runApp(const App());
FirebaseMessaging.onBackgroundMessage(_backgroundHandlerMessage); FirebaseMessaging.onBackgroundMessage(_backgroundHandlerMessage);
} }
Future<void> initializeApp() async { Future<void> initializeApp() async {
@ -109,11 +113,14 @@ class App extends StatefulWidget {
} }
class _AppState extends State<App> { class _AppState extends State<App> {
Locale? _locale = FFLocalizations.getStoredLocale(); Locale? _locale = FFLocalizations.getStoredLocale();
ThemeMode _themeMode = FlutterFlowTheme.themeMode; ThemeMode _themeMode = FlutterFlowTheme.themeMode;
late AppStateNotifier _appStateNotifier; late AppStateNotifier _appStateNotifier;
late GoRouter _router; late GoRouter _router;
bool displaySplashImage = true; bool displaySplashImage = true;
late AppLinks _appLinks;
StreamSubscription<Uri>? _linkSubscription;
final ThemeData _darkTheme = ThemeData( final ThemeData _darkTheme = ThemeData(
brightness: Brightness.dark, brightness: Brightness.dark,
@ -131,7 +138,6 @@ class _AppState extends State<App> {
}), }),
), ),
); );
final ThemeData _theme = ThemeData( final ThemeData _theme = ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
scrollbarTheme: ScrollbarThemeData( scrollbarTheme: ScrollbarThemeData(
@ -148,20 +154,16 @@ class _AppState extends State<App> {
}), }),
), ),
); );
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates = const [
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates = FFLocalizationsDelegate(),
const [ GlobalMaterialLocalizations.delegate,
FFLocalizationsDelegate(), GlobalWidgetsLocalizations.delegate,
GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate, ];
GlobalCupertinoLocalizations.delegate,
];
final Iterable<Locale> supportedLocales = const [ final Iterable<Locale> supportedLocales = const [
Locale('pt'), Locale('pt'),
Locale('en'), Locale('en'),
]; ];
Widget Function(BuildContext, Widget?)? builder = (context, widget) { Widget Function(BuildContext, Widget?)? builder = (context, widget) {
const String HD4K = '4K'; const String HD4K = '4K';
const String ULTRAWIDE = 'ULTRAWIDE'; const String ULTRAWIDE = 'ULTRAWIDE';
@ -179,9 +181,9 @@ class _AppState extends State<App> {
); );
}; };
@override @override void initState() {
void initState() {
super.initState(); super.initState();
initDeepLinks();
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
@ -192,6 +194,38 @@ class _AppState extends State<App> {
_setupFirebaseMessaging(); _setupFirebaseMessaging();
} }
@override void dispose() {
_linkSubscription?.cancel();
super.dispose();
}
Future<void> 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 { void _setupFirebaseMessaging() async {
FirebaseMessaging messaging = FirebaseMessaging.instance; FirebaseMessaging messaging = FirebaseMessaging.instance;
@ -220,12 +254,10 @@ class _AppState extends State<App> {
} }
}); });
} }
void setLocale(String language) { void setLocale(String language) {
setState(() => _locale = createLocale(language)); setState(() => _locale = createLocale(language));
FFLocalizations.storeLocale(language); FFLocalizations.storeLocale(language);
} }
void setThemeMode(ThemeMode mode) { void setThemeMode(ThemeMode mode) {
setState(() { setState(() {
_themeMode = mode; _themeMode = mode;
@ -233,9 +265,11 @@ class _AppState extends State<App> {
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp.router( return MaterialApp.router(
key: navigatorKey,
title: 'FRE ACCESS HUB', title: 'FRE ACCESS HUB',
builder: builder, builder: builder,
localizationsDelegates: localizationsDelegates, localizationsDelegates: localizationsDelegates,
@ -247,4 +281,5 @@ class _AppState extends State<App> {
routerConfig: _router, routerConfig: _router,
); );
} }
} }

View File

@ -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/flutter_flow_model.dart';
import 'package:hub/flutter_flow/request_manager.dart'; import 'package:hub/flutter_flow/request_manager.dart';
import 'package:hub/pages/acess_history_page/acess_history_page_widget.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'; import 'package:hub/shared/utils/storage_util.dart';
class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> { class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> {

View File

@ -15,6 +15,7 @@ import 'package:hub/shared/utils/log_util.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
@immutable @immutable
// ignore: must_be_immutable
class AccessHistoryScreen extends StatefulWidget { class AccessHistoryScreen extends StatefulWidget {
late Map<String, String> opt = { late Map<String, String> opt = {
'personType': '.*', 'personType': '.*',

View File

@ -3,11 +3,8 @@ import 'dart:io' show Platform;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.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/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.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/storage_util.dart';
import 'package:hub/shared/utils/webview_util.dart'; import 'package:hub/shared/utils/webview_util.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@ -21,7 +18,6 @@ class FastPassPageWidget extends StatefulWidget {
} }
class _FastPassPageWidgetState extends State<FastPassPageWidget> { class _FastPassPageWidgetState extends State<FastPassPageWidget> {
late InAppWebViewController _controllerIOS;
late WebViewController _controllerAll; late WebViewController _controllerAll;
Future<Map<String, String>> initVariables() async { Future<Map<String, String>> initVariables() async {
@ -76,7 +72,6 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
javaScriptEnabled: true, javaScriptEnabled: true,
), ),
onWebViewCreated: (controller) async { onWebViewCreated: (controller) async {
_controllerIOS = controller;
}, },
onLoadStop: (controller, url) async { onLoadStop: (controller, url) async {
await controller.evaluateJavascript( await controller.evaluateJavascript(

View File

@ -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<ForgotPasswordScreen> {
final formKey = GlobalKey<FormState>();
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();
}
}

View File

@ -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<ForgotPasswordScreen> createState() => _ForgotPasswordScreenState();
}
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with TickerProviderStateMixin {
late ForgotPasswordScreenModel _model;
final animationsMap = <String, AnimationInfo>{};
@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<String>('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<String>('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<String>('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),
),
),
);
}
}

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/pages/home_page/home_page_model.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/utils/storage_util.dart';
import 'package:hub/shared/widgets/drawer_widget/drawer_widget.dart'; import 'package:hub/shared/widgets/drawer_widget/drawer_widget.dart';

View File

@ -1,10 +1,8 @@
import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/request_manager.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/pages/liberation_history/liberation_history_widget.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> { class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.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/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/validator_util.dart'; import 'package:hub/shared/utils/validator_util.dart';
import 'package:provider/provider.dart';
class LiberationHistoryWidget extends StatefulWidget { class LiberationHistoryWidget extends StatefulWidget {
const LiberationHistoryWidget({super.key}); const LiberationHistoryWidget({super.key});

View File

@ -1,10 +1,8 @@
import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/request_manager.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/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'; import 'package:hub/shared/utils/storage_util.dart';
class MessageHistoryPageModel class MessageHistoryPageModel

View File

@ -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/pages/message_history_page/message_history_page_model.dart';
import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/log_util.dart';
import 'package:provider/provider.dart';
class MessageHistoryPageWidget extends StatefulWidget { class MessageHistoryPageWidget extends StatefulWidget {
const MessageHistoryPageWidget({super.key}); const MessageHistoryPageWidget({super.key});

View File

@ -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_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';

View File

@ -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/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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.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/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/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
class PetsHistoryScreen extends StatefulWidget { class PetsHistoryScreen extends StatefulWidget {
const PetsHistoryScreen({super.key, required this.model}); const PetsHistoryScreen({super.key, required this.model});

View File

@ -1,10 +1,10 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer'; import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:hub/backend/api_requests/api_calls.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/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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.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/form_field_controller.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/pets_page/pets_page_widget.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/dialog_util.dart';
import 'package:hub/shared/utils/image_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/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart'; import 'package:hub/shared/utils/validator_util.dart';

View File

@ -1,28 +1,21 @@
import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.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/appbar.dart';
import 'package:hub/components/atomic_components/shared_components_atoms/custom_input.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/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/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/submit_button.dart';
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/form_field_controller.dart'; import 'package:hub/flutter_flow/form_field_controller.dart';
import 'package:hub/flutter_flow/nav/nav.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_history_screen.dart';
import 'package:hub/pages/pets_page/pets_page_model.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'; import 'package:material_symbols_icons/symbols.dart';
// ignore: must_be_immutable
class PetsPageWidget extends StatefulWidget { class PetsPageWidget extends StatefulWidget {
dynamic pet; dynamic pet;

View File

@ -1,15 +1,17 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_calls.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/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/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart'; import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_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:hub/shared/utils/storage_util.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import '../../shared/utils/snackbar_util.dart';
class PreferencesPageModel with ChangeNotifier { class PreferencesPageModel with ChangeNotifier {
final unfocusNode = FocusNode(); final unfocusNode = FocusNode();
bool fingerprint = false; bool fingerprint = false;
@ -50,7 +52,7 @@ class PreferencesPageModel with ChangeNotifier {
ptText: 'Notificação alterada com sucesso', ptText: 'Notificação alterada com sucesso',
); );
context.pop(); context.pop();
_showSnackBar(context, content); SnackBarUtil.showSnackBar(context, content);
notify = await _toggleBoolInDb('notify'); notify = await _toggleBoolInDb('notify');
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
@ -59,7 +61,7 @@ class PreferencesPageModel with ChangeNotifier {
ptText: 'Erro ao alterar notificação', ptText: 'Erro ao alterar notificação',
); );
context.pop(); 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', enText: 'Access pass changed successfully',
ptText: 'Senha de acesso alterada com sucesso', ptText: 'Senha de acesso alterada com sucesso',
); );
_showSnackBar(context, content); SnackBarUtil.showSnackBar(context, content);
} else { } else {
content = FFLocalizations.of(context).getVariableText( content = FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar senha de acesso', ptText: 'Erro ao alterar senha de acesso',
enText: 'Error changing access pass', enText: 'Error changing access pass',
); );
_showSnackBar(context, content, isError: true); SnackBarUtil.showSnackBar(context, content, isError: true);
} }
}).catchError((e, s) { }).catchError((e, s) {
final String content = FFLocalizations.of(context).getVariableText( final String content = FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar senha de acesso', ptText: 'Erro ao alterar senha de acesso',
enText: 'Error changing access pass', enText: 'Error changing access pass',
); );
_showSnackBar(context, content, isError: true); SnackBarUtil.showSnackBar(context, content, isError: true);
}).whenComplete(() => notifyListeners()); }).whenComplete(() => notifyListeners());
} }
@ -118,20 +120,20 @@ class PreferencesPageModel with ChangeNotifier {
enText: 'Panic password changed successfully', enText: 'Panic password changed successfully',
ptText: 'Senha de pânico alterada com sucesso', ptText: 'Senha de pânico alterada com sucesso',
); );
_showSnackBar(context, content); SnackBarUtil.showSnackBar(context, content);
} else { } else {
content = FFLocalizations.of(context).getVariableText( content = FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar senha de pânico', ptText: 'Erro ao alterar senha de pânico',
enText: 'Error changing panic password', enText: 'Error changing panic password',
); );
_showSnackBar(context, content, isError: true); SnackBarUtil.showSnackBar(context, content, isError: true);
} }
}).catchError((e, s) { }).catchError((e, s) {
final String content = FFLocalizations.of(context).getVariableText( final String content = FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar senha de pânico', ptText: 'Erro ao alterar senha de pânico',
enText: 'Error changing panic password', enText: 'Error changing panic password',
); );
_showSnackBar(context, content, isError: true); SnackBarUtil.showSnackBar(context, content, isError: true);
}).whenComplete(() => notifyListeners()); }).whenComplete(() => notifyListeners());
} }
@ -151,7 +153,7 @@ class PreferencesPageModel with ChangeNotifier {
fingerprint = await _toggleBoolInDb('fingerprint'); fingerprint = await _toggleBoolInDb('fingerprint');
notifyListeners(); notifyListeners();
_showSnackBar(context, content); SnackBarUtil.showSnackBar(context, content);
} }
fingerprint ? onChange(null) : _showPassKey(context, onChange); fingerprint ? onChange(null) : _showPassKey(context, onChange);
@ -196,7 +198,7 @@ class PreferencesPageModel with ChangeNotifier {
enText: 'Error deleting account', enText: 'Error deleting account',
ptText: 'Erro ao deletar conta', ptText: 'Erro ao deletar conta',
); );
_showSnackBar(context, content); SnackBarUtil.showSnackBar(context, content);
}); });
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
@ -205,7 +207,7 @@ class PreferencesPageModel with ChangeNotifier {
enText: 'Error deleting account', enText: 'Error deleting account',
ptText: 'Erro ao deletar conta', ptText: 'Erro ao deletar conta',
); );
_showSnackBar(context, content, isError: true); SnackBarUtil.showSnackBar(context, content, isError: true);
} }
} }
@ -221,20 +223,7 @@ class PreferencesPageModel with ChangeNotifier {
enText: 'Are you sure you want to logout?', enText: 'Are you sure you want to logout?',
ptText: 'Tem certeza que deseja sair?', ptText: 'Tem certeza que deseja sair?',
); );
onConfirm() async { onConfirm() async => AuthenticationService.deleteAccount(context);
StorageUtil.purge();
context.go(
'/welcomePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
}
showAlertDialog(context, title, content, onConfirm); showAlertDialog(context, title, content, onConfirm);
} }
@ -248,57 +237,12 @@ class PreferencesPageModel with ChangeNotifier {
enText: 'Are you sure you want to unlink your device?', enText: 'Are you sure you want to unlink your device?',
ptText: 'Tem certeza que deseja desvincular seu dispositivo?', ptText: 'Tem certeza que deseja desvincular seu dispositivo?',
); );
onConfirm() async { onConfirm() async => LocalizationService.unlinkLocal(context);
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: <String, dynamic>{
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);
}
}
showAlertDialog(context, title, content, onConfirm); showAlertDialog(context, title, content, onConfirm);
} }
Future<void> initVariables() async { Future<void> initVariables() async {
fingerprint = await _getBoolFromDb('fingerprint'); fingerprint = await _getBoolFromDb('fingerprint');
person = await _getBoolFromDb('person'); person = await _getBoolFromDb('person');
@ -321,38 +265,11 @@ class PreferencesPageModel with ChangeNotifier {
return newValue; 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( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@ -373,7 +290,8 @@ class PreferencesPageModel with ChangeNotifier {
enText: 'Error changing key', enText: 'Error changing key',
ptText: 'Erro ao alterar senha', ptText: 'Erro ao alterar senha',
); );
_showSnackBar(context, content, isError: true); SnackBarUtil.showSnackBar(context, content, isError: true);
}).whenComplete(() => notifyListeners()); }).whenComplete(() => notifyListeners());
} }
} }

View File

@ -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_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/preferences_settings_page/preferences_settings_model.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:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';

View File

@ -1,9 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/flutter_flow_model.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/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:hub/shared/utils/storage_util.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';

View File

@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:barcode_widget/barcode_widget.dart'; import 'package:barcode_widget/barcode_widget.dart';
// import 'package:barcode_widget/barcode_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:flutter_animate/flutter_animate.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/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/qr_code_page/qr_code_page_model.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/biometric_util.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:percent_indicator/circular_percent_indicator.dart';
// import 'package:percent_indicator/percent_indicator.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';

View File

@ -1,19 +1,17 @@
import 'dart:developer'; import 'dart:developer';
import 'package:awesome_notifications/awesome_notifications.dart'; import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/notifications/firebase_messaging_service.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/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_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/reception_page/reception_page_model.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:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -36,8 +34,7 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget>
}(); }();
FirebaseMessagingService().updateDeviceToken(); FirebaseMessagingService().updateDeviceToken();
LocalizationService.checkLocals(context);
processLocals();
} }
@override @override
@ -47,42 +44,16 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget>
super.dispose(); super.dispose();
} }
Future<void> processLocals() async {
try {
final GetLocalsCall callback = PhpGroup.getLocalsCall;
var response = await callback.call();
if (response.jsonBody['error'] == false) {
final List<dynamic> 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 @override
void didChangeAppLifecycleState(AppLifecycleState state) { void didChangeAppLifecycleState(AppLifecycleState state) {
log('() => state: $state'); log('() => state: $state');
if (state == AppLifecycleState.resumed) { if (state == AppLifecycleState.resumed) {
setState(() { setState(() {
processLocals(); LocalizationService.checkLocals(context);
}); });
} }
} }

View File

@ -3,14 +3,10 @@ import 'dart:io' show Platform;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.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/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.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/storage_util.dart';
import 'package:hub/shared/utils/webview_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:url_launcher/url_launcher_string.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
@ -22,7 +18,6 @@ class ReservationPageWidget extends StatefulWidget {
} }
class _ReservationPageWidgetState extends State<ReservationPageWidget> { class _ReservationPageWidgetState extends State<ReservationPageWidget> {
late InAppWebViewController _controllerIOS;
late WebViewController _controllerAll; late WebViewController _controllerAll;
Future<Map<String, String>> initVariables() async { Future<Map<String, String>> initVariables() async {
@ -79,7 +74,6 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
javaScriptEnabled: true, javaScriptEnabled: true,
), ),
onWebViewCreated: (controller) async { onWebViewCreated: (controller) async {
_controllerIOS = controller;
}, },
onLoadStop: (controller, url) async { onLoadStop: (controller, url) async {
await controller.evaluateJavascript( await controller.evaluateJavascript(

View File

@ -1,9 +1,7 @@
import 'dart:developer';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:google_fonts/google_fonts.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/pages/schedule_complete_visit_page/visit_history_page_widget.dart';
import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/share_util.dart'; import 'package:hub/shared/utils/share_util.dart';
import 'package:provider/provider.dart';
class ScheduleComplete extends StatefulWidget { class ScheduleComplete extends StatefulWidget {
const ScheduleComplete({super.key}); const ScheduleComplete({super.key});
@ -1501,17 +1498,16 @@ Widget scheduleVisit(BuildContext context, ScheduleCompleteVisitPageModel model,
devDesc: model.textController3.text, devDesc: model.textController3.text,
idVisitante: model.visitorStrList, idVisitante: model.visitorStrList,
dtInicio: model dtInicio: model
.convertDateFormat(model.textController1.text ?? ''), .convertDateFormat(model.textController1.text),
dtFim: model dtFim: model
.convertDateFormat(model.textController2.text ?? ''), .convertDateFormat(model.textController2.text),
unica: model.switchValue == true ? 'Sim' : 'Não', unica: model.switchValue == true ? 'Sim' : 'Não',
idMotivo: extractIdToStr(model.dropDownValue1!), idMotivo: extractIdToStr(model.dropDownValue1!),
idNAC: extractIdToStr(model.dropDownValue2!), idNAC: extractIdToStr(model.dropDownValue2!),
obs: model.textController3.text, obs: model.textController3.text,
) )
.catchError((e) async { .catchError((e) async => await DialogUtil.errorDefault(context))
await DialogUtil.errorDefault(context); .then((value) async {
}).then((value) async {
if (PhpGroup.postScheduleVisitCall.error( if (PhpGroup.postScheduleVisitCall.error(
(value.jsonBody ?? ''), (value.jsonBody ?? ''),
) == ) ==
@ -1604,7 +1600,7 @@ Widget scheduleVisit(BuildContext context, ScheduleCompleteVisitPageModel model,
labelsHashMap: { labelsHashMap: {
'Nome': model.visitorJsonList[0]['VTE_NOME'], 'Nome': model.visitorJsonList[0]['VTE_NOME'],
'Start': model.textController1.text, 'Start': model.textController1.text,
'End': model.textController2.text ?? '', 'End': model.textController2.text,
'Reason': (RegExp(r'MOT_DESCRICAO:\s*([^,]+)') 'Reason': (RegExp(r'MOT_DESCRICAO:\s*([^,]+)')
.firstMatch( .firstMatch(
model.dropDownValue1.toString()) model.dropDownValue1.toString())

View File

@ -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/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_model.dart';
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.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/mixins/status_mixin.dart';
import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/log_util.dart';

View File

@ -1,5 +1,6 @@
import 'package:hub/shared/mixins/switcher_mixin.dart'; 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 '/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_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
@ -34,6 +35,7 @@ class _SignInPageWidgetState extends State<SignInPageWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
StorageUtil().context = context;
return GestureDetector( return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode) ? FocusScope.of(context).requestFocus(_model.unfocusNode)

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hub/shared/mixins/switcher_mixin.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 '/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_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
@ -35,6 +36,7 @@ class _SignUpPageWidgetState extends State<SignUpPageWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
StorageUtil().context = context;
return GestureDetector( return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode) ? FocusScope.of(context).requestFocus(_model.unfocusNode)

View File

@ -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/mixins/switcher_mixin.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
import '/components/templates_components/welcome_template_component/welcome_template_component_widget.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_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'welcome_page_model.dart'; import 'welcome_page_model.dart';
export 'welcome_page_model.dart'; export 'welcome_page_model.dart';
class WelcomePageWidget extends StatefulWidget with Switcher { class WelcomePageWidget extends StatefulWidget with Switcher {
@ -22,8 +26,7 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
@override @override void initState() {
void initState() {
super.initState(); super.initState();
_model = createModel(context, () => WelcomePageModel()); _model = createModel(context, () => WelcomePageModel());
@ -42,15 +45,17 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
}); });
} }
@override @override void dispose() {
void dispose() {
_model.dispose(); _model.dispose();
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
StorageUtil().context = context;
return GestureDetector( return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode) ? FocusScope.of(context).requestFocus(_model.unfocusNode)

View File

@ -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<State<StatefulWidget>>();
element?.setState(callback);
}
}

View File

@ -108,6 +108,7 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
Future<void> purge() async { Future<void> purge() async {
log('SecureStorageHelper -> Purging secure storage'); log('SecureStorageHelper -> Purging secure storage');
await _secureStorage.deleteAll(); await _secureStorage.deleteAll();
CacheUtil.instance.clear(); CacheUtil.instance.clear();
} }
} }

View File

@ -0,0 +1,197 @@
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/nav/nav.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<void> login(BuildContext context) async {
final GetLocalsCall callback = PhpGroup.getLocalsCall;
final response = await callback.call();
if (response.jsonBody['error']) {
DialogUtil.errorDefault(context);
return;
}
List<dynamic> 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<bool> 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<void> signOut(BuildContext context) async {
await PhpGroup.unregisterDevice.call();
await StorageUtil.purge();
context.go(
'/welcomePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
}
static Future<void> 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<void> 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<void> deleteAccount(BuildContext context) async {
StorageUtil.purge();
context.go(
'/welcomePage',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
}
}

View File

@ -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<void> checkLocals(BuildContext context) async {
try {
final GetLocalsCall callback = PhpGroup.getLocalsCall;
var response = await callback.call();
if (response.jsonBody['error'] == false) {
final List<dynamic> 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<bool> processLocals(BuildContext context) async{
try {
final GetLocalsCall callback = PhpGroup.getLocalsCall;
final ApiCallResponse response = await callback.call();
final List<dynamic> 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<bool> 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<bool> 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<void> 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: <String, dynamic>{
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);
}
}
}

View File

@ -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 'dart:io';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
class DeviceUtil { class DeviceUtil {

View File

@ -1,12 +1,11 @@
// Automatic FlutterFlow imports // Automatic FlutterFlow imports
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data';
import 'package:path_provider/path_provider.dart'; 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'; import '../../flutter_flow/uploaded_file.dart';
class ImageUtils { class ImageUtils {

View File

@ -1,4 +1,3 @@
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart'; import 'package:hub/shared/utils/storage_util.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';

View File

@ -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),
),
),
);
}
}

View File

@ -131,6 +131,7 @@ class StorageUtil {
isFirstRun = false; isFirstRun = false;
await _sharedPreferences.prefs?.setBool('milestone', false); await _sharedPreferences.prefs?.setBool('milestone', false);
_secureStorage.purge(); _secureStorage.purge();
_sqliteStorage.purge();
} }
} }

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';

View File

@ -1,14 +1,6 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: 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: _flutterfire_internals:
dependency: transitive dependency: transitive
description: description:
@ -17,19 +9,38 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.37" version: "1.3.37"
_macros: app_links:
dependency: transitive dependency: "direct main"
description: dart
source: sdk
version: "0.3.2"
analyzer:
dependency: transitive
description: description:
name: analyzer name: app_links
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 sha256: ad1a6d598e7e39b46a34f746f9a8b011ee147e4c275d407fa457e7a62f84dd99
url: "https://pub.dev" url: "https://pub.dev"
source: hosted 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: app_tracking_transparency:
dependency: "direct main" dependency: "direct main"
description: description:
@ -110,70 +121,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" 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: cached_network_image:
dependency: "direct main" dependency: "direct main"
description: description:
@ -270,14 +217,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" 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: collection:
dependency: "direct main" dependency: "direct main"
description: description:
@ -302,14 +241,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" 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: crop_your_image:
dependency: "direct main" dependency: "direct main"
description: description:
@ -350,14 +281,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.8" 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: dbus:
dependency: transitive dependency: transitive
description: description:
@ -831,27 +754,11 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.0" 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: fuchsia_remote_debug_protocol:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
glob:
dependency: transitive
description:
name: glob
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
go_router: go_router:
dependency: "direct main" dependency: "direct main"
description: description:
@ -884,14 +791,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.11.1" version: "0.11.1"
graphs: gtk:
dependency: transitive dependency: transitive
description: description:
name: graphs name: gtk
sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.2" version: "2.1.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
@ -900,14 +807,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" 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: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -1001,14 +900,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.19.0" version: "0.19.0"
io:
dependency: transitive
description:
name: io
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
iregexp: iregexp:
dependency: transitive dependency: transitive
description: description:
@ -1121,14 +1012,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" 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: matcher:
dependency: transitive dependency: transitive
description: description:
@ -1185,14 +1068,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
mockito:
dependency: "direct dev"
description:
name: mockito
sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917"
url: "https://pub.dev"
source: hosted
version: "5.4.4"
nested: nested:
dependency: transitive dependency: transitive
description: description:
@ -1217,14 +1092,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" 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: page_transition:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1385,14 +1252,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.8" version: "2.1.8"
pool:
dependency: transitive
description:
name: pool
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
url: "https://pub.dev"
source: hosted
version: "1.5.1"
process: process:
dependency: transitive dependency: transitive
description: description:
@ -1409,22 +1268,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.1.2" 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: qr:
dependency: transitive dependency: transitive
description: description:
@ -1545,35 +1388,11 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.2" 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: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" 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: source_span:
dependency: transitive dependency: transitive
description: description:
@ -1686,14 +1505,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.6.1" version: "3.6.1"
timing:
dependency: transitive
description:
name: timing
sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -1814,14 +1625,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.2.5" version: "14.2.5"
watcher:
dependency: transitive
description:
name: watcher
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
web: web:
dependency: transitive dependency: transitive
description: description:
@ -1830,22 +1633,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.5.1" 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: webdriver:
dependency: transitive dependency: transitive
description: description:

View File

@ -21,6 +21,7 @@ dependencies:
webview_flutter: ^4.8.0 webview_flutter: ^4.8.0
rxdart: ^0.27.7 rxdart: ^0.27.7
collection: 1.18.0 collection: 1.18.0
app_links: ^6.3.2
crop_your_image: 1.1.0 crop_your_image: 1.1.0
csv: 6.0.0 csv: 6.0.0
device_info_plus: 10.1.0 device_info_plus: 10.1.0
@ -90,7 +91,6 @@ dependencies:
# video_player_web: 2.3.1 # video_player_web: 2.3.1
material_symbols_icons: ^4.2784.0 material_symbols_icons: ^4.2784.0
fluttertoast: ^8.2.8 fluttertoast: ^8.2.8
cupertino_icons: ^1.0.0 cupertino_icons: ^1.0.0
flutter_bloc: ^8.1.6 flutter_bloc: ^8.1.6
flutter_riverpod: ^2.5.1 flutter_riverpod: ^2.5.1
@ -112,10 +112,10 @@ dev_dependencies:
flutter_lints: 4.0.0 flutter_lints: 4.0.0
image: 4.2.0 image: 4.2.0
lints: 4.0.0 lints: 4.0.0
# build_runner: ^2.4.13
# mockito: ^5.4.4
integration_test: integration_test:
sdk: flutter sdk: flutter
build_runner: ^2.4.13
mockito: ^5.4.4
flutter_test: flutter_test:
sdk: flutter sdk: flutter
@ -134,7 +134,6 @@ flutter_launcher_icons:
flutter: flutter:
uses-material-design: true uses-material-design: true
assets: assets:
@ -161,4 +160,4 @@ fonts:
- asset: assets/fonts/icons.ttf - asset: assets/fonts/icons.ttf
- family: Menu - family: Menu
fonts: fonts:
- asset: assets/fonts/menu.ttf - asset: assets/fonts/menu.ttf