Grow the tapped chat row into the chat page on phones
Replace the identity-avatar Hero with a container transform: the row's surface, tint and edge marker morph into the full page while the content cross-fades, and Back, the Cupertino edge swipe or Android predictive back shrink the page into the open chat's row. Reduced motion or a row off screen fades instead; wide layouts are unchanged.
This commit is contained in:
@@ -10,6 +10,7 @@ import '../../shell/empty_detail_pane.dart';
|
||||
import '../../shell/list_detail.dart';
|
||||
import 'dart:async';
|
||||
import '../../ui/motion/motion.dart';
|
||||
import '../../ui/motion/container_transform_source.dart';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart' show setEquals;
|
||||
@@ -415,6 +416,13 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
|
||||
/// On a phone the open chat is a real page above the main screen.
|
||||
final DetailPageHost _page = DetailPageHost();
|
||||
|
||||
/// The list rows the phone's chat page grows from and shrinks back into:
|
||||
/// the open chat's row, also after the page switched to another chat.
|
||||
final ContainerTransformSources _rowSources = ContainerTransformSources();
|
||||
late final ContainerTransformLink _growFromRow = _rowSources.link(
|
||||
() => _selected,
|
||||
);
|
||||
@override
|
||||
bool get _pageOpen => _page.open;
|
||||
|
||||
@@ -550,13 +558,14 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
selected: selected != null && !beside && !_usedWorkspace,
|
||||
destination: AppDestination.chat,
|
||||
onClosed: _back,
|
||||
growFrom: _growFromRow,
|
||||
builder: (context) => selected == null
|
||||
? const SizedBox.shrink()
|
||||
: ShellBar(barless: true, child: _workspaceView()),
|
||||
);
|
||||
// The session list pads its first row by the bar's height itself, so it
|
||||
// scrolls behind the shell's floating bar like the other lists.
|
||||
final fullList = ChatSessionsScreen(
|
||||
final sessions = ChatSessionsScreen(
|
||||
gateway: widget.gateway,
|
||||
embedded: true,
|
||||
syncToken: widget.syncToken,
|
||||
@@ -575,6 +584,10 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
_sidebarMode == ChatSidebarMode.expanded) &&
|
||||
(beside || !_usedWorkspace || selected == null),
|
||||
);
|
||||
final fullList = ContainerTransformScope(
|
||||
sources: _rowSources,
|
||||
child: sessions,
|
||||
);
|
||||
final list = _sidebarList(fullList, selected, beside);
|
||||
if (!beside) {
|
||||
if (!_usedWorkspace) return list;
|
||||
|
||||
Reference in New Issue
Block a user