97 lines
3.0 KiB
Dart
97 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../utils/colors.dart';
|
|
import '../widgets/buttom_custom.dart';
|
|
import '../widgets/input_text.dart';
|
|
import '../widgets/snackBars.dart';
|
|
|
|
class LoginScreen extends StatefulWidget {
|
|
const LoginScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<LoginScreen> createState() => _LoginScreenState();
|
|
}
|
|
|
|
class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
final inputLogin = TextEditingController(text: 'teste');
|
|
final inputSenha = TextEditingController(text: 'senha123');
|
|
|
|
verificacao(){
|
|
if(inputLogin.text.isNotEmpty){
|
|
if(inputSenha.text.isNotEmpty){
|
|
if(inputLogin.text == 'teste'){
|
|
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.4,height: height * 0.12)
|
|
),
|
|
Container(
|
|
width: width>900? width * 0.18:width*0.7,
|
|
child: InputText(
|
|
inputFormatters: [],
|
|
controller: inputLogin,
|
|
title: 'Login',
|
|
width: width>900? width * 0.18:width*0.7,
|
|
colorBorder: PaletteColors.white,
|
|
),
|
|
),
|
|
Container(
|
|
width: width>900? width * 0.18:width*0.7,
|
|
child: InputText(
|
|
inputFormatters: [],
|
|
controller: inputSenha,
|
|
title: 'Senha',
|
|
obscure: true,
|
|
width: width>900? width * 0.18:width*0.7,
|
|
colorBorder: PaletteColors.white,
|
|
),
|
|
),
|
|
SizedBox(height: height * 0.02),
|
|
ButtonCustom(
|
|
widthCustom: 0.7,
|
|
heightCustom: 0.07,
|
|
text: "Entrar",
|
|
size: 14.0,
|
|
colorText: PaletteColors.white,
|
|
colorButton: PaletteColors.primaryColor,
|
|
colorBorder: PaletteColors.primaryColor,
|
|
onPressed: ()=>verificacao(),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
);
|
|
}
|
|
}
|