[I want to change this default icon. How can I change this?]
BottomNavigationBarItem(
icon: Icon(
Icons.home,
size: 32,
),
label: "Tweets",
)
CodePudding user response:
If you just want to change the icon with another one, you have to change the code here:
BottomNavigationBarItem(
icon: Icon(
Icons.anotherIconNameHere, // after the dot you change your icon
size: 32,
),
label: "Tweets", // here you can change the icon's label
)
Where I added anotherIconNameHere
is where you will change your icon: after Icons.
you can specify the icon you want to show. If you are using an IDE like Android Studio or Visual Studio Code, after typing the dot all the available icons will show up in a popover list.
You can check all the available icons of the Icons class here: Icons class - Material library - Dart API
In the material Icons class you can find pretty much all the icons you need.
Edited: In case you want to add custom icons or your icons, I strongly suggest you to read this article from Freecodecamp.org: FreeCodeCamp.Org - How to add custom icons to your flutter application
(If this was the answer you were looking for, remember to select it.)
CodePudding user response:
@ashikur just use Image.asset to load local images. that you have to add in the asset folder and in pubspec.
BottomNavigationBarItem(
icon: Image.asset(
"assets/images/google.png"
),
label: "Tweets",
)