Open songtao542 opened 5 years ago
Step:
result: the app back to the Studies page
expect: the app just collapse the cart, not leave the product page.
Thanks for explaining the problem. You're right: in this case the system back button should do the same thing as the app's back button (the down-arrow in the upper left-hand corner).
I took a look at this, and it seems the problem might be coming from the fact that the Shrine app is nested inside the Gallery app. Both the gallery and Shrine have their own Navigators. As a result, WillPopScope in Shrine is inside an inner navigator and is ignored.
I got the cart to close properly again by wrapping the MaterialApp in Shrine with a WillPopScope and adding a GlobalKey for the ExpandingBottomSheetState (see here). Does this look like a reasonable solution, or is there a way to do this without wrapping the MaterialApp with a WillPopScope?
Is the problem that the WillPopScope widget's callback unconditionally pops the outermost navigator? Maybe _onWillPop() in expanding_bottom_sheet.dart needs to be changed?
As far as I can tell, the callback isn't called at all. I tried moving the WillPopScope widget up the tree, and the only time the callback was called was when it wrapped the Shrine MaterialApp.
Still the case in the latest version of gallery b5e9c40
built with latest master 1.23.0-8.0.pre.164
.
I'd like to track this down. Can you provide a description of what's going wrong: how you're interacting with the demo, what you're seeing, what you expect to see, etc?