简体   繁体   中英

TabBarView dynamic update List

I have multiple TabBarView which generates dynamic Products List

TabBarView(
     controller: categoryTabController,
     children: List<Widget>.generate(categories.length,
               (index) => Products(categories[index])),
         ),

I have another TextField widget and when I type something I would like to update List<Widget> inside TabBarView , with new Products(categories[index])) List content.

TextField( onChanged: (text) {
           // need to update List<Widget> in above TabBarView
          },
       ),

how can I acheive it?

I was able to do so using setState

TextField(
      onChanged: (text) {
        setState(() {
          userSearch = text;
        });
      },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM