WIP
This commit is contained in:
parent
a92a34062c
commit
9433b391eb
|
@ -26,20 +26,50 @@ class ThrowExceptionWidget extends StatefulWidget {
|
|||
class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
|
||||
with TickerProviderStateMixin {
|
||||
late ThrowExceptionModel _model;
|
||||
|
||||
final animationsMap = <String, AnimationInfo>{};
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
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 void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@override void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => ThrowExceptionModel());
|
||||
|
||||
animationsMap.addAll({
|
||||
'stackOnPageLoadAnimation': AnimationInfo(
|
||||
trigger: AnimationTrigger.onPageLoad,
|
||||
|
@ -55,52 +85,12 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
|
|||
),
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@override void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
@override Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
key: const ValueKey('ThrowExceptionWidget'),
|
||||
splashColor: Colors.transparent,
|
||||
|
@ -110,52 +100,59 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
|
|||
onTap: () async {
|
||||
context.pop();
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
||||
child: Icon(
|
||||
_getIconByType(context),
|
||||
color: _getColorByType(context),
|
||||
size: 150.0,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
borderRadius: BorderRadius.circular(20.0), // Ajuste o valor conforme necessário
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 20.0),
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
||||
child: Icon(
|
||||
_getIconByType(context),
|
||||
color: _getColorByType(context),
|
||||
size: 150.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).animateOnPageLoad(animationsMap['stackOnPageLoadAnimation']!),
|
||||
const SizedBox(height: 20.0),
|
||||
Column(
|
||||
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'),
|
||||
],
|
||||
).animateOnPageLoad(animationsMap['stackOnPageLoadAnimation']!),
|
||||
const SizedBox(height: 20.0),
|
||||
Column(
|
||||
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(15.0, 10.0, 15.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),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -201,6 +201,7 @@ class _AppState extends State<App> {
|
|||
isScrollControlled: true,
|
||||
// barrierColor: theme.primaryBackground.withOpacity(0.2),
|
||||
backgroundColor: theme.primaryBackground,
|
||||
showDragHandle: true,
|
||||
useSafeArea: true,
|
||||
enableDrag: true,
|
||||
// isDismissible: true,
|
||||
|
|
|
@ -141,109 +141,107 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
|
|||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 0.0),
|
||||
child: Material(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: const BoxConstraints(maxWidth: 570.0),
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: const BoxConstraints(maxWidth: 570.0),
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
child: Padding(
|
||||
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(
|
||||
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'),
|
||||
asValidator: _model.passwordRegisterFormTextControllerValidator.asValidator(context),
|
||||
),
|
||||
_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'),
|
||||
asValidator: _model.passwordConfirmFormTextControllerValidator.asValidator(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
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.passwordConfirmFormTextController!.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(
|
||||
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(
|
||||
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'),
|
||||
asValidator: _model.passwordRegisterFormTextControllerValidator.asValidator(context),
|
||||
),
|
||||
_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'),
|
||||
asValidator: _model.passwordConfirmFormTextControllerValidator.asValidator(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
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.passwordConfirmFormTextController!.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']!),
|
||||
),
|
||||
),
|
||||
).animateOnPageLoad(animationsMap['containerOnPageLoadAnimation']!),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -28,6 +28,7 @@ class DialogUtil {
|
|||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
|
||||
child: SizedBox(
|
||||
height: _height,
|
||||
child: Padding(
|
||||
|
|
Loading…
Reference in New Issue