-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix#59/melhora menssagem de erro e ajusta casos de teste (fga-eps-mds/2024.2-ARANDU-DOC#59) #53
Merged
GabrielCostaDeOliveira
merged 4 commits into
dev
from
fix#59/ajusta-menssagem-register_account
Dec 26, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
288039a
fix#59/melhora mensagens de erro do register_account e ajusta casos d…
Yasm1nNasc1mento a172397
fix(#59): Corrige register_account viewModel, shared e test
Yasm1nNasc1mento 1842fe5
Merge branch 'dev' into fix#59/ajusta-menssagem-register_account
GabrielCostaDeOliveira 0d1a76b
Merge branch 'fix#59/ajusta-menssagem-register_account' of https://gi…
GabrielCostaDeOliveira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; | |
|
||
class TextEmail extends StatelessWidget{ | ||
|
||
|
||
final String label; | ||
final TextEditingController controller; | ||
final EdgeInsetsGeometry padding; | ||
|
||
|
@@ -11,8 +11,9 @@ class TextEmail extends StatelessWidget{ | |
|
||
const TextEmail ({ | ||
super.key, | ||
this.label = 'E-mail', | ||
required this.padding, | ||
required this.controller | ||
required this.controller, | ||
}); | ||
|
||
|
||
|
@@ -22,12 +23,18 @@ class TextEmail extends StatelessWidget{ | |
return Padding( | ||
padding: padding, | ||
child: TextFormField( | ||
validator: (value) => value == null|| emailRegex.hasMatch(value) ? null : 'E-mail inválido', | ||
validator: (value) { | ||
if (value == null || value.trim().isEmpty) { | ||
return '$label Obrigatório.'; | ||
} else if (!emailRegex.hasMatch(value.trim())) { | ||
return 'Opa, $label inválido!\n(Ex: [email protected])'; | ||
} | ||
return null; | ||
}, | ||
controller: controller, | ||
decoration: InputDecoration ( | ||
prefixIcon: Icon ( Icons.email_outlined, color: Theme.of(context).colorScheme.primary), | ||
labelText: 'E-mail' | ||
), | ||
labelText: label), | ||
), | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class TextPassWord extends StatefulWidget { | ||
|
||
final String label; | ||
final TextEditingController controller; | ||
final EdgeInsetsGeometry padding; | ||
|
||
const TextPassWord ({ | ||
super.key, | ||
required this.padding, | ||
required this.controller | ||
const TextPassWord({ | ||
super.key, | ||
this.label = 'Senha', | ||
required this.padding, | ||
required this.controller, | ||
}); | ||
|
||
|
||
@override | ||
State<StatefulWidget> createState() { | ||
return _TextPassWord(); | ||
} | ||
} | ||
} | ||
|
||
|
||
class _TextPassWord extends State<TextPassWord> { | ||
bool _hidePassord = true; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
|
||
return | ||
Padding( | ||
padding: widget.padding, | ||
child: TextFormField( | ||
return Padding( | ||
padding: widget.padding, | ||
child: TextFormField( | ||
validator: (value) { | ||
if (value == null || value.isEmpty || value.length < 8) { | ||
return 'Senha inválida'; | ||
if (value == null || value.isEmpty) { | ||
return '${widget.label} Obrigatória.'; | ||
} else if (value.length < 8) { | ||
return '${widget.label} deve ter no mínimo 8 caracteres.\n(Ex: @abd1234)'; | ||
} | ||
return null; | ||
}, | ||
controller: widget.controller, | ||
obscureText: _hidePassord, | ||
decoration: InputDecoration ( | ||
prefixIcon: Icon ( Icons.lock_outline, color: Theme.of(context).colorScheme.primary), | ||
suffixIcon: GestureDetector ( | ||
onTap: () => setState(() { _hidePassord = !_hidePassord; }), | ||
child: Icon( | ||
_hidePassord ? Icons.visibility_off_outlined : Icons.visibility_outlined, | ||
color: Theme.of(context).colorScheme.primary | ||
) | ||
), | ||
labelText: 'Senha' | ||
), | ||
obscureText: _hidePassord, | ||
decoration: InputDecoration( | ||
prefixIcon: Icon(Icons.lock_outline, | ||
color: Theme.of(context).colorScheme.primary), | ||
suffixIcon: GestureDetector( | ||
onTap: () => setState(() { | ||
_hidePassord = !_hidePassord; | ||
}), | ||
child: Icon( | ||
_hidePassord | ||
? Icons.visibility_off_outlined | ||
: Icons.visibility_outlined, | ||
color: Theme.of(context).colorScheme.primary)), | ||
labelText: widget.label, | ||
), | ||
); | ||
|
||
|
||
} | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,10 @@ void main() { | |
} | ||
|
||
// Teste de validação para diferentes casos | ||
await testEmail("", "E-mail inválido"); // Campo vazio | ||
await testEmail("joaozinhi", "E-mail inválido"); // Sem '@' | ||
await testEmail("joaozinhi@", "E-mail inválido"); // Sem domínio | ||
await testEmail("joao@domain", "E-mail inválido"); // Sem extensão | ||
await testEmail("", "E-mail Obrigatório."); // Campo vazio | ||
await testEmail("joaozinhi", "Opa, E-mail inválido!\n(Ex: [email protected])"); // Sem '@' | ||
await testEmail("joaozinhi@", "Opa, E-mail inválido!\n(Ex: [email protected])"); // Sem domínio | ||
await testEmail("joao@domain", "Opa, E-mail inválido!\n(Ex: [email protected])"); // Sem extensão | ||
await testEmail("[email protected]", null); // Entrada válida | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use $label nas suas mensagens de erro se vc quiser se referir ao nome do campo.