Trocado os ShowDialog para utilizar o Componente de DialogUtil
This commit is contained in:
parent
2f75441939
commit
9f18ed1de9
|
@ -200,92 +200,56 @@ Future<bool> signUpRegisterAction(
|
||||||
required String? email,
|
required String? email,
|
||||||
String? device,
|
String? device,
|
||||||
}) async {
|
}) async {
|
||||||
ApiCallResponse? registerCall;
|
try {
|
||||||
|
ApiCallResponse? registerCall;
|
||||||
|
if ((email != null && email != '') &&
|
||||||
|
(passwd != null && passwd != '' && passwd.length > 7) &&
|
||||||
|
(name != null && name != '')) {
|
||||||
|
registerCall = await PhpGroup.registerCall.call(
|
||||||
|
name: name,
|
||||||
|
password: passwd,
|
||||||
|
email: email,
|
||||||
|
token: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
uuid: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
tipo: device,
|
||||||
|
descricao: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
if ((email != null && email != '') &&
|
if (PhpGroup.registerCall.error(
|
||||||
(passwd != null && passwd != '' && passwd.length > 7) &&
|
(registerCall.jsonBody ?? ''),
|
||||||
(name != null && name != '')) {
|
) ==
|
||||||
registerCall = await PhpGroup.registerCall.call(
|
false) {
|
||||||
name: name,
|
return true;
|
||||||
password: passwd,
|
}
|
||||||
email: email,
|
final errorMessage = registerCall?.jsonBody['error_msg'];
|
||||||
token: randomString(
|
DialogUtil.error(context, errorMessage);
|
||||||
36,
|
return false;
|
||||||
36,
|
} else {
|
||||||
false,
|
DialogUtil.errorDefault(context);
|
||||||
false,
|
return false;
|
||||||
true,
|
|
||||||
),
|
|
||||||
uuid: randomString(
|
|
||||||
36,
|
|
||||||
36,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
tipo: device,
|
|
||||||
descricao: randomString(
|
|
||||||
36,
|
|
||||||
36,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (PhpGroup.registerCall.error(
|
|
||||||
(registerCall.jsonBody ?? ''),
|
|
||||||
) ==
|
|
||||||
false) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
await showDialog(
|
} catch (e, s) {
|
||||||
context: context,
|
DialogUtil.errorDefault(context);
|
||||||
builder: (alertDialogContext) {
|
LogUtil.requestAPIFailed(
|
||||||
return AlertDialog(
|
'registro.php', email.toString(), "Register", e, s);
|
||||||
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;
|
|
||||||
} else {
|
|
||||||
await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (alertDialogContext) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Error',
|
|
||||||
ptText: 'Erro',
|
|
||||||
)),
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -763,7 +763,7 @@ class _SignUpTemplateComponentWidgetState
|
||||||
.customColor5,
|
.customColor5,
|
||||||
disabledTextColor: Colors.white,
|
disabledTextColor: Colors.white,
|
||||||
),
|
),
|
||||||
showLoadingIndicator: false,
|
showLoadingIndicator: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue