-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#59): Corrige register_account viewModel, shared e test
- Loading branch information
1 parent
288039a
commit a172397
Showing
9 changed files
with
44 additions
and
36 deletions.
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, | ||
}); | ||
|
||
|
||
|
@@ -24,17 +25,16 @@ class TextEmail extends StatelessWidget{ | |
child: TextFormField( | ||
validator: (value) { | ||
if (value == null || value.trim().isEmpty) { | ||
return 'Campo Obrigatório'; | ||
return '$label Obrigatório.'; | ||
} else if (!emailRegex.hasMatch(value.trim())) { | ||
return 'E-mail inválido (Ex: [email protected])'; | ||
return 'Opa, $label inválido! (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
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("", "Campo Obrigatório"); // Campo vazio | ||
await testEmail("joaozinhi", "E-mail inválido (Ex: [email protected])"); // Sem '@' | ||
await testEmail("joaozinhi@", "E-mail inválido (Ex: [email protected])"); // Sem domínio | ||
await testEmail("joao@domain", "E-mail inválido (Ex: [email protected])"); // Sem extensão | ||
await testEmail("", "E-mail Obrigatório."); // Campo vazio | ||
await testEmail("joaozinhi", "Opa, E-mail inválido! (Ex: [email protected])"); // Sem '@' | ||
await testEmail("joaozinhi@", "Opa, E-mail inválido! (Ex: [email protected])"); // Sem domínio | ||
await testEmail("joao@domain", "Opa, E-mail inválido! (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