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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 When the MenuFlyoutItem in MenuFlyout is clicked, Flyout automatically disappears and cannot be controlled. #1016

Open
hcanyz opened this issue Jan 25, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@hcanyz
Copy link

hcanyz commented Jan 25, 2024

Describe the bug

FlyoutTarget(
  controller: menuController,
  child: Button(
    child: const Text('Options'),
    onPressed: () {
      menuController.showFlyout(
        builder: (context) {
          return MenuFlyout(items: [
            MenuFlyoutItem(
              leading: const Icon(FluentIcons.share),
              text: const Text('Share'),
              onPressed: () {
                // Flyout.of(context).close
              },
            ),
          ]);
        },
      );
    },
  ),
)

Here is an example of mine where the Flayout disappears when Share is clicked. But I didn't call Flyout.of(context).close.

Through the code, I saw that MenuFlyoutItem called Navigator.of(context).maybePop(); in onPressed when build

image

When using MenuFlyoutItem in DropDownButton, a closeAfterClick parameter controls whether to close FLayout.

image
image

Why don't we put closeAfterClick in the MenuFlyoutItem parameter?

@hcanyz
Copy link
Author

hcanyz commented Jan 25, 2024

This also caused incorrect behavior when the MenuFlyoutSubItem parameter showBehavior was set to SubItemShowBehavior.press.

FLayout disappears after clicking MenuFlyoutSubItem.

@bdlukaa bdlukaa added the enhancement New feature or request label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants