fix: Login Logic and misc

This commit is contained in:
Ivan Antunes 2024-07-29 12:07:28 -03:00
parent dc9bc215b9
commit 6ed94fb1b5
5 changed files with 314 additions and 286 deletions

View File

@ -311,6 +311,6 @@ SPEC CHECKSUMS:
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36 webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36
PODFILE CHECKSUM: f2b7abe080b8e8f49e642b85431f5117d22149fe PODFILE CHECKSUM: d7f4d1b71f8c708247c1078c4aec33a28c763405
COCOAPODS: 1.15.2 COCOAPODS: 1.15.2

View File

@ -49,186 +49,140 @@ class _ForgotPasswordTemplateComponentWidgetState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Align( return GestureDetector(
alignment: const AlignmentDirectional(0.0, 1.0), onTap: () {
child: Container( Navigator.pop(context);
width: double.infinity, },
height: 300.0, child: Align(
constraints: const BoxConstraints( alignment: const AlignmentDirectional(0.0, 1.0),
maxWidth: 570.0, child: Container(
), width: double.infinity,
decoration: BoxDecoration( height: 300.0,
color: FlutterFlowTheme.of(context).primaryBackground, constraints: const BoxConstraints(
borderRadius: const BorderRadius.only( maxWidth: 570.0,
bottomLeft: Radius.circular(0.0),
bottomRight: Radius.circular(0.0),
topLeft: Radius.circular(15.0),
topRight: Radius.circular(15.0),
), ),
), decoration: BoxDecoration(
child: Column( color: FlutterFlowTheme.of(context).primaryBackground,
mainAxisSize: MainAxisSize.max, borderRadius: const BorderRadius.only(
mainAxisAlignment: MainAxisAlignment.center, bottomLeft: Radius.circular(0.0),
crossAxisAlignment: CrossAxisAlignment.start, bottomRight: Radius.circular(0.0),
children: [ topLeft: Radius.circular(15.0),
// This row exists for when the "app bar" is hidden on desktop, having a way back for the user can work well. topRight: Radius.circular(15.0),
if (responsiveVisibility( ),
context: context, ),
phone: false, child: Column(
tablet: false, mainAxisSize: MainAxisSize.max,
)) mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// This row exists for when the "app bar" is hidden on desktop, having a way back for the user can work well.
if (responsiveVisibility(
context: context,
phone: false,
tablet: false,
))
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0),
child: InkWell(
splashColor: Colors.transparent,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () async {
context.safePop();
},
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
const Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.0, 12.0, 0.0, 12.0),
child: Icon(
Icons.arrow_back_rounded,
color: Color(0xFF15161E),
size: 24.0,
),
),
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0),
child: Text(
'',
style:
FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: const Color(0xFF15161E),
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
),
),
],
),
),
),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0), padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0),
child: InkWell( child: Text(
splashColor: Colors.transparent, FFLocalizations.of(context).getText(
focusColor: Colors.transparent, 'xxm3ajsy' /* ESQUECEU SUA SENHA? */,
hoverColor: Colors.transparent, ),
highlightColor: Colors.transparent, style: FlutterFlowTheme.of(context).headlineMedium.override(
onTap: () async { fontFamily: 'Outfit',
context.safePop(); color: FlutterFlowTheme.of(context).primaryText,
}, fontSize: 24.0,
child: Row( letterSpacing: 0.0,
mainAxisSize: MainAxisSize.max, fontWeight: FontWeight.w500,
children: [ useGoogleFonts: GoogleFonts.asMap().containsKey('Outfit'),
const Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.0, 12.0, 0.0, 12.0),
child: Icon(
Icons.arrow_back_rounded,
color: Color(0xFF15161E),
size: 24.0,
),
),
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0),
child: Text(
'',
style:
FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: const Color(0xFF15161E),
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
),
),
],
), ),
), ),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), padding: const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0),
child: Text( child: Text(
FFLocalizations.of(context).getText( FFLocalizations.of(context).getText(
'xxm3ajsy' /* ESQUECEU SUA SENHA? */, 'wu2f7yzo' /* Não se preucupe nós vamos te a... */,
),
style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts:
GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
),
), ),
style: FlutterFlowTheme.of(context).headlineMedium.override(
fontFamily: 'Outfit',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 24.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Outfit'),
),
), ),
), Padding(
Padding( padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0),
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0), child: SizedBox(
child: Text( width: double.infinity,
FFLocalizations.of(context).getText( child: TextFormField(
'wu2f7yzo' /* Não se preucupe nós vamos te a... */, controller: _model.emailAddressTextController,
), focusNode: _model.emailAddressFocusNode,
style: FlutterFlowTheme.of(context).labelMedium.override( autofillHints: const [AutofillHints.email],
fontFamily: 'Plus Jakarta Sans', obscureText: false,
color: FlutterFlowTheme.of(context).primaryText, decoration: InputDecoration(
fontSize: 14.0, isDense: true,
letterSpacing: 0.0, labelText: FFLocalizations.of(context).getText(
fontWeight: FontWeight.w500, 'mtz8l7ft' /* Email */,
useGoogleFonts: ),
GoogleFonts.asMap().containsKey('Plus Jakarta Sans'), labelStyle:
), FlutterFlowTheme.of(context).labelMedium.override(
), fontFamily: 'Plus Jakarta Sans',
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0),
child: SizedBox(
width: double.infinity,
child: TextFormField(
controller: _model.emailAddressTextController,
focusNode: _model.emailAddressFocusNode,
autofillHints: const [AutofillHints.email],
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText(
'mtz8l7ft' /* Email */,
),
labelStyle:
FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).accent1,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
hintText: FFLocalizations.of(context).getText(
'w7y5wlnv' /* digite o seu email..... */,
),
hintStyle:
FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).accent1, color: FlutterFlowTheme.of(context).accent1,
width: 2.0, fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
), ),
borderRadius: BorderRadius.circular(12.0), hintStyle:
), FlutterFlowTheme.of(context).labelMedium.override(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).accent3,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
filled: true,
fillColor: FlutterFlowTheme.of(context).primaryBackground,
contentPadding:
const EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 20.0, 24.0),
suffixIcon: Icon(
Icons.email,
color: FlutterFlowTheme.of(context).accent1,
size: 22.0,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Plus Jakarta Sans', fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0, fontSize: 14.0,
@ -237,80 +191,128 @@ class _ForgotPasswordTemplateComponentWidgetState
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'), .containsKey('Plus Jakarta Sans'),
), ),
maxLines: null, enabledBorder: OutlineInputBorder(
keyboardType: TextInputType.emailAddress, borderSide: BorderSide(
cursorColor: const Color(0xFF6F61EF), color: FlutterFlowTheme.of(context).accent1,
validator: _model.emailAddressTextControllerValidator width: 2.0,
.asValidator(context),
),
),
),
Align(
alignment: const AlignmentDirectional(0.0, 0.0),
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0),
child: FFButtonWidget(
onPressed: () async {
_model.req = await PhpGroup.forgotPasswordCall.call(
email: _model.emailAddressTextController.text,
);
if (PhpGroup.forgotPasswordCall.error(
(_model.req?.jsonBody ?? ''),
) ==
false) {
Navigator.pop(context);
} else {
await showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
enableDrag: false,
context: context,
builder: (context) {
return Padding(
padding: MediaQuery.viewInsetsOf(context),
child: ThrowExceptionWidget(
msg: PhpGroup.forgotPasswordCall.msg(
(_model.req?.jsonBody ?? ''),
)!,
),
);
},
).then((value) => safeSetState(() {}));
}
setState(() {});
},
text: FFLocalizations.of(context).getText(
'74rnd5bu' /* Enviar */,
),
options: FFButtonOptions(
width: 270.0,
height: 50.0,
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
iconPadding:
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
color: const Color(0xFF1AAB5F),
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Plus Jakarta Sans',
color: Colors.white,
fontSize: 16.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
), ),
elevation: 3.0, borderRadius: BorderRadius.circular(12.0),
borderSide: const BorderSide( ),
color: Colors.transparent, focusedBorder: OutlineInputBorder(
width: 1.0, borderSide: BorderSide(
color: FlutterFlowTheme.of(context).accent3,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
filled: true,
fillColor: FlutterFlowTheme.of(context).primaryBackground,
contentPadding:
const EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 20.0, 24.0),
suffixIcon: Icon(
Icons.email,
color: FlutterFlowTheme.of(context).accent1,
size: 22.0,
),
), ),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
maxLines: null,
keyboardType: TextInputType.emailAddress,
cursorColor: const Color(0xFF6F61EF),
validator: _model.emailAddressTextControllerValidator
.asValidator(context),
), ),
showLoadingIndicator: false,
), ),
), ),
), Align(
], alignment: const AlignmentDirectional(0.0, 0.0),
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0),
child: FFButtonWidget(
onPressed: () async {
_model.req = await PhpGroup.forgotPasswordCall.call(
email: _model.emailAddressTextController.text,
);
if (PhpGroup.forgotPasswordCall.error(
(_model.req?.jsonBody ?? ''),
) ==
false) {
Navigator.pop(context);
} else {
await showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
enableDrag: false,
context: context,
builder: (context) {
return Padding(
padding: MediaQuery.viewInsetsOf(context),
child: ThrowExceptionWidget(
msg: PhpGroup.forgotPasswordCall.msg(
(_model.req?.jsonBody ?? ''),
)!,
),
);
},
).then((value) => safeSetState(() {}));
}
setState(() {});
},
text: FFLocalizations.of(context).getText(
'74rnd5bu' /* Enviar */,
),
options: FFButtonOptions(
width: 270.0,
height: 50.0,
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
iconPadding:
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
color: const Color(0xFF1AAB5F),
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Plus Jakarta Sans',
color: Colors.white,
fontSize: 16.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
elevation: 3.0,
borderSide: const BorderSide(
color: Colors.transparent,
width: 1.0,
),
),
showLoadingIndicator: false,
),
),
),
],
),
), ),
), ),
); );

