macos_ui icon indicating copy to clipboard operation
macos_ui copied to clipboard

Adjust colors based on window focus, like native apps

Open GroovinChip opened this issue 2 years ago • 6 comments
trafficstars

Image

This will involve either using the desktop_lifecycle plugin or writing our own.

I've attempted this with desktop_lifecycle and it works quite well.

We'll need to add a dynamic color to MacosColors to represent inactive colors for the sidebar and toolbar (both use the same), and a style in MacosTypography that colors inactive text in the sidebar and toolbar. We'll also need inactive icon colors, and a utility to darken the primary color where appropriate.

We will need to determine whether to check if the window is active in each widget that needs to be adjusted, or do it top-level (like in MacosApp) and propagate the result of the check through the widget tree via MacosThemeData or another InheritedWidget.

GroovinChip avatar Mar 21 '23 15:03 GroovinChip

macos_window_utils’s NSWindowDelegate can also be used to detect window focus events and since we’ll already be depending on that, it might be a better idea to use that, instead (assuming cross-platform support isn’t targetted, of course).

EDIT: That said, macos_window_utils uses NSWindowDelegate while desktop_lifecycle uses NotificationCenter, so perhaps desktop_lifecycle might be a better choice compatibility-wise.

EDIT 2: Nevermind the first edit, we are already using NSWindowDelegate anyway because we need NSAppPresentationOptions, so the compatibility argument doesn’t actually hold.

Adrian-Samoticha avatar Mar 25 '23 11:03 Adrian-Samoticha

and Please add widgets equivalent to material InkWell Widget.

InkWell widget provides focus visual change and mouse hover effects. Macos UI's ListTile can't get focus. Material's ListTile is built on based on InkWell then can get focus.

Thx.

glanium avatar Mar 28 '23 13:03 glanium

and Please add widgets equivalent to material InkWell Widget.

InkWell widget provides focus visual change and mouse hover effects.

Macos UI's ListTile can't get focus.

Material's ListTile is built on based on InkWell then can get focus.

Thx.

Please file a new issue for this, as it is not connected to this.

GroovinChip avatar Mar 28 '23 13:03 GroovinChip

Ok Done. https://github.com/macosui/macos_ui/issues/399 Thx.

glanium avatar Mar 28 '23 13:03 glanium

It works with the system's accent color:

SCR-20231207-meta SCR-20231207-mevn

ralph-bergmann avatar Dec 07 '23 12:12 ralph-bergmann

It works with the system's accent color:

It works with widgets that have the accent color already implemented. Currently, that only includes the buttons and the sidebar items, once #484 is merged.

Adrian-Samoticha avatar Dec 07 '23 12:12 Adrian-Samoticha