import 'package:educa_controle_acesso/screens/home_screen.dart'; import 'package:educa_controle_acesso/widgets/input_text.dart'; import 'package:flutter/material.dart'; import '../utils/colors.dart'; import '../widgets/buttom_custom.dart'; import '../widgets/snackBars.dart'; class LoginScreen extends StatefulWidget { const LoginScreen({Key? key}) : super(key: key); @override State createState() => _LoginScreenState(); } class _LoginScreenState extends State { final inputEmail = TextEditingController(text: 'teste@gmail.com'); final inputSenha = TextEditingController(text: 'senha123'); verificacao(){ if(inputEmail.text.isNotEmpty){ if(inputSenha.text.isNotEmpty){ if(inputEmail.text == 'teste@gmail.com'){ if(inputSenha.text == 'senha123'){ showSnackBar(context, 'Acesso validado', Colors.green); Navigator.pushReplacement( context, MaterialPageRoute(builder: (context) => HomeScreen()), ); }else{ showSnackBar(context, 'E-mail não cadastrado e/ou senha incorreta', Colors.red); } }else{ showSnackBar(context, 'E-mail não cadastrado e/ou senha incorreta', Colors.red); } }else{ showSnackBar(context, 'Preencha sua senha', Colors.red); } }else{ showSnackBar(context, 'Preencha seu e-mail', Colors.red); } } @override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; return Scaffold( backgroundColor: PaletteColors.white, body: Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ Container( child: Image.asset("assets/images/logoEduca.png",width:width * 0.15,height: height * 0.12) ), Container( width: width>900? width * 0.18:width*0.5, child: InputText( inputFormatters: [], controller: inputEmail, title: 'E-mail', width: width>900? width * 0.18:width*0.5, colorBorder: PaletteColors.white, ), ), SizedBox(height: height * 0.02), Container( width: width>900? width * 0.18:width*0.5, child: InputText( inputFormatters: [], controller: inputSenha, title: 'Senha', obscure: true, width: width * 0.18, colorBorder: PaletteColors.white, ), ), SizedBox(height: height * 0.02), ButtonCustom( widthCustom: 0.1, heightCustom: 0.07, text: "Entrar", size: 14.0, colorText: PaletteColors.white, colorButton: PaletteColors.primaryColor, colorBorder: PaletteColors.primaryColor, onPressed: ()=>verificacao(), ), ], ), ) ); } }