-1

I'm getting this issue after after updating from old version (Title) to Label in the bottom nav bar. Here's a sample of the code:

BottomNavigationBarItem(
            icon: Icon(iconname.shop),
            label: Text(
              'Store',
              style: tabLinkStyle,
            )),
  • The answer provided by anilcngz is correct. After he replied I found this article with a full description: https://docs.flutter.dev/release/breaking-changes/bottom-navigation-title-to-label – Chris Gylseth Apr 22 '22 at 20:19

1 Answers1

2

label is accepting String?, not a widget, so your code should be as following:

BottomNavigationBarItem(
          icon: Icon(conname.shop),
          label: 'Store',
        ),
anilcngz
  • 101
  • 3
  • 9
  • Will style work the same here as it does with Text? Or should I instead of Label use Widget? – Chris Gylseth Apr 22 '22 at 19:53
  • You can style selectedItem, unselectedItem etc. in BottomNavigationBar widget, you can see examples in https://api.flutter.dev/flutter/material/BottomNavigationBar-class.html – anilcngz Apr 22 '22 at 20:06
  • Example here: https://stackoverflow.com/questions/64468586/how-to-style-bottomnavigationbaritem-label/64469096#64469096 – Robert Sandberg Apr 22 '22 at 20:56