ajustes para consumir a api das respectivas bases
This commit is contained in:
@@ -10,8 +10,8 @@ import 'package:http/http.dart' as http;
|
||||
import '../widgets/snackBars.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
String acesso;
|
||||
HomeScreen({this.acesso=''});
|
||||
String cidade;
|
||||
HomeScreen({required this.cidade});
|
||||
|
||||
@override
|
||||
State<HomeScreen> createState() => _HomeScreenState();
|
||||
@@ -35,8 +35,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
alunos.clear();
|
||||
String q = inputPesquisa.text.replaceAll(' ', '%20').toUpperCase();
|
||||
// print(q);
|
||||
final url = 'http://192.168.18.2:8000/aluno?NOME=$q';
|
||||
// print(url);
|
||||
final url = 'http://192.168.18.2:8000/aluno?NOME=$q&CIDADE=${widget.cidade}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
var map = json.decode(response.body);
|
||||
if(map==null){
|
||||
@@ -66,7 +66,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
escola: list[i]['NO_RAZAO_SOCIAL']==''||list[i]['NO_RAZAO_SOCIAL']==null?list[i]['NO_FANTASIA']:list[i]['NO_RAZAO_SOCIAL'],
|
||||
serie: list[i]['DESC_SERIE'],
|
||||
turma: list[i]['TURMA'],
|
||||
dados: list[i]
|
||||
dados: list[i],
|
||||
cidade: widget.cidade
|
||||
)
|
||||
);
|
||||
resultadoPesquisa.add(alunos[i]);
|
||||
@@ -122,7 +123,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
|
||||
return widget.acesso==null || widget.acesso == ''?Container():Scaffold(
|
||||
return widget.cidade==null || widget.cidade == ''?Container():Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Row(
|
||||
children: [
|
||||
@@ -130,6 +131,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: Image.asset("assets/images/logoEduca.png",width:width * 0.08,height: height * 0.12)
|
||||
),
|
||||
TextCustom(text: '- PESQUISAR ALUNO',color: Colors.white,),
|
||||
Spacer(),
|
||||
TextCustom(text: widget.cidade,color: Colors.white,)
|
||||
],
|
||||
),
|
||||
backgroundColor: PaletteColors.grey,
|
||||
|
||||
Reference in New Issue
Block a user