fix(chat): double-back to close with a chat open beside the list
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../shell/list_detail.dart';
|
||||
import 'android_root_exit.dart';
|
||||
import 'app_route.dart';
|
||||
|
||||
@@ -134,8 +135,13 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
||||
/// page key is stable, so changing the route updates it in place instead of
|
||||
/// remounting it and losing the open run. Search is the only extra page, so
|
||||
/// its native Close action pops just that page.
|
||||
/// Whether the window shows an open chat beside its list rather than as a
|
||||
/// pushed page. Read in [build], so a resize rebuilds the Back policy.
|
||||
bool _chatBesideList = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_chatBesideList = showsListBesideDetail(context);
|
||||
final searching = searchOpen && searchBuilder != null;
|
||||
final templates = templatesOpen && templatesBuilder != null;
|
||||
final schedules = schedulesOpen && schedulesBuilder != null;
|
||||
@@ -263,7 +269,9 @@ class AppRouterDelegate extends RouterDelegate<AppRoute> with ChangeNotifier {
|
||||
|
||||
bool get _isExitRoot =>
|
||||
_rootExit.enabled &&
|
||||
_route.chatSessionId == null &&
|
||||
// A phone's open chat is a pushed page with stock Back. Beside the list
|
||||
// it is no page at all, so the list root's double-back applies.
|
||||
(_route.chatSessionId == null || _chatBesideList) &&
|
||||
!_canStepUp &&
|
||||
switch (_route.kind) {
|
||||
AppRouteKind.pipelines ||
|
||||
|
||||
Reference in New Issue
Block a user