Hide the phone chat as soon as its Back is pressed

_back marked the open chat hidden without rebuilding and relied on the
owner's route change to redraw. When the chat was shown while the app was
already on /chat (a restored layout, the Chat tab re-selected) nothing
changed, so the chat stayed on screen for seconds while the list behind
it took the taps. Found on the device: closeChat logged route=null and
the entrance never animated out. _back now rebuilds itself.
This commit is contained in:
2026-11-12 20:19:10 +00:00
parent d0cd400135
commit d19a14b9f9
2 changed files with 90 additions and 8 deletions
+17 -8
View File
@@ -333,17 +333,26 @@ class _ChatScreenState extends State<ChatScreen>
@override
void _back() {
_workspaceVisible = false;
_publishedWorkspaceSession = null;
// Rebuild here rather than wait for the owner's route change: when the
// chat was shown without its own route (the Chat tab re-selected, a
// restored layout) the owner is already on /chat, nothing else rebuilds
// this screen, and the chat would stay on screen while the list behind
// it took the taps.
void hide() {
_workspaceVisible = false;
_publishedWorkspaceSession = null;
if (widget.onBack == null) _standaloneSelection = null;
}
if (mounted) {
setState(hide);
} else {
hide();
}
_runtime.startNotice = null;
_composerFocus.cancel();
if (_workspace.paneCount == 0) widget.onWorkspaceEmpty?.call();
final back = widget.onBack;
if (back != null) {
back();
} else {
setState(() => _standaloneSelection = null);
}
widget.onBack?.call();
}
/// On a phone the open chat is a real page above the main screen.