This commit is contained in:
J. A. Messias 2024-10-10 08:37:53 -03:00
parent 2028ab996d
commit 939a6291e6
2 changed files with 124 additions and 127 deletions

View File

@ -186,40 +186,41 @@ class _AppState extends State<App> {
Future<void> initDeepLinks() async { Future<void> initDeepLinks() async {
_appLinks = AppLinks(); _appLinks = AppLinks();
_linkSubscription = _appLinks.uriLinkStream.listen((uri) { _linkSubscription = _appLinks.uriLinkStream.listen((uri) {
final bool isRecovered = !StorageUtil().isRecovered; final bool isRecovered = StorageUtil().isRecovered;
if (isRecovered) openAppLink(uri); if (!isRecovered) openAppLink(uri);
}); });
} }
void openAppLink(Uri uri) { void openAppLink(Uri uri) {
final bool isRecovered = StorageUtil().isRecovered; final bool isRecovered = StorageUtil().isRecovered;
log('isRecovered: $isRecovered');
if (isRecovered) return; if (isRecovered) return;
StorageUtil().isRecovered = true; StorageUtil().isRecovered = true;
final String email = uri.queryParameters['email'] ?? ''; final String email = uri.queryParameters['email'] ?? '';
final String token = uri.queryParameters['token'] ?? ''; final String token = uri.queryParameters['token'] ?? '';
final bool isNotEmpty = email.isNotEmpty && token.isNotEmpty; final bool isNotEmpty = email.isNotEmpty && token.isNotEmpty;
if (isNotEmpty) {
if (isNotEmpty ) {
final BuildContext context = StorageUtil().context!; final BuildContext context = StorageUtil().context!;
final MediaQueryData mediaQuery = MediaQuery.of(context); final MediaQueryData mediaQuery = MediaQuery.of(context);
final double height = mediaQuery.size.height * 0.8; final double height = mediaQuery.size.height * 0.8;
final FlutterFlowTheme theme = FlutterFlowTheme.of(context); final FlutterFlowTheme theme = FlutterFlowTheme.of(context);
final Widget screen = ForgotPasswordScreen(email: email, token: token); final Widget screen = ForgotPasswordScreen(email: email, token: token);
builder(context) => screen; builder(context) => screen;
WidgetsBinding.instance.addPersistentFrameCallback((_) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
builder: (context) => builder: (context) => SizedBox(height: height, child: builder(context)),
SizedBox(height: height, child: builder(context)),
isScrollControlled: true, isScrollControlled: true,
showDragHandle: true, showDragHandle: true,
barrierColor: theme.primaryText.withOpacity(0.2), barrierColor: theme.primaryBackground.withOpacity(0.2),
backgroundColor: theme.primaryBackground, backgroundColor: theme.primaryBackground,
useSafeArea: true, useSafeArea: true,
enableDrag: true, enableDrag: true,
isDismissible: true, isDismissible: true,
).then((_) => StorageUtil().isRecovered = false); ).then((_) => StorageUtil().isRecovered = false);
});
} }
} }
void _setupFirebaseMessaging() async { void _setupFirebaseMessaging() async {

View File

@ -136,132 +136,127 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
enText: 'What will be your new password? Enter it below and confirm.', enText: 'What will be your new password? Enter it below and confirm.',
); );
return SafeArea( return SafeArea(
child: SingleChildScrollView( child: Container(
child: Padding( color: FlutterFlowTheme.of(context).primaryBackground,
padding: const EdgeInsets.only(bottom: 20.0), // Adiciona espaçamento inferior child: SingleChildScrollView(
child: Column( child: Padding(
mainAxisSize: MainAxisSize.max, padding: const EdgeInsets.only(bottom: 20.0), // Adiciona espaçamento inferior
children: [ child: Column(
Container( mainAxisSize: MainAxisSize.max,
width: 291.0, children: [
height: 167.0, Container(
decoration: const BoxDecoration(), width: 291.0,
child: ClipRRect( height: 167.0,
borderRadius: BorderRadius.circular(8.0), decoration: const BoxDecoration(),
child: const AtomImageSvgTheme(filename: 'register', width: 600, height: 155), child: ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: const AtomImageSvgTheme(filename: 'register', width: 600, height: 155),
),
), ),
), Padding(
Padding( padding: const EdgeInsets.all(34.0),
padding: const EdgeInsets.all(34.0), child: Material(
child: Material( child: Container(
child: Container( width: double.infinity,
width: double.infinity, constraints: const BoxConstraints(maxWidth: 570.0),
constraints: const BoxConstraints(maxWidth: 570.0), decoration: BoxDecoration(
decoration: BoxDecoration( color: FlutterFlowTheme.of(context).primaryBackground,
color: FlutterFlowTheme.of(context).primaryBackground, borderRadius: BorderRadius.circular(12.0),
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),
label: FFLocalizations.of(context).getVariableText(ptText: 'Nova Senha', enText: 'New Password'),
hint: FFLocalizations.of(context).getVariableText(ptText: 'Insira sua senha', enText: 'Enter your password'),
),
_buildPasswordField(
context,
controller: _model.passwordConfirmFormTextController,
focusNode: _model.passwordConfirmFormFocusNode,
visibility: _model.passwordConfirmFormVisibility,
onVisibilityToggle: () => setState(() => _model.passwordConfirmFormVisibility = !_model.passwordConfirmFormVisibility),
label: FFLocalizations.of(context).getVariableText(ptText: 'Confirme a Senha', enText: 'Confirm Password'),
hint: FFLocalizations.of(context).getVariableText(ptText: 'Confirme sua senha', enText: 'Confirm your password'),
),
],
),
),
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,
),
),
],
), ),
), child: Padding(
).animateOnPageLoad(animationsMap['containerOnPageLoadAnimation']!), 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),
label: FFLocalizations.of(context).getVariableText(ptText: 'Nova Senha', enText: 'New Password'),
hint: FFLocalizations.of(context).getVariableText(ptText: 'Insira sua senha', enText: 'Enter your password'),
),
_buildPasswordField(
context,
controller: _model.passwordConfirmFormTextController,
focusNode: _model.passwordConfirmFormFocusNode,
visibility: _model.passwordConfirmFormVisibility,
onVisibilityToggle: () => setState(() => _model.passwordConfirmFormVisibility = !_model.passwordConfirmFormVisibility),
label: FFLocalizations.of(context).getVariableText(ptText: 'Confirme a Senha', enText: 'Confirm Password'),
hint: FFLocalizations.of(context).getVariableText(ptText: 'Confirme sua senha', enText: 'Confirm your password'),
),
],
),
),
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, Widget _buildPasswordField(BuildContext context, {required TextEditingController? controller, required FocusNode? focusNode, required bool visibility, required VoidCallback onVisibilityToggle, required String hint, required String label,}) {
{
required TextEditingController? controller,
required FocusNode? focusNode,
required bool visibility,
required VoidCallback onVisibilityToggle,
required String hint,
required String label,
}){
return Padding( return Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0), padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0),
child: SizedBox( child: SizedBox(
@ -331,4 +326,5 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
); );
} }
} }