I have a Menu button that has 3 icons, and I want to hover the icon of the current page.
The code of the widget is:
class MenuButton extends StatelessWidget {
int current;
MenuButton({@required this.current}) {}
@override
Widget build(BuildContext context) {
Widget cirMenu = FabCircularMenu(
children: <Widget>[
IconButton(
icon: Image.asset('img/performance.png'),
onPressed: () {
print('Favorite');
}),
IconButton(
icon: Image.asset('img/shop.png'),
onPressed: () {
print('Home');
}),
IconButton(
icon: Image.asset('img/category.png'),
onPressed: () {
print('Favorite');
})
],
ringDiameter: 230,
ringWidth: 90,
animationCurve: Cubic(1, 1.65, .62, .83),
);
return cirMenu;
}
I would like to hover the image of the current page, but I don't know how to access the Widget attribute. The final functionality should be something like this (though it is not compiling), that is just adding a conditional to change the image:
if (current == 0) {
cirMenu.children[0].Icon = Image.asset('img/performance-hover.png');
}
if (current == 1) {
cirMenu.children[1].Icon = Image.asset('img/shop-hover.png');
}
if (current == 2) {
cirMenu.children[2].Icon = Image.asset('img/category-hover.png');
}
return cirMenu;
How can I accomplish that?