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:flutter/material.dart';
|
||||||
import 'package:rkm_educa_app/componentes/text_custom.dart';
|
import 'package:rkm_educa_app/componentes/text_custom.dart';
|
||||||
|
import 'package:rkm_educa_app/utils/dimensoes.dart';
|
||||||
|
|
||||||
class ItemModelo extends StatelessWidget {
|
class ItemModelo extends StatelessWidget {
|
||||||
String texto;
|
String texto;
|
||||||
String titulo;
|
String titulo;
|
||||||
|
double widthCustom;
|
||||||
|
|
||||||
ItemModelo({
|
ItemModelo({
|
||||||
required this.texto,
|
required this.texto,
|
||||||
required this.titulo,
|
required this.titulo,
|
||||||
|
this.widthCustom = 0.65
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Container(
|
||||||
padding: EdgeInsets.symmetric(vertical: 10),
|
padding: EdgeInsets.symmetric(vertical: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
TextCustom(text: titulo,size: 14.0,fontWeight: FontWeight.bold,),
|
TextCustom(text: titulo,size: 14.0,fontWeight: FontWeight.bold,maxLines: 2,),
|
||||||
SizedBox(width: 10,),
|
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) ...';
|
status = 'CARREGANDO ESTUDANTE(S) ...';
|
||||||
});
|
});
|
||||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||||
buscaFilhos(map['NOME']);
|
print(map['PARENTESCO']);
|
||||||
|
buscaFilhos(map['NOME'],map['PARENTESCO']);
|
||||||
}else{
|
}else{
|
||||||
setState(() {
|
setState(() {
|
||||||
loading = false;
|
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();
|
String q = nome.replaceAll(' ', '%20').toUpperCase();
|
||||||
final url = 'http://192.168.18.2:8000/buscafilhos?NOME=$q';
|
final url = 'http://192.168.18.2:8000/buscafilhos?NOME=$q&PARENTESCO=${parentesco.replaceAll("Ã", 'A').replaceAll('ã', 'a')}';
|
||||||
// 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);
|
||||||
|
|
||||||
@@ -87,7 +88,29 @@ class _TelaLoginState extends State<TelaLogin> {
|
|||||||
loading = false;
|
loading = false;
|
||||||
});
|
});
|
||||||
if(listAlunos.length==1){
|
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!)));
|
Navigator.pushReplacement(context,MaterialPageRoute(builder: (context) => TelaSituacaoEscolar(estudanteModelo: estudanteModelo!)));
|
||||||
}else{
|
}else{
|
||||||
Navigator.pushReplacement(context,MaterialPageRoute(builder: (context) => TelaSelecionaFilho(listAlunos: listAlunos,)));
|
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/alert_default.dart';
|
||||||
import 'package:rkm_educa_app/componentes/appbar_custom.dart';
|
import 'package:rkm_educa_app/componentes/appbar_custom.dart';
|
||||||
import 'package:rkm_educa_app/componentes/drawer_custom.dart';
|
import 'package:rkm_educa_app/componentes/drawer_custom.dart';
|
||||||
|
import 'package:rkm_educa_app/utils/dimensoes.dart';
|
||||||
import '../componentes/item_modelo.dart';
|
import '../componentes/item_modelo.dart';
|
||||||
|
|
||||||
class TelaPerfil extends StatefulWidget {
|
class TelaPerfil extends StatefulWidget {
|
||||||
@@ -41,7 +42,7 @@ class _TelaPerfilState extends State<TelaPerfil> {
|
|||||||
ItemModelo(texto: widget.estudanteModelo.ra,titulo: 'RA',),
|
ItemModelo(texto: widget.estudanteModelo.ra,titulo: 'RA',),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
ItemModelo(texto: widget.estudanteModelo.escola,titulo: 'Escola',),
|
ItemModelo(texto: widget.estudanteModelo.escola,titulo: 'Escola',widthCustom: 0.6,),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: ()=>
|
onPressed: ()=>
|
||||||
AlertDefault().alert(
|
AlertDefault().alert(
|
||||||
@@ -51,9 +52,9 @@ class _TelaPerfilState extends State<TelaPerfil> {
|
|||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
ItemModelo(texto: 'José Oliveira', titulo: 'Diretor(a)'),
|
ItemModelo(texto: 'José Oliveira', titulo: 'Diretor(a)',widthCustom: 0.5),
|
||||||
ItemModelo(texto: 'Luiz Araújo', titulo: 'Coordenador(a)'),
|
ItemModelo(texto: 'Luiz Araújo', titulo: 'Coordenador(a)',widthCustom: 0.4),
|
||||||
ItemModelo(texto: '', titulo: 'Tefelones:'),
|
ItemModelo(texto: '', titulo: 'Tefelones:',widthCustom: 0.5),
|
||||||
ItemModelo(texto: 'Coordenação - (15) 3275 - 1234', titulo: ''),
|
ItemModelo(texto: 'Coordenação - (15) 3275 - 1234', titulo: ''),
|
||||||
ItemModelo(texto: 'Secretaroa - (15) 3275 - 1234', titulo: ''),
|
ItemModelo(texto: 'Secretaroa - (15) 3275 - 1234', titulo: ''),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
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/modelos/estudante_modelo.dart';
|
||||||
import 'package:rkm_educa_app/telas/tela_situacao_escolar.dart';
|
import 'package:rkm_educa_app/telas/tela_situacao_escolar.dart';
|
||||||
import 'package:rkm_educa_app/componentes/appbar_custom.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++){
|
for(int i=0; widget.listAlunos.length>i;i++){
|
||||||
print(widget.listAlunos[i]['NO_ALUNO']);
|
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(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user