View File

@ -1,3 +1,5 @@
import 'package:hub/shared/components/atoms/atom_terms_of_use.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';
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';
@ -93,6 +95,18 @@ class _SignInTemplateComponentWidgetState
super.dispose(); super.dispose();
} }
bool _isFormInvalid() {
if (_model.emailAddressTextController.text == '' || _model.passwordTextController.text == '') {
return true;
}
if (!RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(_model.emailAddressTextController.text)) {
return true;
}
return false;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
@ -205,7 +219,7 @@ class _SignInTemplateComponentWidgetState
Form( Form(
key: _model.formKey, key: _model.formKey,
autovalidateMode: autovalidateMode:
AutovalidateMode.always, AutovalidateMode.onUserInteraction,
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
@ -518,12 +532,7 @@ class _SignInTemplateComponentWidgetState
.fromSTEB( .fromSTEB(
0.0, 0.0, 0.0, 16.0), 0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: ((_model.emailAddressTextController onPressed: _isFormInvalid()
.text ==
'') &&
(_model.passwordTextController
.text ==
''))
? null ? null
: () async { : () async {
await action_blocks await action_blocks
@ -874,6 +883,7 @@ 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:
@ -885,12 +895,10 @@ class _SignInTemplateComponentWidgetState
padding: padding:
MediaQuery.viewInsetsOf( MediaQuery.viewInsetsOf(
context), context),
child: child: const ForgotPasswordTemplateComponentWidget(),
const ForgotPasswordTemplateComponentWidget(),
); );
}, },
).then( ).then((value) => safeSetState(() {}));
(value) => safeSetState(() {}));
}, },
child: RichText( child: RichText(
textScaler: MediaQuery.of(context) textScaler: MediaQuery.of(context)
@ -981,29 +989,7 @@ class _SignInTemplateComponentWidgetState
), ),
), ),
), ),
Text( const AtomTermsOfUse(),
FFLocalizations.of(context).getText(
'olf967cj' /* Termo de Uso */,
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(context)
.bodyMediumFamily,
color:
FlutterFlowTheme.of(context)
.primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
], ],
), ),
), ),

