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);
|
||||||
|
tentativas = tentativas + 1;
|
||||||
if(tentativas <=3){
|
if(tentativas <=3){
|
||||||
tentativas = tentativas + 1;
|
|
||||||
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);
|
||||||
|
tentativas = tentativas + 1;
|
||||||
if(tentativas <=3){
|
if(tentativas <=3){
|
||||||
tentativas = tentativas + 1;
|
|
||||||
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,123 +237,131 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
|||||||
cidades.add(Fixos().listCidades[i].cidade);
|
cidades.add(Fixos().listCidades[i].cidade);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return WillPopScope(
|
||||||
appBar: AppBarCustom().appbar(context, 'CADASTRO'),
|
onWillPop:()async=>await back(),
|
||||||
body: Container(
|
child: Scaffold(
|
||||||
padding: EdgeInsets.all(Dimensoes.width*0.15),
|
appBar: AppBarCustom().appbar(context, 'CADASTRO'),
|
||||||
width: Dimensoes.width,
|
body: Container(
|
||||||
height: Dimensoes.height,
|
padding: EdgeInsets.all(Dimensoes.width*0.15),
|
||||||
alignment: Alignment.center,
|
width: Dimensoes.width,
|
||||||
child: carregando?Center(
|
height: Dimensoes.height,
|
||||||
child: Column(
|
alignment: Alignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: carregando?Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextCustom(text: 'VALIDANDO DADOS ...\n AGUARDE ALGUNS SEGUNDOS !',maxLines: 2,textAlign: TextAlign.center,),
|
||||||
|
SizedBox(height: 30,),
|
||||||
|
CircularProgressIndicator(color: PaletaCores.corPrimaria,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
):ListView(
|
||||||
children: [
|
children: [
|
||||||
TextCustom(text: 'VALIDANDO DADOS ...\n AGUARDE ALGUNS SEGUNDOS !',maxLines: 2,textAlign: TextAlign.center,),
|
Container(
|
||||||
SizedBox(height: 30,),
|
child: Image.asset("assets/images/logoEduca.png",width:Dimensoes.width * 0.4,height: Dimensoes.height * 0.12)
|
||||||
CircularProgressIndicator(color: PaletaCores.corPrimaria,)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
):ListView(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
child: Image.asset("assets/images/logoEduca.png",width:Dimensoes.width * 0.4,height: Dimensoes.height * 0.12)
|
|
||||||
),
|
|
||||||
smsEnviado?Container():Container(
|
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
|
||||||
child: InputText(
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
CpfInputFormatter(),
|
|
||||||
],
|
|
||||||
textInputType: TextInputType.number,
|
|
||||||
controller: inputCPF,
|
|
||||||
title: 'CPF',
|
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
|
||||||
colorBorder: PaletaCores.branco,
|
|
||||||
),
|
),
|
||||||
),
|
smsEnviado?Container():Container(
|
||||||
smsEnviado?Container():Container(
|
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
|
||||||
child: InputText(
|
|
||||||
inputFormatters: [],
|
|
||||||
obscure: true,
|
|
||||||
controller: inputSenha,
|
|
||||||
title: 'Senha',
|
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
colorBorder: PaletaCores.branco,
|
child: InputText(
|
||||||
),
|
inputFormatters: [
|
||||||
),
|
FilteringTextInputFormatter.digitsOnly,
|
||||||
smsEnviado?Container():Container(
|
CpfInputFormatter(),
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
],
|
||||||
child: InputText(
|
textInputType: TextInputType.number,
|
||||||
inputFormatters: [],
|
controller: inputCPF,
|
||||||
obscure: true,
|
title: 'CPF',
|
||||||
controller: inputRepita,
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
title: 'Repetir Senha',
|
colorBorder: PaletaCores.branco,
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
|
||||||
colorBorder: PaletaCores.branco,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
smsEnviado?Container():Container(
|
|
||||||
width: Dimensoes.width*0.6,
|
|
||||||
child: DropdownButtonHideUnderline(
|
|
||||||
child: DropdownButton(
|
|
||||||
hint: TextCustom(text: 'Cidade'),
|
|
||||||
value: cidade,
|
|
||||||
items: Fixos().listCidades.map((value) => DropdownMenuItem(
|
|
||||||
value: value.cidade,
|
|
||||||
child: TextCustom(
|
|
||||||
text: value.cidade,
|
|
||||||
color: Colors.black54,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
).toList(),
|
|
||||||
onChanged: (value){
|
|
||||||
setState(() {
|
|
||||||
cidade = value!;
|
|
||||||
print(cidades.indexOf(cidade!));
|
|
||||||
cidadeQuery = Fixos().listCidades[cidades.indexOf(cidade!)].cidadeQuery;
|
|
||||||
print(cidadeQuery);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
smsEnviado?Container():Container(
|
||||||
SizedBox(height: 20,),
|
|
||||||
smsEnviado?Container():ButtonCustom(
|
|
||||||
widthCustom: 0.7,
|
|
||||||
heightCustom: 0.07,
|
|
||||||
text: "Cadastrar",
|
|
||||||
fontsize: 14.0,
|
|
||||||
colorText: PaletaCores.branco,
|
|
||||||
colorButton: PaletaCores.corPrimaria,
|
|
||||||
colorBorder: PaletaCores.corPrimaria,
|
|
||||||
onPressed: ()=>verificacao(),
|
|
||||||
),
|
|
||||||
smsEnviado?Container(
|
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
|
||||||
child: InputText(
|
|
||||||
inputFormatters: [
|
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
|
||||||
],
|
|
||||||
textInputType: TextInputType.number,
|
|
||||||
controller: inputCodigo,
|
|
||||||
title: 'Código SMS',
|
|
||||||
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
colorBorder: PaletaCores.branco,
|
child: InputText(
|
||||||
|
inputFormatters: [],
|
||||||
|
obscure: true,
|
||||||
|
controller: inputSenha,
|
||||||
|
title: 'Senha',
|
||||||
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
|
colorBorder: PaletaCores.branco,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
):Container(),
|
smsEnviado?Container():Container(
|
||||||
smsEnviado?ButtonCustom(
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
widthCustom: 0.7,
|
child: InputText(
|
||||||
heightCustom: 0.07,
|
inputFormatters: [],
|
||||||
text: "Enviar",
|
obscure: true,
|
||||||
fontsize: 14.0,
|
controller: inputRepita,
|
||||||
colorText: PaletaCores.branco,
|
title: 'Repetir Senha',
|
||||||
colorButton: PaletaCores.corPrimaria,
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
colorBorder: PaletaCores.corPrimaria,
|
colorBorder: PaletaCores.branco,
|
||||||
onPressed: ()=>verificacaoSMS(),
|
),
|
||||||
):Container(),
|
),
|
||||||
],
|
smsEnviado?Container():Container(
|
||||||
|
width: Dimensoes.width*0.6,
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton(
|
||||||
|
hint: TextCustom(text: 'Cidade'),
|
||||||
|
value: cidade,
|
||||||
|
items: Fixos().listCidades.map((value) => DropdownMenuItem(
|
||||||
|
value: value.cidade,
|
||||||
|
child: TextCustom(
|
||||||
|
text: value.cidade,
|
||||||
|
color: Colors.black54,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
).toList(),
|
||||||
|
onChanged: (value){
|
||||||
|
setState(() {
|
||||||
|
cidade = value!;
|
||||||
|
print(cidades.indexOf(cidade!));
|
||||||
|
cidadeQuery = Fixos().listCidades[cidades.indexOf(cidade!)].cidadeQuery;
|
||||||
|
print(cidadeQuery);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20,),
|
||||||
|
smsEnviado?Container():ButtonCustom(
|
||||||
|
widthCustom: 0.7,
|
||||||
|
heightCustom: 0.07,
|
||||||
|
text: "Cadastrar",
|
||||||
|
fontsize: 14.0,
|
||||||
|
colorText: PaletaCores.branco,
|
||||||
|
colorButton: PaletaCores.corPrimaria,
|
||||||
|
colorBorder: PaletaCores.corPrimaria,
|
||||||
|
onPressed: ()=>verificacao(),
|
||||||
|
),
|
||||||
|
smsEnviado?Container(
|
||||||
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
|
child: InputText(
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.digitsOnly,
|
||||||
|
],
|
||||||
|
textInputType: TextInputType.number,
|
||||||
|
controller: inputCodigo,
|
||||||
|
title: 'Código SMS',
|
||||||
|
width: Dimensoes.width>900? Dimensoes.width * 0.18:Dimensoes.width*0.7,
|
||||||
|
colorBorder: PaletaCores.branco,
|
||||||
|
),
|
||||||
|
):Container(),
|
||||||
|
smsEnviado?ButtonCustom(
|
||||||
|
widthCustom: 0.7,
|
||||||
|
heightCustom: 0.07,
|
||||||
|
text: "Enviar",
|
||||||
|
fontsize: 14.0,
|
||||||
|
colorText: PaletaCores.branco,
|
||||||
|
colorButton: PaletaCores.corPrimaria,
|
||||||
|
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