How to style BottomNavigationBarItem label

Jan*_*aka 12 flutter flutter-bottomnavigation

In my application I have a button navigator bar.

I am implementing multi navigation with bottom navigation bar as shown here; https://medium.com/coding-with-flutter/flutter-case-study-multiple-navigators-with-bottomnavigationbar-90eb6caa6dbf

I have put the title text like this.

  BottomNavigationBarItem _buildItem(
      {TabItem tabItem, String tabText, IconData iconData}) {
    return BottomNavigationBarItem(
      icon: Icon(
        iconData,
        color: widget.currentTab == tabItem
            ? active_button_color
            : Colors.grey,
      ),
      //label: tabText,

      title: Text(
        tabText,
        style: widget.currentTab == tabItem
            ? Archivo_12_0xff002245
            : Archivo_12_grey,
      ),
    );
Run Code Online (Sandbox Code Playgroud)

I get message title is deprecated.

When I use the label parameter how do I style it?

Rob*_*erg 22

您可以使用BottomNavigationBar 上的属性为其设置样式。例子:

bottomNavigationBar: BottomNavigationBar(
  items: const <BottomNavigationBarItem>[
    BottomNavigationBarItem(
      icon: Icon(Icons.home),
      label: 'First',
    ),
    BottomNavigationBarItem(
      icon: Icon(Icons.exit_to_app),
      label: 'Second',
    ),
  ],
  selectedLabelStyle: TextStyle(fontSize: 22),
  selectedItemColor: Colors.red,
),
Run Code Online (Sandbox Code Playgroud)

当然还有更多的属性。检查文档:https : //api.flutter.dev/flutter/material/BottomNavigationBar-class.html