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

feat: allow customizing MenuButtonBuilder style & position #310

Merged
merged 1 commit into from
Jul 31, 2023
Merged

feat: allow customizing MenuButtonBuilder style & position #310

merged 1 commit into from
Jul 31, 2023

Conversation

jpnurmi
Copy link
Contributor

@jpnurmi jpnurmi commented Jul 31, 2023

Screencast.from.2023-07-31.15-41-35.webm
MaterialApp(
  theme: yaruDark,
  home: Scaffold(
    appBar: AppBar(),
    body: Center(
      child: SizedBox(
        width: 200,
        child: MenuButtonBuilder(
          values: const ['foo', 'bar', 'baz', 'qux'],
          menuPosition: PopupMenuPosition.under,
          menuStyle: const MenuStyle(
            minimumSize: MaterialStatePropertyAll(Size(200, 0)),
            maximumSize: MaterialStatePropertyAll(Size(200, 180)),
            visualDensity: VisualDensity(horizontal: 0, vertical: 0),
          ),
          itemStyle: MenuItemButton.styleFrom(),
          itemBuilder: (context, value, child) => IntrinsicWidth(
            child: YaruTile(
              leading: const Icon(Icons.abc),
              title: Text(value.toString()),
              subtitle: Text(value.toString()),
            ),
          ),
          child: const Text('Hello'),
        ),
      ),
    ),
  ),
)

@jpnurmi jpnurmi requested a review from d-loose July 31, 2023 14:17
Copy link
Member

@d-loose d-loose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks!
LGTM 👍

@jpnurmi jpnurmi merged commit b482711 into canonical:main Jul 31, 2023
11 of 13 checks passed
@jpnurmi jpnurmi deleted the menu-button-style-pos branch July 31, 2023 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants