0

When I am used BottomNavigationBarItem, I can't showing my navigation icons.

I am trying this code:

import 'package:flutter/material.dart';
import 'package:task_manager/style/style.dart';

BottomNavigationBar AppBottomNav(currentIndex, OnItemTapped) {
  return BottomNavigationBar(
    items: const [
      BottomNavigationBarItem(
        icon: Icon(Icons.list_alt),
        label: "New",
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.access_time_rounded),
        label: "Progress",
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.check_circle_outlined),
        label: "Completed",
      ),
      BottomNavigationBarItem(
        icon: Icon(Icons.cancel),
        label: "Canceled",
      ),
    ],
    selectedItemColor: colorGreen,
    unselectedItemColor: colorLightGray,
    currentIndex: currentIndex,
    showSelectedLabels: true,
    showUnselectedLabels: true,
    onTap: OnItemTapped,
    type: BottomNavigationBarType.shifting,
  );
}

Result

My Car
  • 4,198
  • 5
  • 17
  • 50

2 Answers2

0

You need to set uses-material-design: true in pubspec.yaml

BottomNavigationBar With Icons

Alejandro Cumpa
  • 2,118
  • 1
  • 24
  • 45
0

Like Alejandro Cumpa said, you need to add uses-material-design: true in your pubspec.yaml.

You need to add this to the bottom:

name: …
description: …

publish_to: …

version: …

environment:
  …

dependencies:
  …

dev_dependencies:
  …

flutter:
  …
  uses-material-design: true
My Car
  • 4,198
  • 5
  • 17
  • 50