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;
|
ApiCallResponse? registerCall;
|
||||||
|
|
||||||
if ((email != null && email != '') &&
|
if ((email != null && email != '') &&
|
||||||
(passwd != null && passwd != '') &&
|
(passwd != null && passwd != '' && passwd.length > 7) &&
|
||||||
(name != null && name != '')) {
|
(name != null && name != '')) {
|
||||||
registerCall = await PhpGroup.registerCall.call(
|
registerCall = await PhpGroup.registerCall.call(
|
||||||
name: name,
|
name: name,
|
||||||
|
@ -239,17 +239,22 @@ Future<bool> signUpRegisterAction(
|
||||||
false) {
|
false) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (alertDialogContext) {
|
builder: (alertDialogContext) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Error'),
|
title: Text(
|
||||||
content: Text('${registerCall?.jsonBody}'),
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'An error occurred:', ptText: 'Ocorreu um erro:'),
|
||||||
|
),
|
||||||
|
content: Text(registerCall?.jsonBody['error_msg']),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.pop(alertDialogContext),
|
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/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_animations.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
@ -101,6 +103,26 @@ class _SignUpTemplateComponentWidgetState
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
double screenWidth = MediaQuery.of(context).size.width;
|
double screenWidth = MediaQuery.of(context).size.width;
|
||||||
double screenHeight = MediaQuery.of(context).size.height;
|
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>();
|
context.watch<FFAppState>();
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
|
@ -662,26 +684,7 @@ class _SignUpTemplateComponentWidgetState
|
||||||
padding: const EdgeInsetsDirectional
|
padding: const EdgeInsetsDirectional
|
||||||
.fromSTEB(0.0, 0.0, 0.0, 16.0),
|
.fromSTEB(0.0, 0.0, 0.0, 16.0),
|
||||||
child: FFButtonWidget(
|
child: FFButtonWidget(
|
||||||
onPressed: (((_model
|
onPressed: _isFormInvalid()
|
||||||
.nameRegisterFormTextController.text !=
|
|
||||||
'') ||
|
|
||||||
((_model.nameRegisterFormFocusNode?.hasFocus ??
|
|
||||||
false) !=
|
|
||||||
null)) &&
|
|
||||||
((_model.emailRegisterFormTextController
|
|
||||||
.text !=
|
|
||||||
'') ||
|
|
||||||
((_model.emailRegisterFormFocusNode
|
|
||||||
?.hasFocus ??
|
|
||||||
false) !=
|
|
||||||
null)) &&
|
|
||||||
((_model.passwordRegisterFormTextController
|
|
||||||
.text !=
|
|
||||||
'') ||
|
|
||||||
((_model.passwordRegisterFormFocusNode
|
|
||||||
?.hasFocus ??
|
|
||||||
false) !=
|
|
||||||
null)))
|
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
var shouldSetState = false;
|
var shouldSetState = false;
|
||||||
|
@ -755,6 +758,10 @@ class _SignUpTemplateComponentWidgetState
|
||||||
),
|
),
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(12.0),
|
BorderRadius.circular(12.0),
|
||||||
|
disabledColor:
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.customColor5,
|
||||||
|
disabledTextColor: Colors.white,
|
||||||
),
|
),
|
||||||
showLoadingIndicator: false,
|
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',
|
'en': 'Password',
|
||||||
},
|
},
|
||||||
'3bs10dfq': {
|
'3bs10dfq': {
|
||||||
'pt': 'Campo é necessário',
|
'pt': 'Nome é Obrigatório',
|
||||||
'en': 'Field is required',
|
'en': 'Name is required',
|
||||||
},
|
},
|
||||||
'ph22karc': {
|
'ph22karc': {
|
||||||
'pt': 'Please choose an option from the dropdown',
|
'pt': 'Please choose an option from the dropdown',
|
||||||
'en': '',
|
'en': '',
|
||||||
},
|
},
|
||||||
'mlvw63yj': {
|
'mlvw63yj': {
|
||||||
'pt': 'Campo é necessário',
|
'pt': 'E-mail é Obrigatório',
|
||||||
'en': 'Field is required',
|
'en': 'E-mail is required',
|
||||||
},
|
},
|
||||||
'vobnktrz': {
|
'vobnktrz': {
|
||||||
'pt': 'Insira um email valido.',
|
'pt': 'Insira um email valido.',
|
||||||
|
@ -972,8 +972,8 @@ final kTranslationsMap = <Map<String, Map<String, String>>>[
|
||||||
'en': '',
|
'en': '',
|
||||||
},
|
},
|
||||||
'6nn79lmh': {
|
'6nn79lmh': {
|
||||||
'pt': 'Campo é necessário',
|
'pt': 'Senha é Obrigatório',
|
||||||
'en': 'Field is required',
|
'en': 'Password is required',
|
||||||
},
|
},
|
||||||
'duq5gpp6': {
|
'duq5gpp6': {
|
||||||
'pt': 'A senha deve ter pelo menos 8 caracteres.',
|
'pt': 'A senha deve ter pelo menos 8 caracteres.',
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
class ValidatorUtil {
|
class ValidatorUtil {
|
||||||
|
|
||||||
static bool isValidEmail(String email) {
|
static bool isValidEmail(String email) {
|
||||||
if (RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(email)) {
|
if (RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(email)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -7,4 +6,12 @@ class ValidatorUtil {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
static bool isValidPassword(String password) {
|
||||||
|
if (password.length > 7) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue