fix: Correção Tela de Login e Esqueci minha Senha

This commit is contained in:
Ivan Antunes 2024-07-30 10:57:13 -03:00
parent 3baf2f3840
commit 3a977fd242
15 changed files with 396 additions and 250 deletions

View File

@ -42,6 +42,9 @@ PODS:
- FirebaseAnalytics (~> 10.27.0) - FirebaseAnalytics (~> 10.27.0)
- Firebase/CoreOnly (10.27.0): - Firebase/CoreOnly (10.27.0):
- FirebaseCore (= 10.27.0) - FirebaseCore (= 10.27.0)
- Firebase/Crashlytics (10.27.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 10.27.0)
- Firebase/Messaging (10.27.0): - Firebase/Messaging (10.27.0):
- Firebase/CoreOnly - Firebase/CoreOnly
- FirebaseMessaging (~> 10.27.0) - FirebaseMessaging (~> 10.27.0)
@ -52,6 +55,10 @@ PODS:
- firebase_core (3.1.0): - firebase_core (3.1.0):
- Firebase/CoreOnly (= 10.27.0) - Firebase/CoreOnly (= 10.27.0)
- Flutter - Flutter
- firebase_crashlytics (4.0.1):
- Firebase/Crashlytics (= 10.27.0)
- firebase_core
- Flutter
- firebase_messaging (15.0.1): - firebase_messaging (15.0.1):
- Firebase/Messaging (= 10.27.0) - Firebase/Messaging (= 10.27.0)
- firebase_core - firebase_core
@ -78,8 +85,19 @@ PODS:
- FirebaseCoreInternal (~> 10.0) - FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12) - GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12) - GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreExtension (10.29.0):
- FirebaseCore (~> 10.0)
- FirebaseCoreInternal (10.28.0): - FirebaseCoreInternal (10.28.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)" - "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseCrashlytics (10.27.0):
- FirebaseCore (~> 10.5)
- FirebaseInstallations (~> 10.0)
- FirebaseRemoteConfigInterop (~> 10.23)
- FirebaseSessions (~> 10.5)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (~> 2.1)
- FirebaseInstallations (10.28.0): - FirebaseInstallations (10.28.0):
- FirebaseCore (~> 10.0) - FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Environment (~> 7.8)
@ -94,6 +112,16 @@ PODS:
- GoogleUtilities/Reachability (~> 7.8) - GoogleUtilities/Reachability (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0) - nanopb (< 2.30911.0, >= 2.30908.0)
- FirebaseRemoteConfigInterop (10.29.0)
- FirebaseSessions (10.29.0):
- FirebaseCore (~> 10.5)
- FirebaseCoreExtension (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.13)
- GoogleUtilities/UserDefaults (~> 7.13)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesSwift (~> 2.1)
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_inappwebview_ios (0.0.1): - flutter_inappwebview_ios (0.0.1):
- Flutter - Flutter
@ -174,6 +202,8 @@ PODS:
- permission_handler_apple (9.3.0): - permission_handler_apple (9.3.0):
- Flutter - Flutter
- PromisesObjC (2.4.0) - PromisesObjC (2.4.0)
- PromisesSwift (2.4.0):
- PromisesObjC (= 2.4.0)
- SDWebImage (5.19.2): - SDWebImage (5.19.2):
- SDWebImage/Core (= 5.19.2) - SDWebImage/Core (= 5.19.2)
- SDWebImage/Core (5.19.2) - SDWebImage/Core (5.19.2)
@ -199,6 +229,7 @@ DEPENDENCIES:
- file_picker (from `.symlinks/plugins/file_picker/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`) - flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`)
@ -222,15 +253,20 @@ SPEC REPOS:
- Firebase - Firebase
- FirebaseAnalytics - FirebaseAnalytics
- FirebaseCore - FirebaseCore
- FirebaseCoreExtension
- FirebaseCoreInternal - FirebaseCoreInternal
- FirebaseCrashlytics
- FirebaseInstallations - FirebaseInstallations
- FirebaseMessaging - FirebaseMessaging
- FirebaseRemoteConfigInterop
- FirebaseSessions
- GoogleAppMeasurement - GoogleAppMeasurement
- GoogleDataTransport - GoogleDataTransport
- GoogleUtilities - GoogleUtilities
- nanopb - nanopb
- OrderedSet - OrderedSet
- PromisesObjC - PromisesObjC
- PromisesSwift
- SDWebImage - SDWebImage
- SwiftyGif - SwiftyGif
@ -243,6 +279,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_analytics/ios" :path: ".symlinks/plugins/firebase_analytics/ios"
firebase_core: firebase_core:
:path: ".symlinks/plugins/firebase_core/ios" :path: ".symlinks/plugins/firebase_core/ios"
firebase_crashlytics:
:path: ".symlinks/plugins/firebase_crashlytics/ios"
firebase_messaging: firebase_messaging:
:path: ".symlinks/plugins/firebase_messaging/ios" :path: ".symlinks/plugins/firebase_messaging/ios"
Flutter: Flutter:
@ -282,12 +320,17 @@ SPEC CHECKSUMS:
Firebase: 26b040b20866a55f55eb3611b9fcf3ae64816b86 Firebase: 26b040b20866a55f55eb3611b9fcf3ae64816b86
firebase_analytics: 0627e95b73eb9e04f59167687ed5bc3f6fb50f23 firebase_analytics: 0627e95b73eb9e04f59167687ed5bc3f6fb50f23
firebase_core: 483cfad66d24d8f3c233f31db4263830c625c909 firebase_core: 483cfad66d24d8f3c233f31db4263830c625c909
firebase_crashlytics: 8f04c663c8734f97c4ccbe81b8511ce7060e3b28
firebase_messaging: e60c0694699d8a2e56a319e043709583f6544123 firebase_messaging: e60c0694699d8a2e56a319e043709583f6544123
FirebaseAnalytics: f9211b719db260cc91aebee8bb539cb367d0dfd1 FirebaseAnalytics: f9211b719db260cc91aebee8bb539cb367d0dfd1
FirebaseCore: a2b95ae4ce7c83ceecfbbbe3b6f1cddc7415a808 FirebaseCore: a2b95ae4ce7c83ceecfbbbe3b6f1cddc7415a808
FirebaseCoreExtension: 705ca5b14bf71d2564a0ddc677df1fc86ffa600f
FirebaseCoreInternal: 58d07f1362fddeb0feb6a857d1d1d1c5e558e698 FirebaseCoreInternal: 58d07f1362fddeb0feb6a857d1d1d1c5e558e698
FirebaseCrashlytics: 81ea6ec96519388687f6061beb838a8eec482293
FirebaseInstallations: 60c1d3bc1beef809fd1ad1189a8057a040c59f2e FirebaseInstallations: 60c1d3bc1beef809fd1ad1189a8057a040c59f2e
FirebaseMessaging: 585984d0a1df120617eb10b44cad8968b859815e FirebaseMessaging: 585984d0a1df120617eb10b44cad8968b859815e
FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0 flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086 flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
@ -302,6 +345,7 @@ SPEC CHECKSUMS:
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78

View File

@ -14,6 +14,7 @@ import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/random_data_util.dart'; import 'package:hub/flutter_flow/random_data_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/utils/dialog_util.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
@ -21,6 +22,8 @@ import 'package:qr_flutter/qr_flutter.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../shared/utils/log_util.dart';
Future<void> openTermsOfUse(BuildContext context) async { Future<void> openTermsOfUse(BuildContext context) async {
log('openTermsOfUse'); log('openTermsOfUse');
final Uri url = Uri.parse('https://freaccess.com.br/pp/'); final Uri url = Uri.parse('https://freaccess.com.br/pp/');
@ -108,92 +111,89 @@ Future singInLoginAction(
String? emailAdress, String? emailAdress,
String? password, String? password,
}) async { }) async {
String? devUUID;
ApiCallResponse? loginCall;
await Future.wait([ try {
Future(() async { String? devUUID;
FFAppState().email = emailAdress!; ApiCallResponse? loginCall;
}),
Future(() async {
FFAppState().passwd = password!;
}),
]);
if ((FFAppState().email != '') && (FFAppState().passwd != '')) {
devUUID = await getDevUUID();
FFAppState().devUUID = devUUID!;
loginCall = await PhpGroup.loginCall.call(
email: FFAppState().email,
password: FFAppState().passwd,
uuid: FFAppState().devUUID,
type: FFAppState().device,
description: randomString(
10,
10,
true,
false,
false,
),
);
if (PhpGroup.loginCall.error( await Future.wait([
Future(() async {
FFAppState().email = emailAdress!;
}),
Future(() async {
FFAppState().passwd = password!;
}),
]);
if ((FFAppState().email != '') && (FFAppState().passwd != '')) {
devUUID = await getDevUUID();
FFAppState().devUUID = devUUID!;
loginCall = await PhpGroup.loginCall.call(
email: FFAppState().email,
password: FFAppState().passwd,
uuid: FFAppState().devUUID,
type: FFAppState().device,
description: randomString(
10,
10,
true,
false,
false,
),
);
if (PhpGroup.loginCall.error((loginCall.jsonBody ?? '')) == false) {
FFAppState().userUUID = PhpGroup.loginCall.userUUID(
(loginCall.jsonBody ?? ''), (loginCall.jsonBody ?? ''),
) == )!;
false) {
FFAppState().userUUID = PhpGroup.loginCall.userUUID(
(loginCall.jsonBody ?? ''),
)!;
// FFAppState().token = await FirebaseMessaging.instance.getToken();
FFAppState().createdAt = dateTimeFormat(
'd/M/y H:mm:ss',
getCurrentTimestamp,
locale: FFLocalizations.of(context).languageCode,
);
FFAppState().updatedAt = '00/00/0000 00:00:00';
FFAppState().status = PhpGroup.loginCall.userStatus(
(loginCall.jsonBody ?? ''),
)!;
FFAppState().userDevUUID = PhpGroup.loginCall.userDeviceId(
(loginCall.jsonBody ?? ''),
)!;
FFAppState().name = PhpGroup.loginCall.userName(
(loginCall.jsonBody ?? ''),
)!;
FFAppState().serialNumber = await getSerialNumber() ?? '';
FFAppState().isLogged = true;
await toggleHomePage(context);
return;
} else {
await showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
useSafeArea: true,
context: context,
builder: (context) {
return Padding(
padding: MediaQuery.viewInsetsOf(context),
child: ThrowExceptionWidget(
msg: PhpGroup.loginCall.msg(
(loginCall?.jsonBody ?? ''),
)!,
),
);
},
);
FFAppState().deleteEmail(); FFAppState().createdAt = dateTimeFormat(
FFAppState().email = ''; 'd/M/y H:mm:ss',
getCurrentTimestamp,
locale: FFLocalizations.of(context).languageCode,
);
FFAppState().deletePasswd(); FFAppState().updatedAt = '00/00/0000 00:00:00';
FFAppState().passwd = '';
FFAppState().update(() {}); FFAppState().status = PhpGroup.loginCall.userStatus((loginCall.jsonBody ?? ''))!;
FFAppState().userDevUUID = PhpGroup.loginCall.userDeviceId((loginCall.jsonBody ?? ''))!;
FFAppState().name = PhpGroup.loginCall.userName((loginCall.jsonBody ?? ''))!;
FFAppState().serialNumber = await getSerialNumber() ?? '';
FFAppState().isLogged = true;
await toggleHomePage(context);
} else {
if (PhpGroup.loginCall.msg((loginCall?.jsonBody ?? '')) == null) {
DialogUtil.errorDefault(context);
} else {
DialogUtil.error(context, PhpGroup.loginCall.msg((loginCall?.jsonBody ?? '')).toString());
}
FFAppState().deleteEmail();
FFAppState().email = '';
FFAppState().deletePasswd();
FFAppState().passwd = '';
FFAppState().update(() {});
}
} }
return; return;
} else {
return; } catch (e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed('login.php', emailAdress.toString(), "Login", e, s);
} }
} }
Future<bool> signUpRegisterAction( Future<bool> signUpRegisterAction(

View File

@ -1,3 +1,5 @@
import 'package:hub/shared/enums/enum_throw_exception.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';
@ -7,15 +9,16 @@ import 'package:google_fonts/google_fonts.dart';
import 'throw_exception_model.dart'; import 'throw_exception_model.dart';
export 'throw_exception_model.dart'; export 'throw_exception_model.dart';
///
class ThrowExceptionWidget extends StatefulWidget { class ThrowExceptionWidget extends StatefulWidget {
const ThrowExceptionWidget({
ThrowExceptionWidget({
super.key, super.key,
required this.msg, required this.msg,
this.type = EnumThrowException.error
}); });
final String? msg; final String? msg;
EnumThrowException type;
@override @override
State<ThrowExceptionWidget> createState() => _ThrowExceptionWidgetState(); State<ThrowExceptionWidget> createState() => _ThrowExceptionWidgetState();
@ -61,6 +64,39 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
super.dispose(); super.dispose();
} }
Color _getColorByType(BuildContext context) {
switch (widget.type) {
case EnumThrowException.error:
return FlutterFlowTheme.of(context).error;
case EnumThrowException.warning:
return FlutterFlowTheme.of(context).warning;
case EnumThrowException.success:
return FlutterFlowTheme.of(context).success;
}
}
IconData _getIconByType(BuildContext context) {
switch (widget.type) {
case EnumThrowException.error:
return Icons.cancel_outlined;
case EnumThrowException.warning:
return Icons.warning_amber_outlined;
case EnumThrowException.success:
return Icons.check_circle_outline;
}
}
String _getTitleByType(BuildContext context) {
switch (widget.type) {
case EnumThrowException.error:
return FFLocalizations.of(context).getVariableText(ptText: "Falha :(", enText: "Fail :(");
case EnumThrowException.warning:
return FFLocalizations.of(context).getVariableText(ptText: "Aviso :O", enText: "Warning :O");
case EnumThrowException.success:
return FFLocalizations.of(context).getVariableText(ptText: "Sucesso ;)", enText: "Success ;)");;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
@ -77,85 +113,62 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
onTap: () async { onTap: () async {
Navigator.pop(context); Navigator.pop(context);
}, },
child: Container( child: Column(
height: 400.0, mainAxisSize: MainAxisSize.max,
decoration: BoxDecoration( mainAxisAlignment: MainAxisAlignment.center,
color: FlutterFlowTheme.of(context).primaryBackground, children: [
borderRadius: const BorderRadius.only( Stack(
bottomLeft: Radius.circular(10.0), children: [
bottomRight: Radius.circular(10.0), Align(
topLeft: Radius.circular(10.0), alignment: const AlignmentDirectional(0.0, 0.0),
topRight: Radius.circular(10.0), child: Icon(
), _getIconByType(context),
), color: _getColorByType(context),
child: Column( size: 150.0,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Stack(
children: [
Align(
alignment: const AlignmentDirectional(0.0, 0.0),
child: Icon(
Icons.circle_outlined,
color: FlutterFlowTheme.of(context).error,
size: 200.0,
),
), ),
Align( ),
alignment: const AlignmentDirectional(0.0, 0.0), ],
child: Icon( ).animateOnPageLoad(
Icons.close_outlined, animationsMap['stackOnPageLoadAnimation']!),
color: FlutterFlowTheme.of(context).error, Column(
size: 200.0, 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
).animateOnPageLoad( .override(
animationsMap['stackOnPageLoadAnimation']!), fontFamily: FlutterFlowTheme.of(context)
Column( .bodyMediumFamily,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
FFLocalizations.of(context).getText(
'e58xxxiq' /* ERRO */,
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
fontSize: 20.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context) FlutterFlowTheme.of(context)
.bodyMediumFamily), .bodyMediumFamily),
), ),
), ),
Padding( ),
padding: ].addToStart(const SizedBox(height: 20.0)),
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: 50.0)),
),
],
),
), ),
), ),
), ),

View File

@ -1,3 +1,5 @@
import 'package:hub/shared/utils/validator_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 'forgot_password_template_component_widget.dart' import 'forgot_password_template_component_widget.dart'
@ -21,7 +23,7 @@ class ForgotPasswordTemplateComponentModel
); );
} }
if (!RegExp(kTextValidatorEmailRegex).hasMatch(val)) { if (!ValidatorUtil.isValidEmail(val)) {
return FFLocalizations.of(context).getText( return FFLocalizations.of(context).getText(
'jh5r2b1w' /* E-mail Inválido */, 'jh5r2b1w' /* E-mail Inválido */,
); );

View File

@ -1,4 +1,9 @@
import 'dart:developer';
import 'package:hub/flutter_flow/nav/nav.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/validator_util.dart';
import '/backend/api_requests/api_calls.dart'; import '/backend/api_requests/api_calls.dart';
import '/components/molecular_components/throw_exception/throw_exception_widget.dart'; import '/components/molecular_components/throw_exception/throw_exception_widget.dart';
@ -187,28 +192,28 @@ class _ForgotPasswordTemplateComponentWidgetState
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: const BorderSide( borderSide: const BorderSide(
color: Colors.black, color: Colors.black,
width: 0.25, width: 2.00,
), ),
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primary, color: FlutterFlowTheme.of(context).primary,
width: 0.25, width: 2.00,
), ),
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
), ),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error, color: FlutterFlowTheme.of(context).error,
width: 0.25, width: 2.00,
), ),
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
), ),
focusedErrorBorder: OutlineInputBorder( focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error, color: FlutterFlowTheme.of(context).error,
width: 0.25, width: 2.00,
), ),
borderRadius: BorderRadius.circular(12.0), borderRadius: BorderRadius.circular(12.0),
), ),
@ -216,7 +221,7 @@ class _ForgotPasswordTemplateComponentWidgetState
24.0, 24.0, 20.0, 24.0), 24.0, 24.0, 20.0, 24.0),
suffixIcon: Icon( suffixIcon: Icon(
Icons.email, Icons.email,
color: FlutterFlowTheme.of(context).accent1, color: FlutterFlowTheme.of(context).primary,
size: 22.0, size: 22.0,
), ),
), ),
@ -243,38 +248,31 @@ class _ForgotPasswordTemplateComponentWidgetState
child: Padding( child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: (_model.emailAddressTextController.text == '') onPressed: (_model.emailAddressTextController.text == '' || !ValidatorUtil.isValidEmail(_model.emailAddressTextController.text))
? null ? null
: () async { : () async {
_model.req = await PhpGroup.forgotPasswordCall.call(
email: _model.emailAddressTextController.text,
);
if (PhpGroup.forgotPasswordCall.error( try {
(_model.req?.jsonBody ?? ''), _model.req = await PhpGroup.forgotPasswordCall.call(
) == email: _model.emailAddressTextController.text,
false) { );
Navigator.pop(context);
} else { if (PhpGroup.forgotPasswordCall.error((_model.req?.jsonBody ?? '')) == false) {
await showModalBottomSheet( await DialogUtil.success(context, FFLocalizations.of(context).getVariableText(
isScrollControlled: true, enText: "Send E-mail Successful!",
backgroundColor: Colors.transparent, ptText: "E-mail Enviado com Sucesso!"
enableDrag: false, ));
context: context, Navigator.pop(context);
builder: (context) { } else {
return Padding( await DialogUtil.error(context, PhpGroup.forgotPasswordCall.msg((_model.req?.jsonBody ?? ''))!);
padding: MediaQuery.viewInsetsOf(context), }
child: ThrowExceptionWidget(
msg: PhpGroup.forgotPasswordCall.msg( setState(() {});
(_model.req?.jsonBody ?? ''),
)!, } catch (error, stack) {
), LogUtil.requestAPIFailed("iforgot.php", _model.emailAddressTextController.text, "Recuperar Senha", error, stack);
); await DialogUtil.errorDefault(context);
},
).then((value) => safeSetState(() {}));
} }
setState(() {});
}, },
text: FFLocalizations.of(context).getText( text: FFLocalizations.of(context).getText(
'74rnd5bu' /* Enviar */, '74rnd5bu' /* Enviar */,
@ -285,7 +283,7 @@ class _ForgotPasswordTemplateComponentWidgetState
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
iconPadding: iconPadding:
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
color: const Color(0xFF1AAB5F), color: FlutterFlowTheme.of(context).primary,
textStyle: FlutterFlowTheme.of(context).titleSmall.override( textStyle: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Plus Jakarta Sans', fontFamily: 'Plus Jakarta Sans',
color: Colors.white, color: Colors.white,
@ -300,8 +298,14 @@ class _ForgotPasswordTemplateComponentWidgetState
color: Colors.transparent, color: Colors.transparent,
width: 1.0, width: 1.0,
), ),
disabledColor:
FlutterFlowTheme.of(
context)
.customColor5,
disabledTextColor:
Colors.white,
), ),
showLoadingIndicator: false, showLoadingIndicator: true,
), ),
), ),
), ),

View File

@ -1,6 +1,8 @@
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/utils/ValidatorUtil.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 '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart'; import '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart';
import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_animations.dart';
@ -695,34 +697,25 @@ 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: (((_model.emailAddressTextController onPressed: _isFormInvalid()
.text ==
'') ||
((_model.emailAddressFocusNode
?.hasFocus ??
false) !=
null)) &&
((_model.emailAddressTextController
.text ==
'') ||
((_model.passwordTextController.text ==
'') ||
((_model.passwordFocusNode?.hasFocus ??
false) !=
null))))
? null ? null
: () async { : () async {
await action_blocks try {
.singInLoginAction( await action_blocks
context, .singInLoginAction(
emailAdress: _model context,
.emailAddressTextController emailAdress: _model
.text, .emailAddressTextController
password: _model .text,
.passwordTextController password: _model
.text, .passwordTextController
); .text,
setState(() {}); );
setState(() {});
} catch (e, s) {
await DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed('login.php', _model.emailAddressTextController.text, "Login", e, s);
}
}, },
text: FFLocalizations.of( text: FFLocalizations.of(
context) context)
@ -784,8 +777,7 @@ class _SignInTemplateComponentWidgetState
disabledColor: disabledColor:
const Color(0xE81AAB5F), const Color(0xE81AAB5F),
), ),
showLoadingIndicator: showLoadingIndicator: true,
false,
), ),
), ),
), ),
@ -880,18 +872,13 @@ class _SignInTemplateComponentWidgetState
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
onTap: () async { onTap: () async {
await showModalBottomSheet( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: backgroundColor: Colors.transparent,
Colors.transparent,
enableDrag: false,
context: context, context: context,
builder: (context) { builder: (context) {
return Padding( return Padding(
padding: padding: MediaQuery.viewInsetsOf(context),
MediaQuery.viewInsetsOf(
context),
child: const ForgotPasswordTemplateComponentWidget(), child: const ForgotPasswordTemplateComponentWidget(),
); );
}, },
@ -941,29 +928,23 @@ class _SignInTemplateComponentWidgetState
), ),
mouseCursor: mouseCursor:
SystemMouseCursors.click, SystemMouseCursors.click,
recognizer: // recognizer: TapGestureRecognizer()
TapGestureRecognizer() // ..onTap = () async {
..onTap = () async { // await showModalBottomSheet(
await showModalBottomSheet( // isScrollControlled: true,
isScrollControlled: // backgroundColor: Colors.transparent,
true, // context: context,
backgroundColor: // useRootNavigator: true,
Colors // builder: (context) {
.transparent, // return Padding(
context: context, // padding: MediaQuery.viewInsetsOf(context),
builder: (context) { // child: const ForgotPasswordTemplateComponentWidget(),
return Padding( // );
padding: MediaQuery // },
.viewInsetsOf( // ).then((value) =>
context), // safeSetState(
child: // () {}));
const ForgotPasswordTemplateComponentWidget(), // },
);
},
).then((value) =>
safeSetState(
() {}));
},
) )
], ],
style: style:

View File

@ -569,8 +569,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
// throwException // throwException
{ {
'e58xxxiq': { 'e58xxxiq': {
'pt': 'ERRO', 'pt': 'Falha :(',
'en': 'ERROR', 'en': 'Fail :(',
}, },
}, },
// regisiterVistorTemplateComponent // regisiterVistorTemplateComponent
@ -1041,11 +1041,11 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
}, },
'3hqg8buh': { '3hqg8buh': {
'pt': 'E-mail é Obrigatório', 'pt': 'E-mail é Obrigatório',
'en': '', 'en': 'E-mail is Required',
}, },
'jh5r2b1w': { 'jh5r2b1w': {
'pt': 'E-mail Inválido', 'pt': 'E-mail Inválido',
'en': '', 'en': 'Invalid E-mail',
}, },
'1p76vmkn': { '1p76vmkn': {
'pt': 'Please choose an option from the dropdown', 'pt': 'Please choose an option from the dropdown',

View File

@ -1,5 +1,6 @@
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:hub/app_state.dart'; import 'package:hub/app_state.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/internationalization.dart';
@ -29,6 +30,8 @@ void main() async {
Future<void> initializeApp() async { Future<void> initializeApp() async {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
await FlutterFlowTheme.initialize(); await FlutterFlowTheme.initialize();
await FFLocalizations.initialize(); await FFLocalizations.initialize();
final appState = FFAppState(); final appState = FFAppState();
@ -57,6 +60,9 @@ class _MyAppState extends State<MyApp> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
_appStateNotifier = AppStateNotifier.instance; _appStateNotifier = AppStateNotifier.instance;
_router = createRouter(_appStateNotifier); _router = createRouter(_appStateNotifier);
Future.delayed(const Duration(milliseconds: 1000), Future.delayed(const Duration(milliseconds: 1000),

View File

@ -1773,7 +1773,7 @@ Widget scheduleVisit(
: FocusScope.of(context).unfocus(), : FocusScope.of(context).unfocus(),
child: Padding( child: Padding(
padding: MediaQuery.viewInsetsOf(context), padding: MediaQuery.viewInsetsOf(context),
child: const ThrowExceptionWidget( child: ThrowExceptionWidget(
msg: 'Campos obrigatórios imcompletos.', msg: 'Campos obrigatórios imcompletos.',
), ),
), ),

View File

@ -0,0 +1,5 @@
enum EnumThrowException {
success,
error,
warning
}

View File

@ -0,0 +1,59 @@
import 'package:flutter/material.dart';
import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/shared/enums/enum_throw_exception.dart';
class DialogUtil {
static const double _height = 350;
static Future<dynamic> errorDefault(BuildContext context) {
return error(context, FFLocalizations.of(context).getVariableText(
ptText: "Falha ao efetuar operação, Tente Novamente mais tarde.",
enText: "Failed to perform operation, please try again later."
));
}
static Future<dynamic> error(BuildContext context, String message) async {
return await showDialog(
context: context,
builder: (context) {
return Dialog(
child: SizedBox(
height: _height,
child: Padding(padding: MediaQuery.viewInsetsOf(context), child: ThrowExceptionWidget(msg: message, type: EnumThrowException.error))
)
);
}
);
}
static Future<dynamic> warning(BuildContext context, String message) async {
return await showDialog(
context: context,
builder: (context) {
return Dialog(
child: SizedBox(
height: _height,
child: Padding(padding: MediaQuery.viewInsetsOf(context), child: ThrowExceptionWidget(msg: message, type: EnumThrowException.warning))
)
);
}
);
}
static Future<dynamic> success(BuildContext context, String message) async {
return await showDialog(
context: context,
builder: (context) {
return Dialog(
child: SizedBox(
height: _height,
child: Padding(padding: MediaQuery.viewInsetsOf(context), child: ThrowExceptionWidget(msg: message, type: EnumThrowException.success))
)
);
}
);
}
}

View File

@ -0,0 +1,15 @@
import 'dart:developer';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
class LogUtil {
static void requestAPIFailed(String url, String body, String reason, dynamic error, StackTrace stack) async {
FirebaseCrashlytics.instance.setCustomKey('URL', "${PhpGroup.getBaseUrl()}/$url");
FirebaseCrashlytics.instance.setCustomKey('Body', body);
await FirebaseCrashlytics.instance.recordError(error, stack, reason: reason);
}
}

View File

@ -345,6 +345,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.17.2" version: "2.17.2"
firebase_crashlytics:
dependency: "direct main"
description:
name: firebase_crashlytics
sha256: ad7510d9bcf1f40fc895944942f553a4c5603acb4715c0d6386dd587f82f6ae5
url: "https://pub.dev"
source: hosted
version: "4.0.1"
firebase_crashlytics_platform_interface:
dependency: transitive
description:
name: firebase_crashlytics_platform_interface
sha256: "318589f1da3bb858872002fa20170234566f0fb080669a8256c85a81513a802a"
url: "https://pub.dev"
source: hosted
version: "3.6.37"
firebase_messaging: firebase_messaging:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -107,6 +107,7 @@ dependencies:
flutter_riverpod: ^2.5.1 flutter_riverpod: ^2.5.1
qr_flutter: ^4.1.0 qr_flutter: ^4.1.0
permission_handler: ^11.3.1 permission_handler: ^11.3.1
firebase_crashlytics: ^4.0.1
dependency_overrides: dependency_overrides:
http: 1.2.1 http: 1.2.1