First of all, I'm using the animations package from Flutter and my question is only about using this package:
Before using that package, I pushed the second view to the Navigator with the await keyword, so when the user goes back from this second view, the code after this gets called:
await Navigator.push(
context,
MaterialPageRoute(builder: (context) => DetailView()),
);
loadData();
Now after integrating this animations library, I don't call the Navigator.push() myself, but only define the target widget and the navigation is done by the library.
Whereas till now, the code for any list item was just the ListTile widget, now it looks like that:
return OpenContainer(
openBuilder: (BuildContext _, VoidCallback closeContainer) {
return DetailView();
},
closedBuilder: (BuildContext _, VoidCallback openContainer) {
return _buildListTile(openContainer);
},
);
In the _buildListTile method the ListTile is wrapped with an InkWell which takes this VoidCallback openContainer for the onTap parameter.
What I can't find out is how to wait for the user clicking back on the second and thus coming back to the first view. I need to (re)load the data as shown in the first code snippet. Has anyone done that and can tell me?
I tried to play around with the openBuilder and closedBuilder, but unfortunately without success...