This commit is contained in:
J. A. Messias 2024-10-10 11:02:10 -03:00
parent a92a34062c
commit 9433b391eb
4 changed files with 187 additions and 190 deletions

View File

@ -26,20 +26,50 @@ class ThrowExceptionWidget extends StatefulWidget {
class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget> class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
with TickerProviderStateMixin { with TickerProviderStateMixin {
late ThrowExceptionModel _model; late ThrowExceptionModel _model;
final animationsMap = <String, AnimationInfo>{}; final animationsMap = <String, AnimationInfo>{};
@override Color _getColorByType(BuildContext context) {
void setState(VoidCallback callback) { 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); super.setState(callback);
_model.onUpdate(); _model.onUpdate();
} }
@override void initState() {
@override
void initState() {
super.initState(); super.initState();
_model = createModel(context, () => ThrowExceptionModel()); _model = createModel(context, () => ThrowExceptionModel());
animationsMap.addAll({ animationsMap.addAll({
'stackOnPageLoadAnimation': AnimationInfo( 'stackOnPageLoadAnimation': AnimationInfo(
trigger: AnimationTrigger.onPageLoad, trigger: AnimationTrigger.onPageLoad,
@ -55,52 +85,12 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
), ),
}); });
} }
@override void dispose() {
@override
void dispose() {
_model.maybeDispose(); _model.maybeDispose();
super.dispose(); super.dispose();
} }
@override Widget build(BuildContext context) {
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) {
return InkWell( return InkWell(
key: const ValueKey('ThrowExceptionWidget'), key: const ValueKey('ThrowExceptionWidget'),
splashColor: Colors.transparent, splashColor: Colors.transparent,
@ -110,11 +100,17 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
onTap: () async { onTap: () async {
context.pop(); context.pop();
}, },
child: DecoratedBox(
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: BorderRadius.circular(20.0), // Ajuste o valor conforme necessário
),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const SizedBox(height: 20.0),
Stack( Stack(
children: <Widget>[ children: <Widget>[
Align( Align(
@ -143,7 +139,7 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
), ),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), padding: const EdgeInsetsDirectional.fromSTEB(15.0, 10.0, 15.0, 0.0),
child: Text( child: Text(
valueOrDefault<String>(widget.msg, 'Message Not Found'), valueOrDefault<String>(widget.msg, 'Message Not Found'),
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
@ -158,6 +154,7 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
], ],
), ),
), ),
),
); );
} }
} }

View File

@ -201,6 +201,7 @@ class _AppState extends State<App> {
isScrollControlled: true, isScrollControlled: true,
// barrierColor: theme.primaryBackground.withOpacity(0.2), // barrierColor: theme.primaryBackground.withOpacity(0.2),
backgroundColor: theme.primaryBackground, backgroundColor: theme.primaryBackground,
showDragHandle: true,
useSafeArea: true, useSafeArea: true,
enableDrag: true, enableDrag: true,
// isDismissible: true, // isDismissible: true,

View File

@ -141,7 +141,6 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 0.0), padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 0.0),
child: Material(
child: Container( child: Container(
width: double.infinity, width: double.infinity,
constraints: const BoxConstraints(maxWidth: 570.0), constraints: const BoxConstraints(maxWidth: 570.0),
@ -245,7 +244,6 @@ 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, required String? Function(String?)? asValidator}) { 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}) {

View File

@ -28,6 +28,7 @@ class DialogUtil {
context: context, context: context,
builder: (context) { builder: (context) {
return Dialog( return Dialog(
child: SizedBox( child: SizedBox(
height: _height, height: _height,
child: Padding( child: Padding(