Tap gestures on FavorCards
From the FavorCardItem widget's favor property, we can manipulate its status by changing its accepted and completed field values. However, it will not remove the item from the current list and add it to the new target list. To do that, we would need to access the current list, remove the favor item from there, and add it into the new list, depending on the button pressed.
We could use our global favors list directly in the card item's onPressed method, but this would imply distributing business logic through the widgets, which seems fine now, but can get messy easily.
So, where should we handle this action effectively? We could handle all of these actions in the FavorsPage widget, which contains all of the favors ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access