Skip to content

🐛 MenuFlyout is immediately closed on iOS #1326

Description

@jacksonb-cs

Describe the bug
Attempting to use a FlyoutController to show a MenuFlyout does not work on iOS. You can occasionally see what I believe is the flyout appearing for a frame or two before going away. Otherwise, a button that shows a MenuFlyout usually looks like it isn't showing any flyout at all. The flyout controller can show other widgets as flyouts (e.g., just a Text).

Additional context
MenuFlyout works just fine on Windows, Android, Web, and MacOS (I have verified with the snippet below).

To Reproduce
Snippet to reproduce:

import 'package:fluent_ui/fluent_ui.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MainApp());
}

class MainApp extends StatelessWidget {
  MainApp({super.key});

  final controller = FlyoutController();

  @override
  Widget build(BuildContext context) {
    return FluentApp(
      home: ScaffoldPage(
        content: Center(
          child: FlyoutTarget(
            controller: controller,
            child: IconButton(
              icon: Icon(FluentIcons.activity_feed),
              onPressed: () {
                controller.showFlyout(
                  builder: (context) {
                    // TODO: Uncomment to see this work fine.
                    // return Text('This works fine');

                    return MenuFlyout(
                      items: [
                        MenuFlyoutItem(
                          text: Text('Option 1'),
                          onPressed: () {
                            print('Option 1 - pressed');
                          },
                        ),
                      ],
                    );
                  },
                );
              },
            ),
          ),
        ),
      ),
    );
  }
}

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