leanflutter / tray_manager

This plugin allows Flutter desktop apps to defines system tray.
https://pub.dev/packages/tray_manager
MIT License
230 stars 36 forks source link

Demo code not compilable #27

Closed codemonza closed 2 years ago

codemonza commented 2 years ago

Fail to compile code from the Usage section demo. The trayManager.setContextMenu() function is expecting 'Menu' type as parameter. The demo is passing in List.

List items = [ MenuItem( key: 'show_window', label: 'Show Window', ), MenuItem.separator(), MenuItem( key: 'quit_app', label: 'Quit', ), ]; await trayManager.setContextMenu(items);

Errors: List items Type: List

The argument type 'List' can't be assigned to the parameter type 'Menu'.dartargument_type_not_assignable

codemonza commented 2 years ago

Changing to the following will fix the issue. I could create a PR if this is ok.

List items = [ MenuItem( key: 'show_window', label: 'Show Window', ), MenuItem.separator(), MenuItem( key: 'quit_app', label: 'Quit', ), ];

Menu menu = Menu(items: items);
await trayManager.setContextMenu(menu);