IconButton(
icon: Icon(MdiIcons.moonWaxingCrescent),
onPressed: () {
expanded ? subscription.resume() : subscription.pause();
setState(() {
expanded
? Color(0xffF2E03F)
: Color(0xffFFFFFF);
expanded = !expanded;
});
}),
The above code won't change my color but does execute the function properly (toggles resume and pause). I tried changing this over from an animatedicon I have in use but it's a bit different with subscriptions I suppose. Here's the working animatedIcon that I don't need:
IconButton(
icon: AnimatedIcon(
icon: AnimatedIcons.menu_arrow,
progress: _animationController,
semanticLabel: 'Pause',
),
onPressed: () {
expanded ? subscription.resume() : subscription.pause();
setState(() {
expanded
? _animationController.forward()
: _animationController.reverse();
expanded = !expanded;
});
}),
Any idea how to get the first button to change colors depending on .resume and .pause state?
Got it!
IconButton(
icon: Icon(MdiIcons.moonWaxingCrescent),
color: (expanded) ? Color(0xffFF0000) : Color(0xff000000),
onPressed: () {
expanded ? subscription.resume() : subscription.pause();
setState(() {
expanded = !expanded;
});
}),
User contributions licensed under CC BY-SA 3.0