ajustado para receber o nome da escola e idade do aluno
This commit is contained in:
@@ -1,24 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/componentes/text_custom.dart';
|
||||
import 'package:rkm_educa_app/utils/dimensoes.dart';
|
||||
|
||||
class ItemModelo extends StatelessWidget {
|
||||
String texto;
|
||||
String titulo;
|
||||
double widthCustom;
|
||||
|
||||
ItemModelo({
|
||||
required this.texto,
|
||||
required this.titulo,
|
||||
this.widthCustom = 0.65
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextCustom(text: titulo,size: 14.0,fontWeight: FontWeight.bold,),
|
||||
TextCustom(text: titulo,size: 14.0,fontWeight: FontWeight.bold,maxLines: 2,),
|
||||
SizedBox(width: 10,),
|
||||
TextCustom(text: texto,size: 14.0),
|
||||
Container(
|
||||
width: Dimensoes.width*widthCustom,
|
||||
child: TextCustom(text: texto,size: 14.0,maxLines: 3,)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import 'estudante_modelo.dart';
|
||||
|
||||
class DadosEstaticos{
|
||||
List<EstudanteModelo> alunos = [
|
||||
EstudanteModelo(nome: "Maria da Silva", foto: "assets/images/aluna.jpeg", ra: '000.000.000-08', escola: 'EMEI Profª Therezinha de Jesus Alguz', idade: 14, anoEscolar: 2023),
|
||||
EstudanteModelo(nome: "João da Silva", foto: "assets/images/aluno.jpeg", ra: '000.000.000-10', escola: 'EMEI Profª Ernestina Loureiro Miranda', idade: 12, anoEscolar: 2023),
|
||||
];
|
||||
}
|
||||
@@ -64,7 +64,8 @@ class _TelaLoginState extends State<TelaLogin> {
|
||||
status = 'CARREGANDO ESTUDANTE(S) ...';
|
||||
});
|
||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||
buscaFilhos(map['NOME']);
|
||||
print(map['PARENTESCO']);
|
||||
buscaFilhos(map['NOME'],map['PARENTESCO']);
|
||||
}else{
|
||||
setState(() {
|
||||
loading = false;
|
||||
@@ -74,10 +75,10 @@ class _TelaLoginState extends State<TelaLogin> {
|
||||
}
|
||||
}
|
||||
|
||||
buscaFilhos(String nome)async{
|
||||
buscaFilhos(String nome,String parentesco)async{
|
||||
String q = nome.replaceAll(' ', '%20').toUpperCase();
|
||||
final url = 'http://192.168.18.2:8000/buscafilhos?NOME=$q';
|
||||
// print(url);
|
||||
final url = 'http://192.168.18.2:8000/buscafilhos?NOME=$q&PARENTESCO=${parentesco.replaceAll("Ã", 'A').replaceAll('ã', 'a')}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
var map = json.decode(response.body);
|
||||
|
||||
@@ -87,7 +88,29 @@ class _TelaLoginState extends State<TelaLogin> {
|
||||
loading = false;
|
||||
});
|
||||
if(listAlunos.length==1){
|
||||
estudanteModelo = EstudanteModelo(nome: listAlunos[0]['NO_ALUNO'], foto: '', ra: listAlunos[0]['NR_RA'], escola: '', idade: 0, anoEscolar: 2023);
|
||||
|
||||
String dataBD = listAlunos[0]['DT_NASCIMENTO'];
|
||||
int dia = 00;
|
||||
int mes = 00;
|
||||
int ano = 0000;
|
||||
int idade = 0;
|
||||
if(dataBD!=''){
|
||||
dia = int.parse(dataBD.substring(6,8));
|
||||
mes = int.parse(dataBD.substring(4,6));
|
||||
ano = int.parse(dataBD.substring(0,4));
|
||||
final hoje = DateTime.now();
|
||||
final nasc = DateTime.utc(ano,mes,dia);
|
||||
idade = (hoje.difference(nasc).inDays/365).toInt();
|
||||
}
|
||||
|
||||
estudanteModelo = EstudanteModelo(
|
||||
nome: listAlunos[0]['NO_ALUNO'],
|
||||
foto: '',
|
||||
ra: listAlunos[0]['NR_RA'],
|
||||
escola: listAlunos[0]['NO_FANTASIA']=='' || listAlunos[0]['NO_FANTASIA']==null?listAlunos[0]['NO_RAZAO_SOCIAL']:listAlunos[0]['NO_FANTASIA'],
|
||||
idade: idade,
|
||||
anoEscolar: DateTime.now().year
|
||||
);
|
||||
Navigator.pushReplacement(context,MaterialPageRoute(builder: (context) => TelaSituacaoEscolar(estudanteModelo: estudanteModelo!)));
|
||||
}else{
|
||||
Navigator.pushReplacement(context,MaterialPageRoute(builder: (context) => TelaSelecionaFilho(listAlunos: listAlunos,)));
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:rkm_educa_app/utils/cores.dart';
|
||||
import 'package:rkm_educa_app/componentes/alert_default.dart';
|
||||
import 'package:rkm_educa_app/componentes/appbar_custom.dart';
|
||||
import 'package:rkm_educa_app/componentes/drawer_custom.dart';
|
||||
import 'package:rkm_educa_app/utils/dimensoes.dart';
|
||||
import '../componentes/item_modelo.dart';
|
||||
|
||||
class TelaPerfil extends StatefulWidget {
|
||||
@@ -41,7 +42,7 @@ class _TelaPerfilState extends State<TelaPerfil> {
|
||||
ItemModelo(texto: widget.estudanteModelo.ra,titulo: 'RA',),
|
||||
Row(
|
||||
children: [
|
||||
ItemModelo(texto: widget.estudanteModelo.escola,titulo: 'Escola',),
|
||||
ItemModelo(texto: widget.estudanteModelo.escola,titulo: 'Escola',widthCustom: 0.6,),
|
||||
IconButton(
|
||||
onPressed: ()=>
|
||||
AlertDefault().alert(
|
||||
@@ -51,9 +52,9 @@ class _TelaPerfilState extends State<TelaPerfil> {
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ItemModelo(texto: 'José Oliveira', titulo: 'Diretor(a)'),
|
||||
ItemModelo(texto: 'Luiz Araújo', titulo: 'Coordenador(a)'),
|
||||
ItemModelo(texto: '', titulo: 'Tefelones:'),
|
||||
ItemModelo(texto: 'José Oliveira', titulo: 'Diretor(a)',widthCustom: 0.5),
|
||||
ItemModelo(texto: 'Luiz Araújo', titulo: 'Coordenador(a)',widthCustom: 0.4),
|
||||
ItemModelo(texto: '', titulo: 'Tefelones:',widthCustom: 0.5),
|
||||
ItemModelo(texto: 'Coordenação - (15) 3275 - 1234', titulo: ''),
|
||||
ItemModelo(texto: 'Secretaroa - (15) 3275 - 1234', titulo: ''),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_app/modelos/dados_estaticos.dart';
|
||||
import 'package:rkm_educa_app/modelos/estudante_modelo.dart';
|
||||
import 'package:rkm_educa_app/telas/tela_situacao_escolar.dart';
|
||||
import 'package:rkm_educa_app/componentes/appbar_custom.dart';
|
||||
@@ -30,7 +29,31 @@ class _TelaSelecionaFilhoState extends State<TelaSelecionaFilho> {
|
||||
|
||||
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));
|
||||
|
||||
String dataBD = widget.listAlunos[i]['DT_NASCIMENTO'];
|
||||
int dia = 00;
|
||||
int mes = 00;
|
||||
int ano = 0000;
|
||||
int idade = 0;
|
||||
if(dataBD!=''){
|
||||
dia = int.parse(dataBD.substring(6,8));
|
||||
mes = int.parse(dataBD.substring(4,6));
|
||||
ano = int.parse(dataBD.substring(0,4));
|
||||
final hoje = DateTime.now();
|
||||
final nasc = DateTime.utc(ano,mes,dia);
|
||||
idade = (hoje.difference(nasc).inDays/365).toInt();
|
||||
}
|
||||
|
||||
listAlunos.add(
|
||||
EstudanteModelo(
|
||||
nome: widget.listAlunos[i]['NO_ALUNO'],
|
||||
foto: '',
|
||||
ra: widget.listAlunos[i]['NR_RA'],
|
||||
escola: widget.listAlunos[i]['NO_FANTASIA']=='' || widget.listAlunos[i]['NO_FANTASIA']==null?widget.listAlunos[i]['NO_RAZAO_SOCIAL']:widget.listAlunos[i]['NO_FANTASIA'],
|
||||
idade: idade,
|
||||
anoEscolar: DateTime.now().year
|
||||
)
|
||||
);
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user