Reputation: 13
So I have one parent statefulwidget that contains a TabBarView. The child to this tabbarview are two different child statefulwidgets.
What I want to achieve is that if I press a button in one of those child statefulwidgets, it should animate the tabcontroller and also set state in the parent statefulwidget.
How to do that? Thanks
Upvotes: 0
Views: 538
Reputation: 448
I think it will solve your problm
https://medium.com/flutter-community/flutter-communication-between-widgets-f5590230df1e
Upvotes: 0
Reputation: 179
have a look at the below link Let the parent widget manages the widget’s state
Upvotes: 0
Reputation: 705
You need to create a function in the parent widget which changes the tab and sets the state, and then pass that as a parameter to the children widgets and call it when needed.
Upvotes: 1