Skip to content

BottomNavigationBarItem title's color is not overriden neither by selectedLabelStyle nor unselectedLabelStyle #64358

@andresemartinez

Description

@andresemartinez

Steps to Reproduce

  1. Run flutter create bug.
  2. Update the files as follows:

main.dart

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  static const bottomNavigationBarTheme = BottomNavigationBarThemeData(
    backgroundColor: Colors.white,
    selectedIconTheme: IconThemeData(
      color: Colors.green,
      size: 24,
    ),
    selectedLabelStyle: TextStyle(
      color: Colors.green,
      fontSize: 12,
    ),
    unselectedIconTheme: IconThemeData(
      color: Colors.lightGreen,
      size: 24,
    ),
    unselectedLabelStyle: TextStyle(
      color: Colors.lightGreen,
      fontSize: 12,
    ),

    // Uncommenting this changes the color of the title but not the icon
//    selectedItemColor: Colors.deepPurple,
//    unselectedItemColor: Colors.deepPurpleAccent,
  );

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Bug',
        theme: ThemeData(
          primarySwatch: Colors.blue,
          bottomNavigationBarTheme: bottomNavigationBarTheme,
        ),
        home: SomeWidget(),
      );
}

class SomeWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) => Scaffold(
        bottomNavigationBar: BottomNavigationBar(
          items: List.generate(
            2,
            (index) => BottomNavigationBarItem(
              title: Text('Item $index'),
              icon: Icon(Icons.ac_unit),
            ),
          ),
        ),
      );
}
  1. Bug is already visible

Expected results:
BottomNavigationBarItem title's color should be green and light green for selected and unselected states respectively.

Actual results:
BottomNavigationBarItem title's color is using the default colors.

The BottomNavigationBarItem title's color is not overriden neither by the selectedLabelStyle nor unselectedLabelStyle attributes (everything should look green).
I managed to change the title's color using the selectedItemColor and unselectedItemColor attributes, but I find weird that the selectedIconTheme and unselectedIconTheme can override the icon's color but the selectedLabelStyle and unselectedLabelStyle can't override the title's color.

Logs
[ +123 ms] executing: [/home/andres/lib/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +34 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] bbfbf1770cca2da7c82e887e4e4af910034800b6
[        ] executing: [/home/andres/lib/flutter/] git tag --contains HEAD
[ +329 ms] Exit code 0 from: git tag --contains HEAD
[        ] 1.20.2
[   +8 ms] executing: [/home/andres/lib/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/home/andres/lib/flutter/] git ls-remote --get-url origin
[   +4 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +85 ms] executing: [/home/andres/lib/flutter/] git rev-parse --abbrev-ref HEAD
[   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +89 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +17 ms] executing: /home/andres/Android/Sdk/platform-tools/adb devices -l
[  +47 ms] List of devices attached
           emulator-5554          device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:4
[  +10 ms] /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell getprop
[  +40 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +4 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +259 ms] Generating /home/andres/dev/bug/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +33 ms] ro.hardware = ranchu
[  +81 ms] Starting incremental build...
[   +2 ms] Initializing file store
[  +10 ms] Skipping target: gen_localizations
[   +5 ms] complete
[  +11 ms] /home/andres/lib/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/andres/lib/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root /home/andres/lib/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names -Ddart.developer.causal_async_stacks=true -Dflutter.inspector.structuredErrors=true --output-dill /tmp/flutter_tools.ASPSFC/flutter_tool.PWQJOA/app.dill --packages .packages -Ddart.vm.profile=false -Ddart.vm.product=false --bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts --track-widget-creation --initialize-from-dill build/f872507f30e2ff2523f0f1d19160266e.cache.dill.track.dill
[  +10 ms] executing: /home/andres/Android/Sdk/build-tools/29.0.2/aapt dump xmltree /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
Launching lib/main.dart on Android SDK built for x86 in debug mode...
[  +11 ms] Exit code 0 from: /home/andres/Android/Sdk/build-tools/29.0.2/aapt dump xmltree /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
               A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
               A: package="com.example.bug" (Raw: "com.example.bug")
               A: platformBuildVersionCode=(type 0x10)0x1c
               A: platformBuildVersionName=(type 0x10)0x9
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=22)
                 A: android:label(0x01010001)="bug" (Raw: "bug")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:name(0x01010003)="io.flutter.app.FlutterApplication" (Raw: "io.flutter.app.FlutterApplication")
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=28)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.example.bug.MainActivity" (Raw: "com.example.bug.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: intent-filter (line=35)
                     E: action (line=36)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=38)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=45)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[   +6 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[  +28 ms] Exit code 0 from: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[   +1 ms] --------- beginning of main
           08-21 17:18:51.621 I/MicroDetectionWorker(10146): #onError(false)
[   +1 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[  +18 ms] Exit code 0 from: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell -x logcat -v time -t 1
[        ] --------- beginning of main
           08-21 17:18:51.621 I/MicroDetectionWorker(10146): #onError(false)
[  +11 ms] <- compile package:bug/main.dart
[  +12 ms] executing: /home/andres/Android/Sdk/platform-tools/adb version
[  +22 ms] Android Debug Bridge version 1.0.41
           Version 30.0.4-6686687
           Installed as /home/andres/Android/Sdk/platform-tools/adb
[   +3 ms] executing: /home/andres/Android/Sdk/platform-tools/adb start-server
[  +11 ms] Building APK
Running Gradle task 'assembleDebug'...
[  +33 ms] gradle.properties already sets `android.enableR8`
[   +3 ms] Using gradle from /home/andres/dev/bug/android/gradlew.
[   +3 ms] /home/andres/dev/bug/android/gradlew mode: 33261 rwxr-xr-x.
[  +25 ms] executing: /home/andres/bin/android-studio/jre/bin/java -version
[ +117 ms] Exit code 0 from: /home/andres/bin/android-studio/jre/bin/java -version
[        ] openjdk version "1.8.0_202-release"
           OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
           OpenJDK 64-Bit Server VM (build 25.202-b49-5587405, mixed mode)
[   +4 ms] executing: [/home/andres/dev/bug/android/] /home/andres/dev/bug/android/gradlew -q -Ptarget-platform=android-x86 -Ptarget=/home/andres/dev/bug/lib/main.dart -Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root -Pdart-defines=flutter.inspector.structuredErrors%3Dtrue assembleDebug
[+2643 ms] calculateSha: LocalDirectory: '/home/andres/dev/bug/build/app/outputs/flutter-apk'/app.apk
[  +59 ms] calculateSha: reading file took 57us
[ +646 ms] calculateSha: computing sha took 643us
[   +5 ms] executing: /home/andres/Android/Sdk/build-tools/29.0.2/aapt dump xmltree /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[   +7 ms] Exit code 0 from: /home/andres/Android/Sdk/build-tools/29.0.2/aapt dump xmltree /home/andres/dev/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[        ] N: android=http://schemas.android.com/apk/res/android
             E: manifest (line=2)
               A: android:versionCode(0x0101021b)=(type 0x10)0x1
               A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
               A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1c
               A: android:compileSdkVersionCodename(0x01010573)="9" (Raw: "9")
               A: package="com.example.bug" (Raw: "com.example.bug")
               A: platformBuildVersionCode=(type 0x10)0x1c
               A: platformBuildVersionName=(type 0x10)0x9
               E: uses-sdk (line=7)
                 A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
                 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1c
               E: uses-permission (line=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=22)
                 A: android:label(0x01010001)="bug" (Raw: "bug")
                 A: android:icon(0x01010002)=@0x7f080000
                 A: android:name(0x01010003)="io.flutter.app.FlutterApplication" (Raw: "io.flutter.app.FlutterApplication")
                 A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
                 A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
                 E: activity (line=28)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="com.example.bug.MainActivity" (Raw: "com.example.bug.MainActivity")
                   A: android:launchMode(0x0101001d)=(type 0x10)0x1
                   A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
                   A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
                   A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
                   E: intent-filter (line=35)
                     E: action (line=36)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=38)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=45)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[        ] Stopping app 'app.apk' on Android SDK built for x86.
