1

I have a Scaffold that contains a CustomScrollView showing a list of items that the User has not tried (and another one that shows the items the User has tried).

Using the fantastic package flutter_sticky_header, I populate the CustomScrollView with a variety of SliverStickyHeaders and SliverLists to get something along the lines of:

Fruits
  Apples   >
  Bananas  >
  Pears    >
Vegetables
  Broccoli >
  Cabbage  >
  Potatoes >

The SliverLists are made up of some GestureDetector 'buttons' that take the user to a DetailScreen when tapped using something like:

onTap: () async {
  bool result = await Navigator.push( *go to the DetailScreen* )
  setState(() {
    if (result) { *change the icon on the button* }
  }
}

On the DetailScreen the User can indicate whether or not they have tried the item and when they Pop back to the first screen and the CustomScrollView, an icon on the button they pushed is updated to show a checkmark for items tried and a '>' for those they haven't.

Unfortunately, when the User Pops back to the list of items 'not tried', the item they just indicated having 'tried' is still there, and remains until the User navigates away and back.

What I want to do is update/refresh/rebuild the entire list so that when the User Pops back after changing an item from 'not tried' to 'tried' that item is no longer in the list of not tried items (and vice versa).

Basically, when the User Pops back, I can update the state of the specific widget that took them to the DetailScreen, but can't figure out how to update/refresh the state of the parent CustomScrollView widget up the chain.

0 Answers0