macosui / macos_ui

Flutter widgets and themes implementing the current macOS design language.
https://macosui.github.io/macos_ui/#/
MIT License
1.88k stars 183 forks source link

Fix `MacosPulldownMenuItem.onTap` doesn't open alert dialog #520

Closed TahaTesser closed 1 month ago

TahaTesser commented 1 month ago

fixes MacosPulldownMenuItem onTap doesnt call showMacosAlertDialog

Code sample

expand to view the code sample ```dart import 'package:flutter/cupertino.dart'; import 'package:macos_ui/macos_ui.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MacosApp( debugShowCheckedModeBanner: false, home: HomePage(), ); } } class HomePage extends StatelessWidget { const HomePage({super.key}); @override Widget build(BuildContext context) { return MacosScaffold( toolBar: ToolBar( title: const Text('macos_ui'), actions: [ ToolBarPullDownButton( label: 'Actions', icon: CupertinoIcons.ellipsis_circle, tooltipMessage: 'Perform tasks with the selected items', items: [ MacosPulldownMenuItem( label: 'New Folder', title: const Text('New Folder'), onTap: () => showMacosAlertDialog( context: context, builder: (context) => MacosAlertDialog( appIcon: const FlutterLogo(size: 64), title: const Text('Title'), message: const Text('Message'), //horizontalActions: false, primaryButton: PushButton( controlSize: ControlSize.large, onPressed: Navigator.of(context).pop, child: const Text('Label'), ), ), ), ), MacosPulldownMenuItem( label: 'Open', title: const Text('Open'), onTap: () => debugPrint('Opening...'), ), ], ), ], ), ); } } ```

Preview

Screenshot 2024-10-04 at 00 40 39

Pre-launch Checklist

GroovinChip commented 1 month ago

Just gonna run the checks manually since you're a first time contributor

GroovinChip commented 1 month ago

Looks like we've got some failing tests

TahaTesser commented 1 month ago

Looks like we've got some failing tests

For some reason test passes locally with FlutterLogo but not in the CI so i just replaced it.