WIP
This commit is contained in:
parent
d428f9379d
commit
a92a34062c
|
@ -191,20 +191,20 @@ class _AppState extends State<App> {
|
|||
if (isNotEmpty ) {
|
||||
final BuildContext context = StorageUtil().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 Widget screen = ForgotPasswordScreen(email: email, token: token);
|
||||
builder(context) => screen;
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => SizedBox(height: height, child: builder(context)),
|
||||
builder: (context) => Padding(padding: MediaQuery.viewInsetsOf(context), child: builder(context)),
|
||||
isScrollControlled: true,
|
||||
barrierColor: theme.primaryBackground.withOpacity(0.2),
|
||||
// barrierColor: theme.primaryBackground.withOpacity(0.2),
|
||||
backgroundColor: theme.primaryBackground,
|
||||
useSafeArea: true,
|
||||
enableDrag: true,
|
||||
isDismissible: true,
|
||||
).then((_) => StorageUtil().isRecovered = false);
|
||||
// isDismissible: true,
|
||||
).whenComplete(() => StorageUtil().isRecovered = false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,14 @@ class ForgotPasswordScreenModel extends FlutterFlowModel<ForgotPasswordScreen> {
|
|||
String? Function(BuildContext, String?)? passwordRegisterFormTextControllerValidator;
|
||||
String? _passwordRegisterFormTextControllerValidator(BuildContext context, String? val) {
|
||||
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(
|
||||
'6nn79lmh' /* Campo é necessário */,
|
||||
'duq5gpp6' /* A senha deve ter pelo menos 8 ... */,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -88,11 +88,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
|
||||
super.dispose();
|
||||
}
|
||||
@override Widget build(BuildContext context) => Scaffold(
|
||||
appBar: buildAppBar(context),
|
||||
body: buildBody(context),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
);
|
||||
@override Widget build(BuildContext context) => buildBody(context);
|
||||
|
||||
|
||||
AppBar buildAppBar(BuildContext context) {
|
||||
|
@ -130,29 +126,21 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
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(
|
||||
ptText: 'Qual será a sua nova senha? Insira abaixo e confirme.',
|
||||
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: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0), // Adiciona espaçamento inferior
|
||||
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),
|
||||
padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 0.0),
|
||||
child: Material(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
|
@ -162,11 +150,19 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
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(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
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(
|
||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||
child: Padding(
|
||||
|
@ -197,6 +193,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
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'),
|
||||
asValidator: _model.passwordRegisterFormTextControllerValidator.asValidator(context),
|
||||
),
|
||||
_buildPasswordField(
|
||||
context,
|
||||
|
@ -206,6 +203,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
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'),
|
||||
asValidator: _model.passwordConfirmFormTextControllerValidator.asValidator(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -215,7 +213,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
child: FFButtonWidget(
|
||||
key: const ValueKey<String>('SubmitButtonWidget'),
|
||||
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(() {});
|
||||
},
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
|
@ -247,13 +245,10 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
).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(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0),
|
||||
child: SizedBox(
|
||||
|
@ -317,7 +312,7 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
fontWeight: FontWeight.w500,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
||||
),
|
||||
validator: _model.passwordRegisterFormTextControllerValidator.asValidator(context),
|
||||
validator: asValidator,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue