0

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

3 Answers3

1

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.

Ali Alizadeh
  • 687
  • 8
  • 16
0

have a look at the below link Let the parent widget manages the widget’s state

MoAshour
  • 181
  • 2
0

I think it will solve your problm

https://medium.com/flutter-community/flutter-communication-between-widgets-f5590230df1e

Habib ur Rehman
  • 438
  • 3
  • 12