criada a tela seleciona_filho_screen.dart e situacao_escolar_screen.dart
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/screens/seleciona_filho_screen.dart';
|
||||
import '../controllers/main_controllers.dart';
|
||||
import '../utils/colors.dart';
|
||||
import '../widgets/buttom_custom.dart';
|
||||
import '../widgets/input_text.dart';
|
||||
import '../widgets/snackBars.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../widgets/text_custom.dart';
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
const LoginScreen({Key? key}) : super(key: key);
|
||||
@@ -14,33 +20,63 @@ class LoginScreen extends StatefulWidget {
|
||||
|
||||
class _LoginScreenState extends State<LoginScreen> {
|
||||
|
||||
final inputLogin = TextEditingController(text: 'teste');
|
||||
final inputSenha = TextEditingController(text: 'senha123');
|
||||
final inputLogin = TextEditingController(text: 'mmatos');
|
||||
final inputSenha = TextEditingController(text: 'mmatos');
|
||||
bool loading = false;
|
||||
|
||||
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);
|
||||
}
|
||||
setState(() {
|
||||
loading = true;
|
||||
});
|
||||
conectAPI();
|
||||
}else{
|
||||
showSnackBar(context, 'Preencha sua senha', Colors.red);
|
||||
}
|
||||
}else{
|
||||
showSnackBar(context, 'Preencha seu e-mail', Colors.red);
|
||||
showSnackBar(context, 'Preencha seu Login', Colors.red);
|
||||
}
|
||||
}
|
||||
|
||||
conectAPI()async{
|
||||
final url = 'http://192.168.18.2/projeto/api_educa/index.php/?NO_USERNAME=${inputLogin.text.toUpperCase()}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
var map = json.decode(response.body);
|
||||
print(map);
|
||||
if(map==false){
|
||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
||||
}else{
|
||||
if(map['NO_USERNAME']==map['SENHA']){
|
||||
if(map['NO_USERNAME']==inputLogin.text.toUpperCase() && map['SENHA']==inputSenha.text.toUpperCase()){
|
||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => SelecionaFilhoScreen()),
|
||||
);
|
||||
}else{
|
||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
||||
}
|
||||
}else{
|
||||
print(MainControllers().encrypt(inputSenha.text,map['SENHA']));
|
||||
if(MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']){
|
||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => SelecionaFilhoScreen()),
|
||||
);
|
||||
}else{
|
||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
||||
}
|
||||
// MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -56,7 +92,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
Container(
|
||||
child: Image.asset("assets/images/logoEduca.png",width:width * 0.4,height: height * 0.12)
|
||||
),
|
||||
Container(
|
||||
loading?Container():Container(
|
||||
width: width>900? width * 0.18:width*0.7,
|
||||
child: InputText(
|
||||
inputFormatters: [],
|
||||
@@ -66,7 +102,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
colorBorder: PaletteColors.white,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
loading?Container():Container(
|
||||
width: width>900? width * 0.18:width*0.7,
|
||||
child: InputText(
|
||||
inputFormatters: [],
|
||||
@@ -78,7 +114,14 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: height * 0.02),
|
||||
ButtonCustom(
|
||||
loading?Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(width: 20,),
|
||||
TextCustom(text: 'VALIDANDO ACESSO...')
|
||||
],
|
||||
):ButtonCustom(
|
||||
widthCustom: 0.7,
|
||||
heightCustom: 0.07,
|
||||
text: "Entrar",
|
||||
|
||||
Reference in New Issue
Block a user