Skip to content

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

@klondikedragon

Description

@klondikedragon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions