Kartik Gupta
Kartik Gupta

Reputation: 1

How to update dynamic DefaultTabController widget on checking some checkboxes in Flutter app

I am working on a Flutter app where I have a DefaultTabController widget set up with a dynamic number of tabs. I want to update the tab screen content dynamically. I have a list of data which is fetched from the firestore database, according to that I have to create tabs on that screen and list the items on each tab. The tabs are the date like 2nd May, 3rd May, 4th May etc. and the list of data are displayed according to there date in there respective tabs, like 2nd May's data will be shown in 2nd May tab only. Also, these date tabs are showed as per the data, like if there are 10 entries in the database and they belongs to only few dates like 10th April, 11th April and 12th April, then these 3 tabs will be created.

Now, I am adding a filter functionality which will filter these list of data, and the data should be changed/updated on a real time on that screen without reloading. Like that list should be changes which was displayed on the tab screen. So, how I can achieve this in my dynamic tab view screen.

I have tried it like this, after adding any filter I just clear the tabs and tabs data and then rerender the tabs and data after a short gap of 500 milliseconds. So, by this way its working but this is not a good way to update the data.

Upvotes: 0

Views: 31

Answers (0)

Related Questions