perf(app): quick slide page transitions, close work after the page leaves, instant star/close/reopen

This commit is contained in:
2026-10-24 00:47:32 +01:00
parent fe7311ade0
commit f997964761
5 changed files with 172 additions and 12 deletions
+18 -1
View File
@@ -54,7 +54,9 @@ class DetailPageHost {
Navigator.of(context).push(route).then((_) {
if (_route != route) return;
_route = null;
onClosed();
// Rebuild what lies underneath (route, tab bar, list) once the
// page has finished sliding away, not during its animation.
_afterExit(route, onClosed);
});
});
} else if (!selected && _route != null) {
@@ -66,6 +68,21 @@ class DetailPageHost {
}
}
static void _afterExit(Route<void> route, VoidCallback onClosed) {
final animation = route is ModalRoute<void> ? route.animation : null;
if (animation == null || animation.status == AnimationStatus.dismissed) {
onClosed();
return;
}
late final AnimationStatusListener listener;
listener = (status) {
if (status != AnimationStatus.dismissed) return;
animation.removeStatusListener(listener);
onClosed();
};
animation.addStatusListener(listener);
}
/// Removes the page with its owner.
void dispose() {
// The notifier is left to the page: a page still animating out keeps