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

🐛 Flyout can no longer be used in conjunction with PaneItemAction #743

Closed
klondikedragon opened this issue Feb 19, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@klondikedragon
Copy link
Contributor

Describe the bug
Before upgrading to a version with #714, I was successfully using a Flyout menu in conjunction with PaneItemAction. When I attempt to do this now, when attempting to open the flyout menu in the onTap callback of the PaneItemAction, the flyout controller throws an exception saying that it's not currently attached to a flyout target.

To Reproduce
An edit of the example app that reproduces this is here:
https://github.com/klondikedragon/fluent_ui/tree/reproduce-navbar-flyout-issue

Essentially, edit the example app, editing main.dart as follows:

  • Add final testFlyoutController = FlyoutController(); to the _MyHomePageState class definition.
  • In the build method of the same class, instead of using footerItems: footerItems, we extend the footer items with a test PaneActionItem that demonstrates the problem:
        footerItems: footerItems
          ..addAll([
            PaneItemAction(
              icon: FlyoutTarget(
                controller: testFlyoutController,
                child: const Icon(FluentIcons.questionnaire),
              ),
              title: const Text('test flyout action'),
              onTap: () async {
                testFlyoutController.showFlyout(
                  builder: (context) => const Text('some flyout content!'),
                );
              },
            ),
          ]),

Now if you click the pane action item, it throws an assertion:

_AssertionError ('package:fluent_ui/src/controls/flyouts/flyout.dart': Failed assertion: line 473 pos 12: 'isAttached': This controller must be attached to a FlyoutTarget)

Expected behavior
It should show a flyout (e.g. could be a popup menu with additional choices).

Additional context
I'm running Flutter 3.7.3 on stable channel in case it matters.

@bdlukaa bdlukaa added the bug Something isn't working label Feb 19, 2023
@klondikedragon
Copy link
Contributor Author

@bdlukaa thanks the fix works!

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

No branches or pull requests

2 participants