I am trying to make a bottom navigation bar which has icons instead of buttons, I plan on making it functional through Gestures.
I found this code snippet for a bottom navigation bar, but it uses indexs. I am trying to make the icons work (use onPressed() functions) using the Gestures feature. Can someone please help me through this?
bottomNavigationBar: Container(
margin: const EdgeInsets.all(20),
height: size.width * .150,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(.15),
blurRadius: 30,
offset: const Offset(0, 10),
),
],
borderRadius: BorderRadius.circular(20),
),
child: ListView.builder(
itemCount: 4,
scrollDirection: Axis.horizontal,
padding: EdgeInsets.symmetric(horizontal: size.width * .024),
itemBuilder: (context, index) => InkWell(
onTap: () {
setState(() {
currentIndex = index;
},
);
},
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AnimatedContainer(
duration: const Duration(milliseconds: 1500),
curve: Curves.fastLinearToSlowEaseIn,
margin: EdgeInsets.only(
bottom: index == currentIndex ? 0 : size.width * .029,
right: size.width * .0422,
left: size.width * .0422,
),
width: size.width * .128,
height: index == currentIndex ? size.width * .014 : 0,
decoration: const BoxDecoration(
color: Colors.orangeAccent,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(10),
),
),
),
Icon(
listOfIcons[index],
size: size.width * .076,
color: index == currentIndex
? Colors.orangeAccent
: Colors.black,
),
SizedBox(height: size.width * .03),
],
),
),
),
),
Thank you in advance.