macosui / macos_ui

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

MacosWindowScope not available further down tree #498

Open jocubeit opened 10 months ago

jocubeit commented 10 months ago

I'm trying to add sidebar toggling from a PlatformMenuItem, nested in a PlatformMenuGroup, nested in a PlatformMenuBar which is a child of MacosWindow.

I get the following error:

No MacosWindowScope found in context 'package:macos_ui/src/layout/window.dart'

It seems to MacosWindowScope is not present several widgets down the tree in the PlatformMenuItem.

I tried settings a GlobalKey for both MacosWindow, and the Sidebar widgets, but can't seem to access the isSidebarShown property nor the toggleSidebar() method.

I'm wondering how I can toggle the sidebar from a system menu provided by PlatformMenu.

jocubeit commented 9 months ago

Closed this by accident, it's still an issue for me.