View File

@ -873,28 +873,28 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
'en': 'LET\'S GO! SIGN IN WITH YOUR ACCOUNT', 'en': 'LET\'S GO! SIGN IN WITH YOUR ACCOUNT',
}, },
'1ltg0ylb': { '1ltg0ylb': {
'pt': 'Email', 'pt': 'E-mail',
'en': 'Email', 'en': 'E-mail',
}, },
'2x19ce8k': { '2x19ce8k': {
'pt': 'Senha', 'pt': 'Senha',
'en': 'Password', 'en': 'Password',
}, },
'xhnawzcb': { 'xhnawzcb': {
'pt': 'Campo é necessário', 'pt': 'E-mail é Obrigatório',
'en': 'Field is required', 'en': 'E-mail is required',
}, },
's3j1hjqx': { 's3j1hjqx': {
'pt': 'E-mail Inv', 'pt': 'E-mail Inválido',
'en': '', 'en': 'Invalid E-mail',
}, },
'2ib9bf67': { '2ib9bf67': {
'pt': 'Please choose an option from the dropdown', 'pt': 'Please choose an option from the dropdown',
'en': '', 'en': '',
}, },
'9cs5wlmc': { '9cs5wlmc': {
'pt': 'Campo é necessário', 'pt': 'Senha é Obrigatório',
'en': 'Field is required', 'en': 'Password is required',
}, },
'rkxwb0sg': { 'rkxwb0sg': {
'pt': 'Please choose an option from the dropdown', 'pt': 'Please choose an option from the dropdown',
@ -922,7 +922,7 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
}, },
'p5c6d54y': { 'p5c6d54y': {
'pt': ' Recupere aqui', 'pt': ' Recupere aqui',
'en': ' recover here', 'en': ' Recover here',
}, },
'olf967cj': { 'olf967cj': {
'pt': 'Termo de Uso', 'pt': 'Termo de Uso',
@ -1032,8 +1032,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
'Don\'t worry, we will help you, enter the email registered in the application and click send.', 'Don\'t worry, we will help you, enter the email registered in the application and click send.',
}, },
'mtz8l7ft': { 'mtz8l7ft': {
'pt': 'Email', 'pt': 'E-mail',
'en': 'Email', 'en': 'E-mail',
}, },
'w7y5wlnv': { 'w7y5wlnv': {
'pt': 'digite o seu email.....', 'pt': 'digite o seu email.....',

View File

@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../../flutter_flow/flutter_flow_theme.dart';
import '../../../flutter_flow/flutter_flow_util.dart';
class AtomTermsOfUse extends StatelessWidget {
const AtomTermsOfUse({super.key});
@override
Widget build(BuildContext context) {
return InkWell(
child: Text(
FFLocalizations.of(context).getText(
'olf967cj' /* Termo de Uso */,
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(context)
.bodyMediumFamily,
color:
FlutterFlowTheme.of(context)
.primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
onTap: () => launchURL('https://freaccess.com.br/pp'),
);
}
}