Skip to content

BottomNavigationBar items become white when more than 3 items are present #13642

Closed

Description

@DirkWillem

Steps to Reproduce

When adding more than 3 items in a BottomNavigationBar, all items turn white, and are unreadable on the light-gray background. Also, the active item is also white, and not the provided fixedColor. A minimal code sample can be found here

Also see the following images:

schermafbeelding 2017-12-17 om 20 52 39

schermafbeelding 2017-12-17 om 20 52 50

Logs

N/A

Flutter Doctor

[✓] Flutter (on Mac OS X 10.13.1 17B1003, locale nl-NL, channel alpha)
    • Flutter at /Users/dirk/Developer/flutter/sdk
    • Framework revision 8f65fec5f5 (5 days ago), 2017-12-12 09:50:14 -0800
    • Engine revision edaecdc8b8
    • Tools Dart version 1.25.0-dev.11.0
    • Engine Dart version 2.0.0-edge.d8ae797298c3a6cf8dc9f4558707bd2672224d3e

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.0)
    • Android SDK at /Users/dirk/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-26, build-tools 26.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[-] iOS toolchain - develop for iOS devices (Xcode 9.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.2, Build version 9C40b
    ✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    • CocoaPods version 1.2.0

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.3)
    • Flutter plugin version 20.0.3
    • Dart plugin version 173.3727.108

[✓] Connected devices
    • iPhone X • 9500EA8E-1292-4223-BFFF-1B2134D5C47C • ios • iOS 11.2 (simulator)

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Dec 19, 2017
  2. cbracken commented on Dec 19, 2017

    @cbracken
    Member

    /cc @xster

  3. xster commented on Dec 19, 2017

    @xster
    Member

    cc @HansMuller, I vaguely remember seen an older bug about this but I can't find it

  4. flyou commented on Dec 26, 2017

    @flyou

    when use BottomNavigationBarType.fixed that ok ,but when use BottomNavigationBarType.shifting that wrong

  5. wiltwitt commented on Feb 16, 2018

    @wiltwitt

    I too have this problem. anyone know how to fix this?

  6. chusmf commented on Mar 8, 2018

    @chusmf

    same problem to me

  7. added this to the milestone on Mar 9, 2018
  8. Hixie commented on Mar 9, 2018

    @Hixie
    Contributor

    I have added this to our list of things to look at later this year. We would be happy to review patches if anyone has the opportunity to look at the code and figure out what's going on before we get to it, though.

  9. HansMuller commented on Mar 9, 2018

    @HansMuller
    Contributor

    When more than 3 BottomNavigationBar items are provided the type, if unspecified, changes to BottomNavigationBarType.shifting per https://api.flutter.dev/flutter/material/BottomNavigationBar-class.html. This bit of information should be highlighted in the class's doc. It's easy to overlook where it is (I overlooked it).

    When the BottomNavigationBar's type is BottomNavigationBarType.shifting the items text and icons are rendered in white, via DefaultTextStyle and IconTheme. It's assumed that theirBottomNavigationBarItem.backgroundColor will be specified as a contrasting color. This is obviously confusing.

    The overall idea with shifting type bottom navigation bars is that each item will have a different background color (that contrasts with white), since that color will become the color of the entire navigation bar, when the item is selected.

    The doc for BottomNavigationBar, and NavigationBarItem needs to be improved.

  10. wiltwitt commented on Mar 10, 2018

    @wiltwitt

    @HansMuller Thanks, that worked!

  11. tygryk commented on Apr 19, 2018

    @tygryk

    @HansMuller, kudos!

  12. eshinkawa commented on Aug 10, 2018

    @eshinkawa

    If you didn't understand how to fix it:

    bottomNavigationBar: BottomNavigationBar(
              type: BottomNavigationBarType.fixed,
    
  13. ThinkDigitalSoftware commented on Aug 10, 2018

    @ThinkDigitalSoftware
    Contributor

    Am I the only one that thinks that it shouldn't change behavior based on the number of tabs automatically?
    It doesn't seem intuitive to me to expect a different behavior.

  14. bachtiaryayan commented on Sep 8, 2018

    @bachtiaryayan

    thank you 👍

  15. 1 remaining item

  16. dmorawetz commented on Sep 25, 2018

    @dmorawetz

    What do I do, if I don't want the icons to be white, yet it should have the behavior of shifting?

  17. mliitfall commented on Oct 25, 2018

    @mliitfall

    Why don't just make the default type .fixed?

  18. JPM84 commented on Mar 2, 2019

    @JPM84

    I know this issue has been closed but it still feels like a bug even though the documentation has been nicely updated.
    I'd suggest making fixed the default or fixing the behavior of BottomNavigationBarType.shifting with four items.

  19. added 2 commits that reference this issue on Nov 6, 2019
  20. nikhilmeria commented on Jan 10, 2020

    @nikhilmeria

    I provided the " backgroundColor" agrument for each "BottomNavigationBarItem" and the problem is solved.

  21. SilvaEngComp commented on Feb 13, 2020

    @SilvaEngComp

    Eu consegui resolver o problema inserindo a propriedade showUnselectedLabels: true, no BottomNavigationBar

    return new BottomNavigationBar(

      showUnselectedLabels: true,
    
      items: <BottomNavigationBarItem>[...
    
  22. Mahn00rMalik commented on Apr 28, 2020

    @Mahn00rMalik

    what is we don't want the behavior to be shifting if we have more than three items. Is there any work around for it ?

  23. SharkLib commented on May 1, 2020

    @SharkLib

    add showUnselectedLabels:true to BottomNavigationBar
    add backgroundColor: Colors.blue to BottomNavigationBarItem
    Then all shown

  24. Quiqueitc commented on May 23, 2020

    @Quiqueitc

    ¿Soy el único que piensa que no debería cambiar el comportamiento en función del número de pestañas automáticamente?
    No me parece intuitivo esperar un comportamiento diferente.

    I think the same

  25. added
    a: annoyanceRepeatedly frustrating issues with non-experimental functionality
    on Jun 8, 2020
  26. errorsolve commented on Feb 28, 2021

    @errorsolve
  27. github-actions commented on Aug 5, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  28. locked as resolved and limited conversation to collaborators on Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: annoyanceRepeatedly frustrating issues with non-experimental functionalityframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions