-
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.
- Loading branch information
Showing
4 changed files
with
165 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,79 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
Widget input( | ||
{dynamic onSaved, | ||
TextEditingController? textController, | ||
String? label, | ||
bool senha = false, | ||
bool readOnly = false, | ||
String? placeholder = '', | ||
bool excluir = false, | ||
Function? funcao}) { | ||
return Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Text( | ||
label!, | ||
style: const TextStyle( | ||
color: Colors.black, | ||
fontSize: 16, | ||
fontWeight: FontWeight.w400, | ||
class input extends StatelessWidget { | ||
const input( | ||
{Key? key, | ||
this.onSaved, | ||
this.textController, | ||
this.label, | ||
this.funcao, | ||
this.senha = false, | ||
this.excluir = false, | ||
this.readOnly = false, | ||
this.placeholder = ''}) | ||
: super(key: key); | ||
|
||
final dynamic onSaved; | ||
final TextEditingController? textController; | ||
final String? label; | ||
final bool? senha; | ||
final bool? readOnly; | ||
final String? placeholder; | ||
final bool? excluir; | ||
final Function? funcao; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Text( | ||
label!, | ||
style: const TextStyle( | ||
color: Colors.black, | ||
fontSize: 16, | ||
fontWeight: FontWeight.w400, | ||
), | ||
), | ||
), | ||
Material( | ||
color: Colors.white.withOpacity(0), | ||
child: TextFormField( | ||
obscureText: senha, | ||
readOnly: readOnly, | ||
onSaved: onSaved, | ||
controller: textController, | ||
decoration: InputDecoration( | ||
suffixIcon: excluir | ||
? GestureDetector( | ||
onTap: () { | ||
funcao!(); | ||
}, | ||
child: const Icon(Icons.close)) | ||
: null, | ||
hintText: placeholder, | ||
fillColor: Colors.white, | ||
filled: true, | ||
enabledBorder: OutlineInputBorder( | ||
borderSide: const BorderSide( | ||
color: Colors.black, | ||
width: 3.0, | ||
Material( | ||
color: Colors.white.withOpacity(0), | ||
child: TextFormField( | ||
//key: key ?? Key("keyTesteButton"), | ||
obscureText: senha!, | ||
readOnly: readOnly!, | ||
onSaved: onSaved, | ||
controller: textController, | ||
decoration: InputDecoration( | ||
suffixIcon: excluir! | ||
? GestureDetector( | ||
onTap: () { | ||
funcao!(); | ||
}, | ||
child: const Icon(Icons.close)) | ||
: null, | ||
hintText: placeholder, | ||
fillColor: Colors.white, | ||
filled: true, | ||
enabledBorder: OutlineInputBorder( | ||
borderSide: const BorderSide( | ||
color: Colors.black, | ||
width: 3.0, | ||
), | ||
borderRadius: BorderRadius.circular(16.0), | ||
), | ||
borderRadius: BorderRadius.circular(16.0), | ||
), | ||
focusedBorder: OutlineInputBorder( | ||
borderSide: const BorderSide( | ||
color: Colors.black, | ||
width: 3.0, | ||
focusedBorder: OutlineInputBorder( | ||
borderSide: const BorderSide( | ||
color: Colors.black, | ||
width: 3.0, | ||
), | ||
borderRadius: BorderRadius.circular(16.0), | ||
), | ||
borderRadius: BorderRadius.circular(16.0), | ||
), | ||
|
||
//labelText: 'Password', | ||
//labelText: 'Password', | ||
), | ||
), | ||
), | ||
) | ||
]); | ||
) | ||
]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:organizei/components/botao.dart'; | ||
import 'package:organizei/components/dialogs/login/entrarDialog.dart'; | ||
|
||
void main() { | ||
group('LOGIN', () { | ||
testWidgets('E-mail e senha vazios', (WidgetTester tester) async { | ||
await tester.pumpWidget( | ||
MaterialApp( | ||
home: Material( | ||
child: Builder( | ||
builder: (BuildContext context) { | ||
return Botao( | ||
key: Key("keyTesteButton"), | ||
texto: 'Entrar', | ||
cor: const Color(0xFF74C198), | ||
clicar: () { | ||
entrar(context); | ||
}); | ||
}, | ||
), | ||
), | ||
), | ||
); | ||
|
||
await tester.tap(find.byKey(ValueKey("keyTesteButton"))); | ||
await tester.pump(); | ||
await tester.ensureVisible(find.byKey(Key("keyEntrarButton"))); | ||
await tester.pumpAndSettle(); | ||
await tester.tap(find.byKey(ValueKey("keyEntrarButton"))); | ||
}); | ||
|
||
testWidgets('E-mail vazio', (WidgetTester tester) async { | ||
await tester.pumpWidget(MaterialApp( | ||
home: Material( | ||
child: Builder( | ||
builder: (BuildContext context) { | ||
return Botao( | ||
key: Key("keyTesteButton"), | ||
texto: 'clicar', | ||
cor: const Color(0xFF74C198), | ||
clicar: () { | ||
entrar(context); | ||
}); | ||
}, | ||
), | ||
), | ||
)); | ||
|
||
await tester.tap(find.byKey(ValueKey("keyTesteButton"))); | ||
await tester.pump(); | ||
|
||
await tester.ensureVisible(find.byKey(Key("keyEntrarButton"))); | ||
await tester.pumpAndSettle(); | ||
|
||
await tester.enterText(find.byKey(ValueKey("keyTextSenha")), "senha"); | ||
|
||
await tester.tap(find.byKey(ValueKey("keyEntrarButton"))); | ||
}); | ||
|
||
testWidgets('Senha vazia', (WidgetTester tester) async { | ||
await tester.pumpWidget(MaterialApp( | ||
home: Material( | ||
child: Builder( | ||
builder: (BuildContext context) { | ||
return Botao( | ||
key: Key("keyTesteButton"), | ||
texto: 'clicar', | ||
cor: const Color(0xFF74C198), | ||
clicar: () { | ||
entrar(context); | ||
}); | ||
}, | ||
), | ||
), | ||
)); | ||
|
||
await tester.tap(find.byKey(ValueKey("keyTesteButton"))); | ||
await tester.pump(); | ||
|
||
await tester.ensureVisible(find.byKey(Key("keyEntrarButton"))); | ||
await tester.pumpAndSettle(); | ||
|
||
await tester.enterText( | ||
find.byKey(ValueKey("keyTextEmail")), "[email protected]"); | ||
|
||
await tester.tap(find.byKey(ValueKey("keyEntrarButton"))); | ||
}); | ||
}); | ||
} |