Close the phone chat page explicitly from its Back button
The chat page's Back had no handler and relied on the stock Back popping the nearest route, while the system gesture went through the app's own back handling. Back now pops the page's own route (or leaves the open chat), the same path the gesture takes.
This commit is contained in:
@@ -68,6 +68,21 @@ class DetailPageHost {
|
||||
}
|
||||
}
|
||||
|
||||
/// Closes the open page as its Back would: the page's own route is popped
|
||||
/// explicitly, never whichever route happens to be nearest a button, and
|
||||
/// its completion then clears the owner's selection.
|
||||
void close() {
|
||||
final route = _route;
|
||||
if (route == null || !route.isActive) return;
|
||||
final navigator = route.navigator;
|
||||
if (navigator == null) return;
|
||||
if (route.isCurrent) {
|
||||
navigator.pop();
|
||||
} else {
|
||||
navigator.removeRoute(route);
|
||||
}
|
||||
}
|
||||
|
||||
/// Removes the page with its owner.
|
||||
void dispose() {
|
||||
// The notifier is left to the page: a page still animating out keeps
|
||||
|
||||
Reference in New Issue
Block a user