Reputation: 173
I am implementing a design in which I have to use two ExpansionTiles next to each other, I have implemented the two ExpansionTiles with the required data inserted, but I need to be able to Expand/ Collapse both of them together if I clicked on one of them. Right now they are Expanding/ Collapsing separately without any issue, but I need them to be connected to each other any time the user tries to Expand/ Collapse any of them.
Can I achieve this on flutter?
Upvotes: 0
Views: 230
Reputation: 302
Yes you can achieve this by-
declare a bool type variable with false value. pass this variable to isExpanded property for both ExpansionTile Write following code for each ExpansionTile's onExpansionChanged method:
setState(() {
<var_name here> = v;
}) ;
Upvotes: 1