flutter-expandable
flutter-expandable copied to clipboard
Remember if the panel was expanded.
Hello,
I'd like to know how to tell my app when a panel was expanded/collapsed (eg change a variable) so that I can keep track of which were closed/open to reopen them when my app launches next time.
Thank you for this great package by the way.
maybe you can use provider
or shared_preference
to store global values
Best way to do as following for now
bool isExpanded = false;
late ExpandableController _controller;
@override
void initState() {
super.initState();
_controller = ExpandableController(initialExpanded: false);
_controller.addListener(() {
setState(() {
isExpanded = !isExpanded;
});
});
}
Then just use _controller.toggle()
which will cause addListener
to trigger