ajustado o acesso para um ou mais filhos após o login, e ajustado os dados após o login
This commit is contained in:
@@ -32,9 +32,11 @@ class DrawerCustom extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
CircleAvatar(
|
||||||
radius: 70,
|
radius: 70,
|
||||||
child: ClipRRect(
|
backgroundColor: Colors.grey[300],
|
||||||
borderRadius:BorderRadius.circular(70),
|
child:estudanteModelo.foto==''?Container():
|
||||||
child: Image.asset(estudanteModelo.foto),
|
ClipRRect(
|
||||||
|
child: Image.asset(estudanteModelo.foto),
|
||||||
|
borderRadius:BorderRadius.circular(70),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class TextCustom extends StatelessWidget {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
textAlign: textAlign,
|
textAlign: textAlign,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
color: color,
|
color: color,
|
||||||
fontSize: size,
|
fontSize: size,
|
||||||
fontWeight: fontWeight,
|
fontWeight: fontWeight,
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:brasil_fields/brasil_fields.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:rkm_educa_app/Telas/tela_situacao_escolar.dart';
|
||||||
|
import 'package:rkm_educa_app/modelos/estudante_modelo.dart';
|
||||||
import 'package:rkm_educa_app/telas/tela_seleciona_filho.dart';
|
import 'package:rkm_educa_app/telas/tela_seleciona_filho.dart';
|
||||||
import 'package:rkm_educa_app/utils/dimensoes.dart';
|
import 'package:rkm_educa_app/utils/dimensoes.dart';
|
||||||
import '../controllers/main_controllers.dart';
|
|
||||||
import '../utils/cores.dart';
|
import '../utils/cores.dart';
|
||||||
import '../componentes/buttom_custom.dart';
|
import '../componentes/buttom_custom.dart';
|
||||||
import '../componentes/input_text.dart';
|
import '../componentes/input_text.dart';
|
||||||
@@ -19,9 +22,11 @@ class TelaLogin extends StatefulWidget {
|
|||||||
|
|
||||||
class _TelaLoginState extends State<TelaLogin> {
|
class _TelaLoginState extends State<TelaLogin> {
|
||||||
|
|
||||||
final inputLogin = TextEditingController(text: 'mmatos');
|
final inputLogin = TextEditingController(text: '402.061.058-43');
|
||||||
final inputSenha = TextEditingController(text: 'mmatos');
|
final inputSenha = TextEditingController(text: 'loginapp2023');
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
EstudanteModelo? estudanteModelo;
|
||||||
|
String status = 'VALIDANDO ACESSO...';
|
||||||
|
|
||||||
verificacao(){
|
verificacao(){
|
||||||
if(inputLogin.text.isNotEmpty){
|
if(inputLogin.text.isNotEmpty){
|
||||||
@@ -30,6 +35,10 @@ class _TelaLoginState extends State<TelaLogin> {
|
|||||||
loading = true;
|
loading = true;
|
||||||
});
|
});
|
||||||
conectAPI();
|
conectAPI();
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(builder: (context) => TelaSelecionaFilho()),
|
||||||
|
// );
|
||||||
}else{
|
}else{
|
||||||
showSnackBar(context, 'Preencha sua senha', Colors.red);
|
showSnackBar(context, 'Preencha sua senha', Colors.red);
|
||||||
}
|
}
|
||||||
@@ -39,38 +48,50 @@ class _TelaLoginState extends State<TelaLogin> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
conectAPI()async{
|
conectAPI()async{
|
||||||
final url = 'http://192.168.18.2/projeto/api_educa/index.php/?NO_USERNAME=${inputLogin.text.toUpperCase()}';
|
final url = 'http://192.168.18.2:8000/loginpais?CPF=${inputLogin.text.toUpperCase()}';
|
||||||
print(url);
|
// print(url);
|
||||||
final response = await http.get(Uri.parse(url));
|
final response = await http.get(Uri.parse(url));
|
||||||
var map = json.decode(response.body);
|
var map = json.decode(response.body);
|
||||||
print(map);
|
// print(map);
|
||||||
if(map==false){
|
if(map==false){
|
||||||
|
setState(() {
|
||||||
|
loading = false;
|
||||||
|
});
|
||||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
||||||
}else{
|
}else{
|
||||||
if(map['NO_USERNAME']==map['SENHA']){
|
if(map['CPF']==inputLogin.text.toUpperCase() && map['SENHA'].toString().toUpperCase()==inputSenha.text.toUpperCase()){
|
||||||
if(map['NO_USERNAME']==inputLogin.text.toUpperCase() && map['SENHA']==inputSenha.text.toUpperCase()){
|
setState(() {
|
||||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
status = 'CARREGANDO ESTUDANTE(S) ...';
|
||||||
Navigator.pushReplacement(context,MaterialPageRoute(builder: (context) => TelaSelecionaFilho()));
|
});
|
||||||
}else{
|
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
buscaFilhos(map['NOME']);
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
print(MainControllers().encrypt(inputSenha.text,map['SENHA']));
|
setState(() {
|
||||||
if(MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']){
|
loading = false;
|
||||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
});
|
||||||
Navigator.push(
|
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => TelaSelecionaFilho()),
|
|
||||||
);
|
|
||||||
}else{
|
|
||||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta', Colors.red);
|
|
||||||
}
|
|
||||||
// MainControllers().encrypt(inputSenha.text,map['SENHA']) == map['SENHA']
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buscaFilhos(String nome)async{
|
||||||
|
String q = nome.replaceAll(' ', '%20').toUpperCase();
|
||||||
|
final url = 'http://192.168.18.2:8000/buscafilhos?NOME=$q';
|
||||||
|
// print(url);
|
||||||
|
final response = await http.get(Uri.parse(url));
|
||||||
|
var map = json.decode(response.body);
|
||||||
|
|
||||||
|
List listAlunos = map;
|
||||||
|
// print(listAlunos);
|
||||||
setState(() {
|
setState(() {
|
||||||
loading = false;
|
loading = false;
|
||||||
});
|
});
|
||||||
|
if(listAlunos.length==1){
|
||||||
|
estudanteModelo = EstudanteModelo(nome: listAlunos[0]['NO_ALUNO'], foto: '', ra: listAlunos[0]['NR_RA'], escola: '', idade: 0, anoEscolar: 2023);
|
||||||
|
Navigator.pushReplacement(context,MaterialPageRoute(builder: (context) => TelaSituacaoEscolar(estudanteModelo: estudanteModelo!)));
|
||||||
|
}else{
|
||||||
|
Navigator.pushReplacement(context,MaterialPageRoute(builder: (context) => TelaSelecionaFilho(listAlunos: listAlunos,)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -87,7 +108,10 @@ class _TelaLoginState extends State<TelaLogin> {
|
|||||||
loading?Container():Container(
|
loading?Container():Container(
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
child: InputText(
|
child: InputText(
|
||||||
inputFormatters: [],
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly,
|
||||||
|
CpfInputFormatter(),
|
||||||
|
],
|
||||||
controller: inputLogin,
|
controller: inputLogin,
|
||||||
title: 'Login',
|
title: 'Login',
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
@@ -111,7 +135,7 @@ class _TelaLoginState extends State<TelaLogin> {
|
|||||||
children: [
|
children: [
|
||||||
CircularProgressIndicator(color: PaletaCores.cinzaClaro,),
|
CircularProgressIndicator(color: PaletaCores.cinzaClaro,),
|
||||||
SizedBox(width: 20,),
|
SizedBox(width: 20,),
|
||||||
TextCustom(text: 'VALIDANDO ACESSO...')
|
TextCustom(text: status)
|
||||||
],
|
],
|
||||||
):ButtonCustom(
|
):ButtonCustom(
|
||||||
widthCustom: 0.7,
|
widthCustom: 0.7,
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ class _TelaPerfilState extends State<TelaPerfil> {
|
|||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
CircleAvatar(
|
||||||
radius: 70,
|
radius: 70,
|
||||||
child: ClipRRect(
|
backgroundColor: Colors.grey[300],
|
||||||
|
child:widget.estudanteModelo.foto==''?Container(): ClipRRect(
|
||||||
borderRadius:BorderRadius.circular(70),
|
borderRadius:BorderRadius.circular(70),
|
||||||
child: Image.asset(widget.estudanteModelo.foto),
|
child: Image.asset(widget.estudanteModelo.foto),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ import '../componentes/text_custom.dart';
|
|||||||
import '../utils/dimensoes.dart';
|
import '../utils/dimensoes.dart';
|
||||||
|
|
||||||
class TelaSelecionaFilho extends StatefulWidget {
|
class TelaSelecionaFilho extends StatefulWidget {
|
||||||
const TelaSelecionaFilho({Key? key}) : super(key: key);
|
List listAlunos;
|
||||||
|
TelaSelecionaFilho({
|
||||||
|
required this.listAlunos
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TelaSelecionaFilho> createState() => _TelaSelecionaFilhoState();
|
State<TelaSelecionaFilho> createState() => _TelaSelecionaFilhoState();
|
||||||
@@ -20,12 +23,21 @@ class _TelaSelecionaFilhoState extends State<TelaSelecionaFilho> {
|
|||||||
|
|
||||||
EstudanteModelo? estudanteModelo;
|
EstudanteModelo? estudanteModelo;
|
||||||
|
|
||||||
List <EstudanteModelo>list = [];
|
List <EstudanteModelo>listAlunos = [];
|
||||||
|
|
||||||
|
carregarAlunos(){
|
||||||
|
print(widget.listAlunos);
|
||||||
|
|
||||||
|
for(int i=0; widget.listAlunos.length>i;i++){
|
||||||
|
print(widget.listAlunos[i]['NO_ALUNO']);
|
||||||
|
listAlunos.add(EstudanteModelo(nome: widget.listAlunos[i]['NO_ALUNO'], foto: '', ra: widget.listAlunos[i]['NR_RA'], escola: '', idade: 0, anoEscolar: 2023));
|
||||||
|
}
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
list = DadosEstaticos().alunos;
|
carregarAlunos();
|
||||||
setState(() {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -47,7 +59,7 @@ class _TelaSelecionaFilhoState extends State<TelaSelecionaFilho> {
|
|||||||
children: [
|
children: [
|
||||||
TextCustom(text: 'Estudantes',fontWeight: FontWeight.bold,size: 14.0,),
|
TextCustom(text: 'Estudantes',fontWeight: FontWeight.bold,size: 14.0,),
|
||||||
Container(
|
Container(
|
||||||
width: Dimensoes.width*0.8,
|
width: Dimensoes.width*0.85,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@@ -62,13 +74,15 @@ class _TelaSelecionaFilhoState extends State<TelaSelecionaFilho> {
|
|||||||
child: TextCustom(text: 'Selecione'),
|
child: TextCustom(text: 'Selecione'),
|
||||||
),
|
),
|
||||||
value: estudanteModelo,
|
value: estudanteModelo,
|
||||||
items: list.map((value) => DropdownMenuItem(
|
items: listAlunos.map((value) => DropdownMenuItem(
|
||||||
value: value,
|
value: value,
|
||||||
child: Padding(
|
child: Container(
|
||||||
|
width: Dimensoes.width*0.75,
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: TextCustom(
|
child: TextCustom(
|
||||||
text: value.nome,
|
text: value.nome,
|
||||||
color: Colors.black54,
|
color: Colors.black54,
|
||||||
|
size: 14.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -33,6 +33,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "2.1.1"
|
||||||
|
brasil_fields:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: brasil_fields
|
||||||
|
sha256: "3c8e580c31657402a4e41c5d46325dc91db6be968063e0f68475c233b906281c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.13.1"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ dependencies:
|
|||||||
http:
|
http:
|
||||||
intl:
|
intl:
|
||||||
syncfusion_flutter_charts: ^21.2.9
|
syncfusion_flutter_charts: ^21.2.9
|
||||||
|
brasil_fields:
|
||||||
|
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|||||||
Reference in New Issue
Block a user