Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

setstate - Flutter Future Builder not showing

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(),
);
  
question from:https://stackoverflow.com/questions/65855066/flutter-future-builder-not-showing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...