WIP
This commit is contained in:
parent
d428f9379d
commit
a92a34062c
|
@ -191,20 +191,20 @@ class _AppState extends State<App> {
|
||||||
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.6;
|
||||||
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;
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => SizedBox(height: height, child: builder(context)),
|
builder: (context) => Padding(padding: MediaQuery.viewInsetsOf(context), child: builder(context)),
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
barrierColor: theme.primaryBackground.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);
|
).whenComplete(() => StorageUtil().isRecovered = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,14 @@ class ForgotPasswordScreenModel extends FlutterFlowModel<ForgotPasswordScreen> {
|
||||||
String? Function(BuildContext, String?)? passwordRegisterFormTextControllerValidator;
|
String? Function(BuildContext, String?)? 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).getVariableText(
|
||||||
|
ptText: 'Campo é necessário',
|
||||||
|
enText: 'Field is required',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (val.length < 8) {
|
||||||
return FFLocalizations.of(context).getText(
|
return FFLocalizations.of(context).getText(
|
||||||
'6nn79lmh' /* Campo é necessário */,
|
'duq5gpp6' /* A senha deve ter pelo menos 8 ... */,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -88,11 +88,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
@override Widget build(BuildContext context) => Scaffold(
|
@override Widget build(BuildContext context) => buildBody(context);
|
||||||
appBar: buildAppBar(context),
|
|
||||||
body: buildBody(context),
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
AppBar buildAppBar(BuildContext context) {
|
AppBar buildAppBar(BuildContext context) {
|
||||||
|
@ -130,29 +126,21 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
||||||
elevation: 0.0,
|
elevation: 0.0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
SafeArea buildBody(BuildContext context) {
|
Widget buildBody(BuildContext context) {
|
||||||
|
late final String title = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Recuperar Senha',
|
||||||
|
enText: 'Recover Password',
|
||||||
|
);
|
||||||
late final String message = FFLocalizations.of(context).getVariableText(
|
late final String message = FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Qual será a sua nova senha? Insira abaixo e confirme.',
|
ptText: 'Qual será a sua nova senha? Insira abaixo e confirme.',
|
||||||
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 SizedBox(
|
||||||
|
height: 400,
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 20.0), // Adiciona espaçamento inferior
|
padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 0.0),
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
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: Material(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
|
@ -162,11 +150,19 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(32.0),
|
padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 10.0, bottom: 0.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
Center(child: Text(title, style: FlutterFlowTheme.of(context).title1.override(
|
||||||
|
fontFamily: 'Nunito',
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
fontSize: 24.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
|
||||||
|
),)),
|
||||||
Align(
|
Align(
|
||||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
@ -197,6 +193,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
||||||
onVisibilityToggle: () => setState(() => _model.passwordRegisterFormVisibility = !_model.passwordRegisterFormVisibility),
|
onVisibilityToggle: () => setState(() => _model.passwordRegisterFormVisibility = !_model.passwordRegisterFormVisibility),
|
||||||
label: FFLocalizations.of(context).getVariableText(ptText: 'Nova Senha', enText: 'New Password'),
|
label: FFLocalizations.of(context).getVariableText(ptText: 'Nova Senha', enText: 'New Password'),
|
||||||
hint: FFLocalizations.of(context).getVariableText(ptText: 'Insira sua senha', enText: 'Enter your password'),
|
hint: FFLocalizations.of(context).getVariableText(ptText: 'Insira sua senha', enText: 'Enter your password'),
|
||||||
|
asValidator: _model.passwordRegisterFormTextControllerValidator.asValidator(context),
|
||||||
),
|
),
|
||||||
_buildPasswordField(
|
_buildPasswordField(
|
||||||
context,
|
context,
|
||||||
|
@ -206,6 +203,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
||||||
onVisibilityToggle: () => setState(() => _model.passwordConfirmFormVisibility = !_model.passwordConfirmFormVisibility),
|
onVisibilityToggle: () => setState(() => _model.passwordConfirmFormVisibility = !_model.passwordConfirmFormVisibility),
|
||||||
label: FFLocalizations.of(context).getVariableText(ptText: 'Confirme a Senha', enText: 'Confirm Password'),
|
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'),
|
hint: FFLocalizations.of(context).getVariableText(ptText: 'Confirme sua senha', enText: 'Confirm your password'),
|
||||||
|
asValidator: _model.passwordConfirmFormTextControllerValidator.asValidator(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -215,7 +213,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
||||||
child: FFButtonWidget(
|
child: FFButtonWidget(
|
||||||
key: const ValueKey<String>('SubmitButtonWidget'),
|
key: const ValueKey<String>('SubmitButtonWidget'),
|
||||||
onPressed: _model.isFormInvalid() ? null : () async {
|
onPressed: _model.isFormInvalid() ? null : () async {
|
||||||
await AuthenticationService.changePassword(context, widget.email, _model.passwordRegisterFormTextController!.text, widget.token);
|
await AuthenticationService.changePassword(context, widget.email, _model.passwordConfirmFormTextController!.text, widget.token);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
@ -247,13 +245,10 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
||||||
).animateOnPageLoad(animationsMap['containerOnPageLoadAnimation']!),
|
).animateOnPageLoad(animationsMap['containerOnPageLoadAnimation']!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Widget _buildPasswordField(BuildContext context, {required TextEditingController? controller, required FocusNode? focusNode, required bool visibility, required VoidCallback onVisibilityToggle, required String hint, required String label,}) {
|
Widget _buildPasswordField(BuildContext context, {required TextEditingController? controller, required FocusNode? focusNode, required bool visibility, required VoidCallback onVisibilityToggle, required String hint, required String label, required String? Function(String?)? asValidator}) {
|
||||||
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(
|
||||||
|
@ -317,7 +312,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
||||||
),
|
),
|
||||||
validator: _model.passwordRegisterFormTextControllerValidator.asValidator(context),
|
validator: asValidator,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue