mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Fix default opacity assignments for unselected and selected icons in NavigationRail (#55902)
This commit is contained in:
parent
4dd3435b78
commit
1b6711277e
@ -441,20 +441,20 @@ class _NavigationRailState extends State<NavigationRail> 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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user