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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user