I am totally new to FlutterFlow and developing mobile apps, so I have been following the instructions to develop the Travel Sample App with Firebase using FlutterFlow. When I got to the Favorite icon on a Place card, the instructions say to use a ToggleIcon to display either a Heart Icon or a Heart Outline icon, according to the value of the is_favorite property on a Place document stored in Firestore.
My problem is that when I clicked the Favorite ToggleIcon widget it would not toggle the display of the widget's icon immediately. I had to swap to another page and then back to the Home page to get the whole page of widgets to be rebuilt just to see the change in the favorite ToggleIcon that I had clicked.
So I added an Action to the ToggleIcon so that OnToggle it would Update App State to Rebuild Current Page. This worked so that the Favorite ToggleIcon would refresh almost immediately to redisplay the toggled favorite icon. The extra code generated was simply setState(() {}); in the onPressed function for the ToggleIcon.
So is ToggleIcon bugged or did I make a mistake in Flutterflow? If it is bugged should I make a bug report to add setState() to auto-refresh the widget when a ToggleIcon is clicked? Is setState() the general way that a widget is to be refreshed and redisplayed when its data value has changed?
Is ToggleIcon Bugged?
2
1 reply