I have been working on flutter project which lists json api from an end point since i have large data i could not load all of them so i used lazy loading works perfect also i enabled searching future with query it also works fine.But i used a boolean value to check whether the user is searching or not so i can switch future builders to display data. But when i search i got the proper search result but list is not displaying thanks
Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
centerTitle: true,
title:appBarTitle,
actions: <Widget>[
new IconButton(icon: actionIcon,onPressed:(){
setState(() {
if ( this.actionIcon.icon == Icons.search){
this.actionIcon = new Icon(Icons.close);
this.appBarTitle = new TextField(
style: new TextStyle(
color: Colors.white,
),
decoration: new InputDecoration(
prefixIcon: new Icon(Icons.search,color: Colors.white),
hintText: "Search...",
hintStyle: new TextStyle(color: Colors.white)
),
controller: searchController,
onTap: ()
{
print('Tapped');
},
);}
else {
this.actionIcon = new Icon(Icons.search);
this.appBarTitle = new Text("");
}
});
} ,),]
),
body: isSearching ? buildFutureBuilder2():buildFutureBuilder1(),
);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…