I am working on flutter footer navigation, I have a file where I initiate all parameters needed, like so:
const Db5BottomNavigationBarItem({
required this.icon,
this.title,
Widget? activeIcon,
this.backgroundColor,
required this.onTap,
}) : activeIcon = activeIcon as String? ?? icon;
final String icon;
final String activeIcon;
final Widget? title;
final Color? backgroundColor;
final Function onTap;
}
This is how I'm using it on my footer component:
child: Db5BottomNavigationBar(
items: <Db5BottomNavigationBarItem>[
Db5BottomNavigationBarItem(
icon: db5_ic_home,
onTap: () {},
),
Db5BottomNavigationBarItem(
icon: db5_ic_heart,
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => new Health()));
},
),
Db5BottomNavigationBarItem(
icon: db5_ic_msg,
onTap: () {},
),
Db5BottomNavigationBarItem(
icon: db5_ic_setting,
onTap: () {},
),
],
unselectedIconTheme: IconThemeData(color: db5_icon_color, size: 24),
selectedIconTheme: IconThemeData(color: db5_colorPrimary, size: 24),
onTap: (int index) {
setState(() {
});
},
type: Db5BottomNavigationBarType.fixed,
),
The problem is, once the button is clicked, let say the first:
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => new Health()));
},
No error at all, and, no response.
What am I doing wrong?
What I have tried:
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => new Health()));
},