Skip to content

Commit

Permalink
Fix MacosPulldownButton menu panel appearance to better match MacOS 15.x
Browse files Browse the repository at this point in the history
  • Loading branch information
driftwoodstudio committed Mar 1, 2025
1 parent 4da96e4 commit b828655
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 12 deletions.
11 changes: 9 additions & 2 deletions lib/src/buttons/pulldown_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,15 @@ class _MacosPulldownMenuState extends State<_MacosPulldownMenu> {
child: IntrinsicWidth(
child: MacosOverlayFilter(
color: MacosPulldownButtonTheme.of(context)
.pulldownColor
?.withValues(alpha: 0.25),
.pulldownColor
// BP CHANGE
// REPLACE
// ?.withValues(alpha: 0.25),
// WITH
?.withValues(alpha: 0.85),
// REASON: lightening default dark color at MacosThemeData.pulldownColor init
// makes lightening here via super-low alpha unnecessary, thereby eliminating
// the non-macOS-15.x severe transparency effect.
borderRadius: _kBorderRadius,
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand Down
9 changes: 8 additions & 1 deletion lib/src/layout/toolbar/toolbar_overflow_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ class ToolbarOverflowMenu extends StatelessWidget {
child: MacosOverlayFilter(
color: MacosPulldownButtonTheme.of(context)
.pulldownColor
?.withValues(alpha: 0.25),
// BP CHANGE THIS
// REPLACE
// ?.withValues(alpha: 0.25),
// WITH
?.withValues(alpha: 0.85),
// REASON: lightening default dark color at MacosThemeData.pulldownColor init
// makes lightening here via super-low alpha unnecessary, thereby eliminating
// the non-macOS-15.x severe transparency effect.
borderRadius: _kBorderRadius,
child: Padding(
padding: const EdgeInsets.all(6.0),
Expand Down
10 changes: 10 additions & 0 deletions lib/src/theme/macos_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,16 @@ class MacosColors {
darkColor: Color.fromRGBO(255, 255, 255, 0.1),
);

// BP CHANGE
// ADD
// Text color for pulldown menus (e.g. ToolBarPullDownButton)
// (these colors derived from light/dark toolbar pulldown menus in Apple Pages app)
static const pulldownMenuTextColor = CupertinoDynamicColor.withBrightness(
color: Color.fromRGBO(37, 37, 37, 1.0),
darkColor: Color.fromRGBO(229, 229, 229, 1.0),
);
// END

/// The accent color selected by the user in system preferences.
///
/// No dark variant.
Expand Down
13 changes: 11 additions & 2 deletions lib/src/theme/macos_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,17 @@ class MacosThemeData extends Equatable with Diagnosticable {
? const Color.fromRGBO(255, 255, 255, 0.247)
: const Color.fromRGBO(255, 255, 255, 1),
pulldownColor: isDark
? const Color.fromRGBO(30, 30, 30, 1)
: const Color.fromRGBO(242, 242, 247, 1),
// BP CHANGE
// REPLACE
// ? const Color.fromRGBO(30, 30, 30, 1)
// : const Color.fromRGBO(242, 242, 247, 1),
// WITH
? const Color.fromRGBO(80, 80, 80, 1)
: const Color.fromRGBO(235, 235, 235, 1),
// REASON: dark color is much too dark, and requires ligtening with a very-low
// alpha value that gives the result a severely non-macOS-15.x transparency
// effect for pulldown menu panes.
// Change requires darkening light color to match MacOS-15.x appearance.
iconColor: isDark
? const Color.fromRGBO(255, 255, 255, 0.7)
: const Color.fromRGBO(0, 0, 0, 0.7),
Expand Down
30 changes: 23 additions & 7 deletions lib/src/theme/overlay_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ class MacosOverlayFilter extends StatelessWidget {
CupertinoColors.systemGrey.color,
CupertinoColors.black,
)
.withValues(alpha: 0.25),
// BP CHANGE
// REPLACE
// .withValues(alpha: 0.25),
// WITH
.withValues(alpha: 0.15),
// REASON: shadow density is excessive. Lighter is closer to mac OS.
offset: const Offset(0, 4),
spreadRadius: 4.0,
blurRadius: 8.0,
Expand All @@ -67,13 +72,24 @@ class MacosOverlayFilter extends StatelessWidget {
),
child: ClipRRect(
borderRadius: borderRadius,
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 20.0,
sigmaY: 20.0,
),

// BP CHANGE
// REPLACE
// child: BackdropFilter(
// filter: ImageFilter.blur(
// sigmaX: 20.0,
// sigmaY: 20.0,
// ),
// child: child,
// ),
// WITH
child: child,
),
// REASON: this blur is insane, and nothing like actual mac appearance in 15.x
// Is this a leftover from an earlier macos "glassy" appearance standard?
// The blur severely severely alters the pulldown menu panel appearance from
// macOS 15.x appearance in Apple's apps (pages, etc).
// Does not belong if standard is "look like 15.x"

),
),
);
Expand Down

0 comments on commit b828655

Please sign in to comment.