[        ] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.example.bug
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
[  +52 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell pm list packages com.example.bug
[  +45 ms] package:com.example.bug
[   +1 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell cat /data/local/tmp/sky.com.example.bug.sha1
[  +17 ms] 8ca93d4d8d8edb37dba2fc4ceb2e1bb4d6c9461a
[        ] Latest build already installed.
[        ] Android SDK built for x86 startApp
[   +3 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true --ez start-paused true com.example.bug/com.example.bug.MainActivity
[  +44 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.bug/.MainActivity (has extras) }
[        ] Waiting for observatory port to be available...
[+2215 ms] Observatory URL on device: http://127.0.0.1:44823/dz9LqXMHBtg=/
[   +1 ms] executing: /home/andres/Android/Sdk/platform-tools/adb -s emulator-5554 forward tcp:0 tcp:44823
[   +6 ms] 37633
[        ] Forwarded host port 37633 to device port 44823 for Observatory
[   +4 ms] Caching compiled dill
[  +84 ms] Connecting to service protocol: http://127.0.0.1:37633/dz9LqXMHBtg=/
[+1140 ms] Successfully connected to service protocol: http://127.0.0.1:37633/dz9LqXMHBtg=/
Waiting for Android SDK built for x86 to report its views...
[  +64 ms] DevFS: Creating new filesystem on the device (null)
[  +52 ms] DevFS: Created new filesystem on the device (file:///data/user/0/com.example.bug/code_cache/bugSQHHZJ/bug/)
[   +2 ms] Updating assets
Debug service listening on ws://127.0.0.1:37633/dz9LqXMHBtg=/ws
Syncing files to device Android SDK built for x86...
[ +120 ms] Scanning asset files
[   +2 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[        ] <- recompile package:bug/main.dart 03ab285f-3019-4ae3-a7df-76490adf6ab3
[        ] <- 03ab285f-3019-4ae3-a7df-76490adf6ab3
[  +72 ms] Updating files
[ +302 ms] DevFS: Sync finished
[   +1 ms] Synced 0.9MB.
[   +1 ms] <- accept
[   +3 ms] Connected to _flutterView/0xdbc87c10.
D/EGL_emulation(12304): eglMakeCurrent: 0xe70f60a0: ver 2 0 (tinfo 0xdbc37a60)
D/eglCodecCommon(12304): setVertexArrayObject: set vao to 0 (0) 1 0
~/dev/bug ➜ flutter analyze                                                                                                                                                                        [17:19:27]
Analyzing bug...                                                        
No issues found! (ran in 5.5s)
~/dev/bug ➜ flutter doctor -v                                                                                                                                                                      [17:19:50]
[✓] Flutter (Channel stable, 1.20.2, on Linux, locale en_US.UTF-8)
    • Flutter version 1.20.2 at /home/andres/lib/flutter
    • Framework revision bbfbf1770c (8 days ago), 2020-08-13 08:33:09 -0700
    • Engine revision 9d5b21729f
    • Dart version 2.9.1

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/andres/Android/Sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /home/andres/bin/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions.

[!] Android Studio (version 3.5)
    • Android Studio at /home/andres/bin/android-studio
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
    • IntelliJ at /home/andres/bin/idea-IU-193.6015.39
    • Flutter plugin version 45.1.2
    • Dart plugin version 193.6911.31

[✓] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions