ajustes da pesquisa e conexão com a api
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:brasil_fields/brasil_fields.dart';
|
||||
import 'package:educa_controle_acesso/models/aluno_model.dart';
|
||||
import 'package:educa_controle_acesso/models/responsavel_model.dart';
|
||||
@@ -12,6 +14,7 @@ import '../widgets/caixa_texto_container.dart';
|
||||
import '../widgets/input_text.dart';
|
||||
import '../widgets/snackBars.dart';
|
||||
import '../widgets/text_custom.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
class ResponsibleRegisterScreen extends StatefulWidget {
|
||||
AlunoModel alunoModel;
|
||||
@@ -94,6 +97,55 @@ class _ResponsibleRegisterScreenState extends State<ResponsibleRegisterScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
carregaPais(){
|
||||
if(widget.alunoModel.dados['NO_PAI']!=''){
|
||||
responsaveis.add(
|
||||
ResponsavelModel(
|
||||
nomeAluno: widget.alunoModel.nome.toUpperCase(),
|
||||
raAluno: widget.alunoModel.ra.toUpperCase(),
|
||||
escola: widget.alunoModel.escola.toUpperCase(),
|
||||
serie: widget.alunoModel.serie.toUpperCase(),
|
||||
turma: widget.alunoModel.turma.toUpperCase(),
|
||||
nomeResponsavel: widget.alunoModel.dados['NO_PAI'],
|
||||
parentesco: 'PAI',
|
||||
cpf: '',
|
||||
senha: '',
|
||||
dataCadastro: DateFormat('dd/MM/yyyy HH:mm').format(DateTime.now())
|
||||
)
|
||||
);
|
||||
}
|
||||
if(widget.alunoModel.dados['NO_MAE']!=''){
|
||||
responsaveis.add(
|
||||
ResponsavelModel(
|
||||
nomeAluno: widget.alunoModel.nome.toUpperCase(),
|
||||
raAluno: widget.alunoModel.ra.toUpperCase(),
|
||||
escola: widget.alunoModel.escola.toUpperCase(),
|
||||
serie: widget.alunoModel.serie.toUpperCase(),
|
||||
turma: widget.alunoModel.turma.toUpperCase(),
|
||||
nomeResponsavel: widget.alunoModel.dados['NO_MAE'],
|
||||
parentesco: 'MAE',
|
||||
cpf: '',
|
||||
senha: '',
|
||||
dataCadastro: DateFormat('dd/MM/yyyy HH:mm').format(DateTime.now())
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
paisBanco()async{
|
||||
final url = 'http://localhost:8000/pais';
|
||||
// print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
var map = json.decode(response.body);
|
||||
print(map);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
carregaPais();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user