Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember if the panel was expanded. #116

Open
emmggi opened this issue Feb 6, 2022 · 2 comments
Open

Remember if the panel was expanded. #116

emmggi opened this issue Feb 6, 2022 · 2 comments

Comments

@emmggi
Copy link

emmggi commented Feb 6, 2022

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.

@guchengxi1994
Copy link

maybe you can use provider or shared_preference to store global values

@hawkeye-sama
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants