-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
The default color of the icon on a selected item in NavigationDrawer does not follow Material3 spec.
Based on published spec the color should in Flutter be ColorScheme.onSecondaryContainer.
See: https://m3.material.io/components/navigation-drawer/specs

Expected results
Expect defaults to use
@override
MaterialStateProperty<IconThemeData?>? get iconTheme {
return MaterialStateProperty.resolveWith((Set<MaterialState> states) {
return IconThemeData(
size: 24.0,
color: states.contains(MaterialState.selected)
? _colors.onSecondaryContainer
: _colors.onSurfaceVariant,
);
});
}Actual results
The actual implementation is:
@override
MaterialStateProperty<IconThemeData?>? get iconTheme {
return MaterialStateProperty.resolveWith((Set<MaterialState> states) {
return IconThemeData(
size: 24.0,
color: states.contains(MaterialState.selected)
? null
: _colors.onSurfaceVariant,
);
});
}See:
| ? null |
Since it uses a default IconThemeData with null color, the default via ThemeData for that will be Colors.black87 in light mode and Colors.white in dark mode.
Code sample
No runnable sample needed. This error can be seen comparing spec and actual current code implementation. They differ. I'm assuming the WEB M3 spec is correct and Flutter's implementation is wrong.
It can also be noted that that small selected item indicator in NavigationBar and NavigationRail use the same selected icon color ColorScheme.onSecondaryContainer in the Material 3 spec. These are correctly implemented in Flutter, only the NavigationDrawer case deviates from the spec.
Flutter Doctor output
Used version: Channel master, 3.12.0-10.0.pre.41
Doctor output
flutter doctor -v
[!] Flutter (Channel master, 3.12.0-10.0.pre.41, on macOS 13.4.1 22F82 darwin-arm64, locale en-US)
• Flutter version 3.12.0-10.0.pre.41 on channel master at /Users/rydmike/fvm/versions/master
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c8e42b47f5 (79 minutes ago), 2023-06-26 19:19:02 +0300
• Engine revision debee7cece
• Dart version 3.1.0 (build 3.1.0-246.0.dev)
• DevTools version 2.24.0
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform
update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/rydmike/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
[✓] IntelliJ IDEA Community Edition (version 2023.1.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 74.0.4
• Dart plugin version 231.9161.14
[✓] VS Code (version 1.77.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.62.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.4.1 22F82 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.133
[✓] Network resources
• All expected network resources are available.Metadata
Metadata
Assignees
Labels
Type
Projects
Status