How to create a heart icon button that toggles between two states in flutter flow.

Widgets & Design

Hi everyone, I’m trying to build a simple favorite/like button in FlutterFlow. I want to use an IconButton with a heart icon that changes between a grey outlined heart (when not selected) and a red filled heart (when selected), whenever the user taps it. I believe this needs a variable (like a local boolean) and a toggle action, but I’m not sure how to set it up in the current FlutterFlow interface. Could someone please guide me step by step on how to achieve this?

What have you tried so far?

So far, I’ve added an IconButton with a heart icon and I can change its color and style in the properties panel. I also opened the conditional value menu for the icon and color, but I couldn’t find where to add or select a local variable (like isFav). I looked in App Settings but didn’t see “State Management” or “Local State,” so I’m not sure where to create variables in the new FlutterFlow interface.

Did you check FlutterFlow's Documentation for this topic?
No
2
5 replies