I tried to find something like this but I could not found anything
Asked
Active
Viewed 81 times
1 Answers
0
I've coded quickly a BottomNavigationBar that manually adds a small colored Container under the currently selected item. I think that's what you basically want. Of course you can style it according to your needs.
int index = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
currentIndex: index,
onTap: (int index) {
setState(() {this.index = index;});
},
items: [
BottomNavigationBarItem(
label: "Item 1",
icon: const Icon(Icons.ac_unit),
activeIcon: Column(children: [const Icon(Icons.ac_unit), const SizedBox(height: 5), Container(color: Colors.blue, width: 7, height: 2)],)
),
BottomNavigationBarItem(
label: "Item 2",
icon: const Icon(Icons.gamepad),
activeIcon: Column(children: [const Icon(Icons.gamepad), const SizedBox(height: 5), Container(color: Colors.blue, width: 7, height: 2)],)),
BottomNavigationBarItem(
label: "Item 3",
icon: const Icon(Icons.dark_mode),
activeIcon: Column(children: [const Icon(Icons.dark_mode), const SizedBox(height: 5), Container(color: Colors.blue, width: 7, height: 2)],)
),
],
),
);
}

gag0
- 89
- 1
- 7
-
thank you , but look at the image and its border I have uploaded , like if the item is selected the border should go under it and then it will continue to go above rest of the items – Prem Panchal May 12 '23 at 04:47
-
oh now i get what you mean. you should take a look at some of the navigation bar packages like „curved_labeled_navigation_bar“. it doesn’t look exactly the same, but you’ll get the idea. – gag0 May 12 '23 at 08:18