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

🐛 Opening one expander opens all of them (intended?) #596

Closed
mcquenji opened this issue Nov 4, 2022 · 5 comments · Fixed by #609
Closed

🐛 Opening one expander opens all of them (intended?) #596

mcquenji opened this issue Nov 4, 2022 · 5 comments · Fixed by #609
Labels
bug Something isn't working

Comments

@mcquenji
Copy link

mcquenji commented Nov 4, 2022

Describe the bug
Opening a single expander widget opens every other expander when changing route. Is this intended?

To Reproduce
Steps to reproduce the behavior:

  1. Go to the fluent_ui example page
  2. Open any expander
  3. Change the route via sidebar
  4. Watch all expanders open

Expected behavior
Expanders stay closed.

Screenshots
image
image
image

Additional context
The identifier for page storage seems to be at fault (if this is not intended) at fluent_ui/lib/src/controls/surfaces/expander.dart:180

PageStorage.of(context)?.writeState(
  context,
  open,
  identifier: 'expanderOpen', // Not unique to the specific expander widget
);

and fluent_ui/lib/src/controls/surfaces/expander.dart:143

_open = PageStorage.of(context)?.readState(
          context,
          identifier: 'expanderOpen', // Not unique to the specific expander widget
        ) as bool? ??
        widget.initiallyExpanded;
@bdlukaa bdlukaa added the bug Something isn't working label Nov 5, 2022
@mcquenji
Copy link
Author

mcquenji commented Nov 9, 2022

An option would be to use the key as identifier and don't store open state if none is provided.

Or do you want to store open state regardless of the key?

@ricard-v
Copy link

I can confirm this issue and I have arrived at the same conclusion. Is there a way to solve that while waiting a fix ?

@mcquenji
Copy link
Author

mcquenji commented Nov 13, 2022

I forked the repo, removed the page storage stuff, and used dependency_overrides section in pubspec.yaml.

As I've already done it, you can go ahead and use my fork:

dependency_overrides:
  fluent_ui:
    git:
      url: https://github.com/bmceachnie/fluent_ui.git

@ricard-v
Copy link

ricard-v commented Nov 13, 2022

I forked the repo, removed the page storage stuff, and used dependency_overrides section in pubspec.yaml.

As I've already done it, you can go ahead and use my fork:

dependency_overrides:
  fluent_ui:
    git:
      url: https://github.com/bmceachnie/fluent_ui.git

Thanks for providing a fork and a way to use it (I did not know how to) 👍 .

I took a quick look at your code and as you said, you did remove the code related to writing & reading the opened state. That being said, I was wondering if there is still a way to use keys (something I am not knowledgeable about) or if PageStorage could still be used? Or perhaps both?

@mcquenji
Copy link
Author

To my understanding, it'd be possible to use the key as an identifier instead of the hardcoded string expanderOpen.

If you need it, I could implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants