Trocado os ShowDialog para utilizar o Componente de DialogUtil

This commit is contained in:
Lucas 2024-08-02 12:09:29 -03:00
parent 2f75441939
commit 9f18ed1de9
2 changed files with 49 additions and 85 deletions

View File

@ -200,8 +200,8 @@ Future<bool> signUpRegisterAction(
required String? email, required String? email,
String? device, String? device,
}) async { }) async {
try {
ApiCallResponse? registerCall; ApiCallResponse? registerCall;
if ((email != null && email != '') && if ((email != null && email != '') &&
(passwd != null && passwd != '' && passwd.length > 7) && (passwd != null && passwd != '' && passwd.length > 7) &&
(name != null && name != '')) { (name != null && name != '')) {
@ -239,53 +239,17 @@ Future<bool> signUpRegisterAction(
false) { false) {
return true; return true;
} }
await showDialog( final errorMessage = registerCall?.jsonBody['error_msg'];
context: context, DialogUtil.error(context, errorMessage);
builder: (alertDialogContext) {
return AlertDialog(
title: Text(
FFLocalizations.of(context).getVariableText(
enText: 'An error occurred:', ptText: 'Ocorreu um erro:'),
),
content: Text(registerCall?.jsonBody['error_msg']),
actions: [
TextButton(
onPressed: () => Navigator.pop(alertDialogContext),
child: Text(
FFLocalizations.of(context)
.getVariableText(enText: 'Close', ptText: 'Fechar'),
),
),
],
);
},
);
return false; return false;
} else { } else {
await showDialog( DialogUtil.errorDefault(context);
context: context, return false;
builder: (alertDialogContext) { }
return AlertDialog( } catch (e, s) {
title: Text(FFLocalizations.of(context).getVariableText( DialogUtil.errorDefault(context);
enText: 'Error', LogUtil.requestAPIFailed(
ptText: 'Erro', 'registro.php', email.toString(), "Register", e, s);
)),
content: Text(FFLocalizations.of(context).getVariableText(
enText: 'Please fill in all fields',
ptText: 'Por favor, preencha todos os campos',
)),
actions: [
TextButton(
onPressed: () => Navigator.pop(alertDialogContext),
child: Text(FFLocalizations.of(context).getVariableText(
ptText: 'Fechar',
enText: 'Close',
)),
),
],
);
},
);
return false; return false;
} }
} }

View File

@ -763,7 +763,7 @@ class _SignUpTemplateComponentWidgetState
.customColor5, .customColor5,
disabledTextColor: Colors.white, disabledTextColor: Colors.white,
), ),
showLoadingIndicator: false, showLoadingIndicator: true,
), ),
), ),