-
-
Notifications
You must be signed in to change notification settings - Fork 201
fix: respect sidebar decoration color in macos window (#587) #588
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -195,18 +195,15 @@ class _MacosWindowState extends State<MacosWindow> { | |||||||||||||
| } | ||||||||||||||
| final MacosThemeData theme = MacosTheme.of(context); | ||||||||||||||
| late Color backgroundColor = widget.backgroundColor ?? theme.canvasColor; | ||||||||||||||
| late Color sidebarBackgroundColor; | ||||||||||||||
| late Color? sidebarBackgroundColor; | ||||||||||||||
| late Color endSidebarBackgroundColor; | ||||||||||||||
| Color dividerColor = theme.dividerColor; | ||||||||||||||
|
|
||||||||||||||
| final isMac = !kIsWeb && defaultTargetPlatform == TargetPlatform.macOS; | ||||||||||||||
|
|
||||||||||||||
| // Respect the sidebar color override from parent if one is given | ||||||||||||||
| if (sidebar?.decoration?.color != null) { | ||||||||||||||
| sidebarBackgroundColor = sidebar!.decoration!.color!; | ||||||||||||||
| } else { | ||||||||||||||
| sidebarBackgroundColor = MacosColors.transparent; | ||||||||||||||
| } | ||||||||||||||
| sidebarBackgroundColor = | ||||||||||||||
| sidebar?.decoration?.color ?? (kIsWeb ? theme.canvasColor : null); | ||||||||||||||
|
|
||||||||||||||
| // Set the application window's brightness on macOS | ||||||||||||||
| MacOSBrightnessOverrideHandler.ensureMatchingBrightness(theme.brightness); | ||||||||||||||
|
|
@@ -273,7 +270,7 @@ class _MacosWindowState extends State<MacosWindow> { | |||||||||||||
| ).normalize(), | ||||||||||||||
| child: kIsWeb | ||||||||||||||
| ? ColoredBox( | ||||||||||||||
| color: theme.canvasColor, | ||||||||||||||
| color: sidebarBackgroundColor ?? theme.canvasColor, | ||||||||||||||
| child: Column( | ||||||||||||||
| children: [ | ||||||||||||||
| // If an app is running on macOS, apply | ||||||||||||||
|
|
@@ -326,10 +323,12 @@ class _MacosWindowState extends State<MacosWindow> { | |||||||||||||
| : TransparentMacOSSidebar( | ||||||||||||||
| state: sidebarState, | ||||||||||||||
| child: DecoratedBox( | ||||||||||||||
| decoration: const BoxDecoration( | ||||||||||||||
| color: Color.fromRGBO(0, 0, 0, 1.0), | ||||||||||||||
| backgroundBlendMode: BlendMode.clear, | ||||||||||||||
| ), | ||||||||||||||
| decoration: | ||||||||||||||
| (sidebar.decoration ?? const BoxDecoration()) | ||||||||||||||
| .copyWith( | ||||||||||||||
| // Only paint if the caller set a color; null preserves native transparency. | ||||||||||||||
| color: sidebarBackgroundColor, | ||||||||||||||
| ), | ||||||||||||||
|
Comment on lines
+327
to
+331
|
||||||||||||||
| (sidebar.decoration ?? const BoxDecoration()) | |
| .copyWith( | |
| // Only paint if the caller set a color; null preserves native transparency. | |
| color: sidebarBackgroundColor, | |
| ), | |
| sidebar.decoration ?? const BoxDecoration(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change introduces new sidebar background behavior across platforms (transparent on macOS unless
Sidebar.decoration.coloris set;theme.canvasColoron web). Sincetest/layout/window_test.dartalready coversMacosWindow/Sidebar, it would be good to add a widget test asserting the expected background paint behavior for (1) no decoration color vs (2) a provided decoration color, to prevent regressions like the black strip issue.