From 1b6711277e2e2ad915970d96ccfc99d3a5ac283c Mon Sep 17 00:00:00 2001 From: Anthony <591699+clocksmith@users.noreply.github.com> Date: Wed, 29 Apr 2020 12:39:03 -0400 Subject: [PATCH] Fix default opacity assignments for unselected and selected icons in NavigationRail (#55902) --- packages/flutter/lib/src/material/navigation_rail.dart | 8 ++++---- .../flutter/test/material/navigation_rail_theme_test.dart | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/flutter/lib/src/material/navigation_rail.dart b/packages/flutter/lib/src/material/navigation_rail.dart index a31a72c369..79ecd93e63 100644 --- a/packages/flutter/lib/src/material/navigation_rail.dart +++ b/packages/flutter/lib/src/material/navigation_rail.dart @@ -441,20 +441,20 @@ class _NavigationRailState extends State with TickerProviderStat final double minWidth = widget.minWidth ?? _minRailWidth; final double minExtendedWidth = widget.minExtendedWidth ?? _minExtendedRailWidth; final Color baseSelectedColor = theme.colorScheme.primary; - final Color baseColor = theme.colorScheme.onSurface.withOpacity(0.64); + final Color baseUnselectedColor = theme.colorScheme.onSurface.withOpacity(0.64); final IconThemeData defaultUnselectedIconTheme = widget.unselectedIconTheme ?? navigationRailTheme.unselectedIconTheme; final IconThemeData unselectedIconTheme = IconThemeData( size: defaultUnselectedIconTheme?.size ?? 24.0, color: defaultUnselectedIconTheme?.color ?? theme.colorScheme.onSurface, - opacity: defaultUnselectedIconTheme?.opacity ?? 1.0, + opacity: defaultUnselectedIconTheme?.opacity ?? 0.64, ); final IconThemeData defaultSelectedIconTheme = widget.selectedIconTheme ?? navigationRailTheme.selectedIconTheme; final IconThemeData selectedIconTheme = IconThemeData( size: defaultSelectedIconTheme?.size ?? 24.0, color: defaultSelectedIconTheme?.color ?? theme.colorScheme.primary, - opacity: defaultSelectedIconTheme?.opacity ?? 0.64, + opacity: defaultSelectedIconTheme?.opacity ?? 1.0, ); - final TextStyle unselectedLabelTextStyle = theme.textTheme.bodyText1.copyWith(color: baseColor).merge(widget.unselectedLabelTextStyle ?? navigationRailTheme.unselectedLabelTextStyle); + final TextStyle unselectedLabelTextStyle = theme.textTheme.bodyText1.copyWith(color: baseUnselectedColor).merge(widget.unselectedLabelTextStyle ?? navigationRailTheme.unselectedLabelTextStyle); final TextStyle selectedLabelTextStyle = theme.textTheme.bodyText1.copyWith(color: baseSelectedColor).merge(widget.selectedLabelTextStyle ?? navigationRailTheme.selectedLabelTextStyle); final double groupAlignment = widget.groupAlignment ?? navigationRailTheme.groupAlignment ?? -1.0; final NavigationRailLabelType labelType = widget.labelType ?? navigationRailTheme.labelType ?? NavigationRailLabelType.none; diff --git a/packages/flutter/test/material/navigation_rail_theme_test.dart b/packages/flutter/test/material/navigation_rail_theme_test.dart index ca2f02fa54..e61303054d 100644 --- a/packages/flutter/test/material/navigation_rail_theme_test.dart +++ b/packages/flutter/test/material/navigation_rail_theme_test.dart @@ -29,10 +29,10 @@ void main() { expect(_railMaterial(tester).elevation, 0); expect(_selectedIconTheme(tester).size, 24.0); expect(_selectedIconTheme(tester).color, ThemeData().colorScheme.primary); - expect(_selectedIconTheme(tester).opacity, 0.64); + expect(_selectedIconTheme(tester).opacity, 1.0); expect(_unselectedIconTheme(tester).size, 24.0); expect(_unselectedIconTheme(tester).color, ThemeData().colorScheme.onSurface); - expect(_unselectedIconTheme(tester).opacity, 1.0); + expect(_unselectedIconTheme(tester).opacity, 0.64); expect(_selectedLabelStyle(tester).fontSize, 14.0); expect(_unselectedLabelStyle(tester).fontSize, 14.0); expect(_destinationsAlign(tester).alignment, Alignment.topCenter);