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{
|
||||
final url = '${widget.api}/buscarCPFMae?CPF=${inputCPF.text}&CIDADE=${cidadeQuery.toUpperCase()}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
if(response.body == 'false'){
|
||||
final response1 = await http.get(Uri.parse(url));
|
||||
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()}';
|
||||
print(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!['CD_ALUNO']);
|
||||
// inserirDB(map);
|
||||
if(tentativas <=3){
|
||||
tentativas = tentativas + 1;
|
||||
if(tentativas <=3){
|
||||
criarNumero(mapAluno!['DDD_CELULAR_PAI'].toString(),mapAluno!['CELULAR_PAI'].toString());
|
||||
}else{
|
||||
showSnackBar(context, 'Excedeu suas tentativas, entre em contato com a escola', Colors.red);
|
||||
@@ -110,12 +112,12 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
||||
setState(() {});
|
||||
}
|
||||
}else{
|
||||
mapAluno = json.decode(response.body);
|
||||
mapAluno = json.decode(response1.body);
|
||||
print(mapAluno);
|
||||
print(mapAluno!['CD_ALUNO']);
|
||||
// inserirDB(map);
|
||||
if(tentativas <=3){
|
||||
tentativas = tentativas + 1;
|
||||
if(tentativas <=3){
|
||||
criarNumero(mapAluno!['DDD_CELULAR_MAE'].toString(),mapAluno!['CELULAR_MAE'].toString());
|
||||
}else{
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
List cidades= [];
|
||||
@@ -225,7 +237,9 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
||||
cidades.add(Fixos().listCidades[i].cidade);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
return WillPopScope(
|
||||
onWillPop:()async=>await back(),
|
||||
child: Scaffold(
|
||||
appBar: AppBarCustom().appbar(context, 'CADASTRO'),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(Dimensoes.width*0.15),
|
||||
@@ -341,9 +355,15 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
||||
colorBorder: PaletaCores.corPrimaria,
|
||||
onPressed: ()=>verificacaoSMS(),
|
||||
):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