ajuste da busca e cadastro pelos cpfs dos pais, botão voltar e botão enviar novamente
This commit is contained in:
@@ -86,17 +86,19 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
|||||||
buscarCPF()async{
|
buscarCPF()async{
|
||||||
final url = '${widget.api}/buscarCPFMae?CPF=${inputCPF.text}&CIDADE=${cidadeQuery.toUpperCase()}';
|
final url = '${widget.api}/buscarCPFMae?CPF=${inputCPF.text}&CIDADE=${cidadeQuery.toUpperCase()}';
|
||||||
print(url);
|
print(url);
|
||||||
final response = await http.get(Uri.parse(url));
|
final response1 = await http.get(Uri.parse(url));
|
||||||
if(response.body == 'false'){
|
mapAluno = response1.body == 'false'?{}:json.decode(response1.body);
|
||||||
|
String celularMae = mapAluno!['CELULAR_MAE']??'';
|
||||||
|
if(response1.body == 'false' || celularMae==''){
|
||||||
final url = '${widget.api}/buscarCPFPai?CPF=${inputCPF.text}&CIDADE=${cidadeQuery.toUpperCase()}';
|
final url = '${widget.api}/buscarCPFPai?CPF=${inputCPF.text}&CIDADE=${cidadeQuery.toUpperCase()}';
|
||||||
print(url);
|
print(url);
|
||||||
final response = await http.get(Uri.parse(url));
|
final response = await http.get(Uri.parse(url));
|
||||||
mapAluno = json.decode(response.body);
|
mapAluno = response.body == 'false'?{}:json.decode(response.body);
|
||||||
print(mapAluno);
|
print(mapAluno);
|
||||||
print(mapAluno!['CD_ALUNO']);
|
print(mapAluno!['CD_ALUNO']);
|
||||||
// inserirDB(map);
|
// inserirDB(map);
|
||||||
if(tentativas <=3){
|
|
||||||
tentativas = tentativas + 1;
|
tentativas = tentativas + 1;
|
||||||
|
if(tentativas <=3){
|
||||||
criarNumero(mapAluno!['DDD_CELULAR_PAI'].toString(),mapAluno!['CELULAR_PAI'].toString());
|
criarNumero(mapAluno!['DDD_CELULAR_PAI'].toString(),mapAluno!['CELULAR_PAI'].toString());
|
||||||
}else{
|
}else{
|
||||||
showSnackBar(context, 'Excedeu suas tentativas, entre em contato com a escola', Colors.red);
|
showSnackBar(context, 'Excedeu suas tentativas, entre em contato com a escola', Colors.red);
|
||||||
@@ -110,12 +112,12 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
|||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
mapAluno = json.decode(response.body);
|
mapAluno = json.decode(response1.body);
|
||||||
print(mapAluno);
|
print(mapAluno);
|
||||||
print(mapAluno!['CD_ALUNO']);
|
print(mapAluno!['CD_ALUNO']);
|
||||||
// inserirDB(map);
|
// inserirDB(map);
|
||||||
if(tentativas <=3){
|
|
||||||
tentativas = tentativas + 1;
|
tentativas = tentativas + 1;
|
||||||
|
if(tentativas <=3){
|
||||||
criarNumero(mapAluno!['DDD_CELULAR_MAE'].toString(),mapAluno!['CELULAR_MAE'].toString());
|
criarNumero(mapAluno!['DDD_CELULAR_MAE'].toString(),mapAluno!['CELULAR_MAE'].toString());
|
||||||
}else{
|
}else{
|
||||||
showSnackBar(context, 'Excedeu suas tentativas, entre em contato com a escola', Colors.red);
|
showSnackBar(context, 'Excedeu suas tentativas, entre em contato com a escola', Colors.red);
|
||||||
@@ -218,6 +220,16 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool>back()async{
|
||||||
|
if(smsEnviado){
|
||||||
|
smsEnviado = false;
|
||||||
|
setState((){});
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List cidades= [];
|
List cidades= [];
|
||||||
@@ -225,7 +237,9 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
|||||||
cidades.add(Fixos().listCidades[i].cidade);
|
cidades.add(Fixos().listCidades[i].cidade);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return WillPopScope(
|
||||||
|
onWillPop:()async=>await back(),
|
||||||
|
child: Scaffold(
|
||||||
appBar: AppBarCustom().appbar(context, 'CADASTRO'),
|
appBar: AppBarCustom().appbar(context, 'CADASTRO'),
|
||||||
body: Container(
|
body: Container(
|
||||||
padding: EdgeInsets.all(Dimensoes.width*0.15),
|
padding: EdgeInsets.all(Dimensoes.width*0.15),
|
||||||
@@ -341,9 +355,15 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
|||||||
colorBorder: PaletaCores.corPrimaria,
|
colorBorder: PaletaCores.corPrimaria,
|
||||||
onPressed: ()=>verificacaoSMS(),
|
onPressed: ()=>verificacaoSMS(),
|
||||||
):Container(),
|
):Container(),
|
||||||
|
smsEnviado?SizedBox(height: 10):Container(),
|
||||||
|
smsEnviado?GestureDetector(
|
||||||
|
onTap: ()=>verificacao(),
|
||||||
|
child: TextCustom(text: "Não recebeu o SMS?\n Enviar novamente",maxLines: 2,textAlign: TextAlign.center,))
|
||||||
|
:Container()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user