-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Looking at the documentation of kDefaultIconLightColor and kDefaultIconDarkColor, here
| const Color kDefaultIconLightColor = Colors.white; |
and here
| const Color kDefaultIconDarkColor = Colors.black87; |
and then comparing to usage in ThemeData in
| iconTheme ??= isDark ? const IconThemeData(color: kDefaultIconLightColor) : const IconThemeData(color: kDefaultIconDarkColor); |
We can observe that the usage roles of kDefaultIconLightColor and kDefaultIconDarkColor are used in a reverse manner in ThemeData compared to what is described in their respective documentation comments.
Expected results
Expect documentation to state:
kDefaultIconLightColoris the default color forThemeData.iconThemewhenThemeData.brightnessisBrightness.darkkDefaultIconDarkColorthe default color forThemeData.iconThemewhenThemeData.brightnessisBrightness.light
We expect this because of how the values are used here:
| iconTheme ??= isDark ? const IconThemeData(color: kDefaultIconLightColor) : const IconThemeData(color: kDefaultIconDarkColor); |
Where we can see that kDefaultIconLightColor is used when brightness is dark and kDefaultIconDarkColor is used when brightness is not dark, ie when it is light.
Actual results
The documentation actually states for kDefaultIconLightColor:
kDefaultIconLightColoris the default color forThemeData.iconThemewhenThemeData.brightnessisBrightness.light
Seen here:
| /// [Brightness.light]. This color is used in [IconButton] to detect whether |
And for kDefaultIconDarkColor, it states:
kDefaultIconDarkColorthe default color forThemeData.iconThemewhenThemeData.brightnessisBrightness.dark.
Seen here:
| /// [Brightness.dark]. This color is used in [IconButton] to detect whether |
Which as shown is not how these constants are used in the actual ThemeData code.
Flutter Doctor output
Doctor output
flutter doctor -v
[!] Flutter (Channel master, 3.12.0-15.0.pre.57, on macOS 13.4.1 22F82 darwin-arm64, locale en-US)
• Flutter version 3.12.0-15.0.pre.57 on channel master at
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3ec96a8a4a (6 hours ago), 2023-07-09 08:57:27 -0400
• Engine revision 111051e4f5
• Dart version 3.1.0 (build 3.1.0-285.0.dev)
• DevTools version 2.25.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
• 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.79.2)
• 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.198
[✓] Network resources
• All expected network resources are available.