Correção do modal de erro;
Correção no validator; Adição de Tradução nos Modais;
This commit is contained in:
parent
5e1211b44e
commit
2f75441939
|
@ -203,7 +203,7 @@ Future<bool> signUpRegisterAction(
|
|||
ApiCallResponse? registerCall;
|
||||
|
||||
if ((email != null && email != '') &&
|
||||
(passwd != null && passwd != '') &&
|
||||
(passwd != null && passwd != '' && passwd.length > 7) &&
|
||||
(name != null && name != '')) {
|
||||
registerCall = await PhpGroup.registerCall.call(
|
||||
name: name,
|
||||
|
@ -239,17 +239,22 @@ Future<bool> signUpRegisterAction(
|
|||
false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (alertDialogContext) {
|
||||
return AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text('${registerCall?.jsonBody}'),
|
||||
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: const Text('ERROR2 '),
|
||||
child: Text(
|
||||
FFLocalizations.of(context)
|
||||
.getVariableText(enText: 'Close', ptText: 'Fechar'),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart';
|
||||
import 'package:hub/shared/components/atoms/atom_terms_of_use.dart';
|
||||
import 'package:hub/shared/utils/validator_util.dart';
|
||||
|
||||
import '/flutter_flow/flutter_flow_animations.dart';
|
||||
import '/flutter_flow/flutter_flow_theme.dart';
|
||||
|
@ -101,6 +103,26 @@ class _SignUpTemplateComponentWidgetState
|
|||
Widget build(BuildContext context) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
double screenHeight = MediaQuery.of(context).size.height;
|
||||
bool _isFormInvalid() {
|
||||
if (_model.nameRegisterFormTextController.text == '' ||
|
||||
_model.emailRegisterFormTextController.text == '' ||
|
||||
_model.passwordRegisterFormTextController.text == '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ValidatorUtil.isValidEmail(
|
||||
_model.emailRegisterFormTextController.text)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ValidatorUtil.isValidPassword(
|
||||
_model.passwordRegisterFormTextController.text)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Row(
|
||||
|
@ -662,26 +684,7 @@ class _SignUpTemplateComponentWidgetState
|
|||
padding: const EdgeInsetsDirectional
|
||||
.fromSTEB(0.0, 0.0, 0.0, 16.0),
|
||||
child: FFButtonWidget(
|
||||
onPressed: (((_model
|
||||
.nameRegisterFormTextController.text !=
|
||||
'') ||
|
||||
((_model.nameRegisterFormFocusNode?.hasFocus ??
|
||||
false) !=
|
||||
null)) &&
|
||||
((_model.emailRegisterFormTextController
|
||||
.text !=
|
||||
'') ||
|
||||
((_model.emailRegisterFormFocusNode
|
||||
?.hasFocus ??
|
||||
false) !=
|
||||
null)) &&
|
||||
((_model.passwordRegisterFormTextController
|
||||
.text !=
|
||||
'') ||
|
||||
((_model.passwordRegisterFormFocusNode
|
||||
?.hasFocus ??
|
||||
false) !=
|
||||
null)))
|
||||
onPressed: _isFormInvalid()
|
||||
? null
|
||||
: () async {
|
||||
var shouldSetState = false;
|
||||
|
@ -755,6 +758,10 @@ class _SignUpTemplateComponentWidgetState
|
|||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(12.0),
|
||||
disabledColor:
|
||||
FlutterFlowTheme.of(context)
|
||||
.customColor5,
|
||||
disabledTextColor: Colors.white,
|
||||
),
|
||||
showLoadingIndicator: false,
|
||||
),
|
||||
|
@ -837,6 +844,7 @@ class _SignUpTemplateComponentWidgetState
|
|||
),
|
||||
),
|
||||
),
|
||||
const AtomTermsOfUse(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -847,20 +855,6 @@ class _SignUpTemplateComponentWidgetState
|
|||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'huygnka2' /* Termo de Uso */,
|
||||
),
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).secondaryText,
|
||||
fontSize: 14.0,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -952,16 +952,16 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
|
|||
'en': 'Password',
|
||||
},
|
||||
'3bs10dfq': {
|
||||
'pt': 'Campo é necessário',
|
||||
'en': 'Field is required',
|
||||
'pt': 'Nome é Obrigatório',
|
||||
'en': 'Name is required',
|
||||
},
|
||||
'ph22karc': {
|
||||
'pt': 'Please choose an option from the dropdown',
|
||||
'en': '',
|
||||
},
|
||||
'mlvw63yj': {
|
||||
'pt': 'Campo é necessário',
|
||||
'en': 'Field is required',
|
||||
'pt': 'E-mail é Obrigatório',
|
||||
'en': 'E-mail is required',
|
||||
},
|
||||
'vobnktrz': {
|
||||
'pt': 'Insira um email valido.',
|
||||
|
@ -972,8 +972,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
|
|||
'en': '',
|
||||
},
|
||||
'6nn79lmh': {
|
||||
'pt': 'Campo é necessário',
|
||||
'en': 'Field is required',
|
||||
'pt': 'Senha é Obrigatório',
|
||||
'en': 'Password is required',
|
||||
},
|
||||
'duq5gpp6': {
|
||||
'pt': 'A senha deve ter pelo menos 8 caracteres.',
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class ValidatorUtil {
|
||||
|
||||
static bool isValidEmail(String email) {
|
||||
if (RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(email)) {
|
||||
return true;
|
||||
|
@ -7,4 +6,12 @@ class ValidatorUtil {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool isValidPassword(String password) {
|
||||
if (password.length > 7) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue