Merge main: keep pane moves and the floating chat; Float sits beside the move items
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||
import 'chat_pane_move_shortcuts.dart';
|
||||
import 'chat_workspace_geometry.dart';
|
||||
import 'chat_workspace_pane_scope.dart';
|
||||
|
||||
/// "Move up/down/left/right" for a tiled pane's actions (More) menu. A move
|
||||
/// swaps the pane with the one across that edge. A direction with no pane is
|
||||
/// disabled in the Material menu (and left out of a Cupertino action sheet).
|
||||
/// Nothing is offered when the panes are not tiled (one pane, or a phone).
|
||||
List<Widget> chatPaneMoveActions(
|
||||
ChatWorkspacePaneScope? scope, {
|
||||
required void Function(String targetPaneId) onMove,
|
||||
}) {
|
||||
if (scope == null || !scope.movable) return const [];
|
||||
return [
|
||||
for (final (direction, label, icon) in const [
|
||||
(ChatPaneDirection.up, 'Move up', Icons.arrow_upward),
|
||||
(ChatPaneDirection.down, 'Move down', Icons.arrow_downward),
|
||||
(ChatPaneDirection.left, 'Move left', Icons.arrow_back),
|
||||
(ChatPaneDirection.right, 'Move right', Icons.arrow_forward),
|
||||
])
|
||||
SegmentedOverflowAction(
|
||||
key: ValueKey<String>('chat-pane-move-${direction.name}'),
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: label,
|
||||
icon: icon,
|
||||
shortcut: chatPaneMoveActivator(direction),
|
||||
onPressed: switch (scope.moveTargets[direction]) {
|
||||
final target? => () => onMove(target),
|
||||
null => null,
|
||||
},
|
||||
),
|
||||
child: const SizedBox.shrink(),
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../ui/motion/motion.dart';
|
||||
|
||||
/// Glides the two panes of a move from their old tiles to their new ones.
|
||||
/// Only the retained views' positions animate; nothing is rebuilt. Under
|
||||
/// reduced motion the swap is instant.
|
||||
class ChatPaneMoveMotion {
|
||||
ChatPaneMoveMotion({required TickerProvider vsync})
|
||||
: _controller = AnimationController(
|
||||
vsync: vsync,
|
||||
value: 1,
|
||||
// Reduced motion is already settled through [Motion.of], so the
|
||||
// controller does not shorten itself a second time.
|
||||
animationBehavior: AnimationBehavior.preserve,
|
||||
);
|
||||
|
||||
final AnimationController _controller;
|
||||
late final Animation<double> _curve = CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Motion.curve,
|
||||
);
|
||||
Map<String, Rect> _from = const {};
|
||||
|
||||
Listenable get animation => _controller;
|
||||
|
||||
/// Starts from each moved pane's previous tile. A zero [duration] (reduced
|
||||
/// motion) settles at once.
|
||||
void start(Map<String, Rect> from, Duration duration) {
|
||||
if (duration == Duration.zero || from.isEmpty) {
|
||||
_from = const {};
|
||||
_controller.value = 1;
|
||||
return;
|
||||
}
|
||||
_from = Map.unmodifiable(from);
|
||||
_controller.duration = duration;
|
||||
_controller.forward(from: 0);
|
||||
}
|
||||
|
||||
/// Where pane [id] paints now, on its way to [target].
|
||||
Rect rectFor(String id, Rect target) {
|
||||
final from = _from[id];
|
||||
if (from == null || !_controller.isAnimating) return target;
|
||||
return Rect.lerp(from, target, _curve.value)!;
|
||||
}
|
||||
|
||||
void dispose() => _controller.dispose();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'chat_workspace_geometry.dart';
|
||||
|
||||
/// Pane chords share one family: Ctrl+Shift+Arrow focuses the neighbouring
|
||||
/// pane, and adding Alt moves the active pane there instead. On macOS the
|
||||
/// Command key stands in for Ctrl, as it does for focusing.
|
||||
enum ChatPaneChord { focus, move }
|
||||
|
||||
/// The pane chord [event] makes, with its direction, or null.
|
||||
(ChatPaneChord, ChatPaneDirection)? chatPaneChord(
|
||||
KeyEvent event,
|
||||
HardwareKeyboard keyboard, {
|
||||
TargetPlatform? platform,
|
||||
}) {
|
||||
if (event is! KeyDownEvent || !keyboard.isShiftPressed) return null;
|
||||
final mac = (platform ?? defaultTargetPlatform) == TargetPlatform.macOS;
|
||||
final modifier =
|
||||
keyboard.isControlPressed && !keyboard.isMetaPressed ||
|
||||
mac && keyboard.isMetaPressed && !keyboard.isControlPressed;
|
||||
if (!modifier) return null;
|
||||
final direction = switch (event.logicalKey) {
|
||||
LogicalKeyboardKey.arrowLeft => ChatPaneDirection.left,
|
||||
LogicalKeyboardKey.arrowRight => ChatPaneDirection.right,
|
||||
LogicalKeyboardKey.arrowUp => ChatPaneDirection.up,
|
||||
LogicalKeyboardKey.arrowDown => ChatPaneDirection.down,
|
||||
_ => null,
|
||||
};
|
||||
if (direction == null) return null;
|
||||
return (
|
||||
keyboard.isAltPressed ? ChatPaneChord.move : ChatPaneChord.focus,
|
||||
direction,
|
||||
);
|
||||
}
|
||||
|
||||
/// The move chord as a menu shows it: Command on macOS, Ctrl elsewhere.
|
||||
SingleActivator chatPaneMoveActivator(
|
||||
ChatPaneDirection direction, {
|
||||
TargetPlatform? platform,
|
||||
}) {
|
||||
final mac = (platform ?? defaultTargetPlatform) == TargetPlatform.macOS;
|
||||
return SingleActivator(
|
||||
switch (direction) {
|
||||
ChatPaneDirection.left => LogicalKeyboardKey.arrowLeft,
|
||||
ChatPaneDirection.right => LogicalKeyboardKey.arrowRight,
|
||||
ChatPaneDirection.up => LogicalKeyboardKey.arrowUp,
|
||||
ChatPaneDirection.down => LogicalKeyboardKey.arrowDown,
|
||||
},
|
||||
control: !mac,
|
||||
meta: mac,
|
||||
alt: true,
|
||||
shift: true,
|
||||
);
|
||||
}
|
||||
@@ -3,50 +3,28 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../ui/motion/motion.dart';
|
||||
import '../../../ui/motion/quick_switch_animation.dart';
|
||||
import 'chat_float_binding.dart';
|
||||
import 'chat_float_host.dart';
|
||||
import 'chat_workspace_controller.dart';
|
||||
import 'chat_workspace_geometry.dart';
|
||||
import 'chat_mobile_panes.dart';
|
||||
import 'chat_pane_move_motion.dart';
|
||||
import 'chat_pane_move_shortcuts.dart';
|
||||
import 'chat_pane_switch_motion.dart';
|
||||
import 'chat_pane_backdrop.dart';
|
||||
import 'chat_workspace_pane_scope.dart';
|
||||
import 'chat_workspace_surface.dart';
|
||||
import '../../../ui/input/keyboard_owner.dart';
|
||||
|
||||
export 'chat_workspace_controller.dart';
|
||||
export 'chat_workspace_geometry.dart' show ChatPaneDirection;
|
||||
export 'chat_workspace_pane_scope.dart';
|
||||
|
||||
typedef ChatWorkspacePaneBuilder =
|
||||
Widget Function(BuildContext context, ChatWorkspacePane pane, bool active);
|
||||
|
||||
/// Describes the edge ownership of the pane currently being built.
|
||||
class ChatWorkspacePaneScope extends InheritedWidget {
|
||||
const ChatWorkspacePaneScope({
|
||||
super.key,
|
||||
required this.topEdgeShared,
|
||||
required this.bottomEdgeShared,
|
||||
required this.leftEdgeShared,
|
||||
required this.rightEdgeShared,
|
||||
required super.child,
|
||||
});
|
||||
|
||||
final bool topEdgeShared;
|
||||
final bool bottomEdgeShared;
|
||||
final bool leftEdgeShared;
|
||||
final bool rightEdgeShared;
|
||||
|
||||
static ChatWorkspacePaneScope? maybeOf(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<ChatWorkspacePaneScope>();
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ChatWorkspacePaneScope oldWidget) =>
|
||||
topEdgeShared != oldWidget.topEdgeShared ||
|
||||
bottomEdgeShared != oldWidget.bottomEdgeShared ||
|
||||
leftEdgeShared != oldWidget.leftEdgeShared ||
|
||||
rightEdgeShared != oldWidget.rightEdgeShared;
|
||||
}
|
||||
|
||||
/// All chat views are stable siblings, independent of the split tree. Moving a
|
||||
/// divider or adding/removing a neighbouring split never reparents a chat view.
|
||||
class ChatWorkspace extends StatefulWidget {
|
||||
@@ -87,7 +65,7 @@ class ChatWorkspace extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
with SingleTickerProviderStateMixin {
|
||||
with TickerProviderStateMixin {
|
||||
final _focus = FocusNode(debugLabel: 'Chat workspace');
|
||||
final Map<String, FocusScopeNode> _panes = {};
|
||||
|
||||
@@ -95,6 +73,9 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
/// floating window.
|
||||
final Map<String, GlobalKey> _views = {};
|
||||
late final ChatPaneSwitchMotion _motion;
|
||||
late final ChatPaneMoveMotion _move = ChatPaneMoveMotion(vsync: this);
|
||||
int _moveSerial = 0;
|
||||
bool _tiled = false;
|
||||
ChatWorkspaceGeometry? _geometry;
|
||||
String? _lastActiveId;
|
||||
Set<String> _visibleSessionIds = const {};
|
||||
@@ -138,24 +119,18 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
primaryFocusIsTypingSurface()) {
|
||||
return false;
|
||||
}
|
||||
final keyboard = HardwareKeyboard.instance;
|
||||
final modifier =
|
||||
keyboard.isControlPressed && !keyboard.isMetaPressed ||
|
||||
defaultTargetPlatform == TargetPlatform.macOS &&
|
||||
keyboard.isMetaPressed &&
|
||||
!keyboard.isControlPressed;
|
||||
if (!modifier || !keyboard.isShiftPressed || keyboard.isAltPressed) {
|
||||
return false;
|
||||
}
|
||||
final direction = switch (event.logicalKey) {
|
||||
LogicalKeyboardKey.arrowLeft => ChatPaneDirection.left,
|
||||
LogicalKeyboardKey.arrowRight => ChatPaneDirection.right,
|
||||
LogicalKeyboardKey.arrowUp => ChatPaneDirection.up,
|
||||
LogicalKeyboardKey.arrowDown => ChatPaneDirection.down,
|
||||
_ => null,
|
||||
};
|
||||
if (direction == null) return false;
|
||||
final chord = chatPaneChord(event, HardwareKeyboard.instance);
|
||||
if (chord == null) return false;
|
||||
final (kind, direction) = chord;
|
||||
final id = widget.controller.activePaneId;
|
||||
if (kind == ChatPaneChord.move) {
|
||||
// Only tiled panes move; the phone's one-at-a-time layout keeps the keys.
|
||||
if (!_tiled) return false;
|
||||
final target = id == null ? null : _geometry?.adjacent(id, direction);
|
||||
if (target != null) widget.controller.swap(id!, target);
|
||||
// Consumed at an outer edge too, like focusing.
|
||||
return true;
|
||||
}
|
||||
final target = id == null ? null : _geometry?.neighbor(id, direction);
|
||||
if (target != null) {
|
||||
widget.controller.activate(target);
|
||||
@@ -180,6 +155,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
_backdrop.dispose();
|
||||
_motion.animation.removeStatusListener(_motionSettled);
|
||||
_motion.dispose();
|
||||
_move.dispose();
|
||||
_focus.dispose();
|
||||
for (final node in _panes.values) {
|
||||
node.dispose();
|
||||
@@ -203,9 +179,33 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final geometry = ChatWorkspaceGeometry(root, constraints.biggest);
|
||||
final previous = _geometry;
|
||||
_geometry = geometry;
|
||||
final collapsed = widget.singlePane || geometry.collapsed;
|
||||
final panes = widget.controller.panes;
|
||||
final tiled = !collapsed && panes.length > 1;
|
||||
if (_moveSerial != widget.controller.moveSerial) {
|
||||
_moveSerial = widget.controller.moveSerial;
|
||||
// Glide the swapped pair from their previous tiles.
|
||||
_move.start(
|
||||
tiled && _tiled && previous != null
|
||||
? {
|
||||
for (final id in widget.controller.movedPaneIds)
|
||||
id: ?previous.panes[id],
|
||||
}
|
||||
: const {},
|
||||
Motion.of(context, Motion.standard),
|
||||
);
|
||||
}
|
||||
_tiled = tiled;
|
||||
final moveTargets = <String, Map<ChatPaneDirection, String>>{
|
||||
if (tiled)
|
||||
for (final pane in panes)
|
||||
pane.id: {
|
||||
for (final direction in ChatPaneDirection.values)
|
||||
direction: ?geometry.adjacent(pane.id, direction),
|
||||
},
|
||||
};
|
||||
// Finish one joined loop before taking the latest requested role.
|
||||
// Repeated taps/chords never tear the tape or duplicate a live chat.
|
||||
final activeId =
|
||||
@@ -304,14 +304,21 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
context: context,
|
||||
backdrop: _backdrop,
|
||||
motion: _motion,
|
||||
move: _move,
|
||||
controller: widget.controller,
|
||||
geometry: geometry,
|
||||
mobile: mobile,
|
||||
collapsed: collapsed,
|
||||
size: constraints.biggest,
|
||||
panes: panes,
|
||||
paneView: (pane) =>
|
||||
_paneView(pane, mobile, collapsed, activeId, sharedEdges),
|
||||
paneView: (pane) => _paneView(
|
||||
pane,
|
||||
mobile,
|
||||
collapsed,
|
||||
activeId,
|
||||
sharedEdges,
|
||||
moveTargets[pane.id],
|
||||
),
|
||||
);
|
||||
final frame = widget.floatFrame;
|
||||
if (frame == null) return surface;
|
||||
@@ -341,6 +348,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
bool collapsed,
|
||||
String? activeId,
|
||||
Map<String, Set<String>> sharedEdges,
|
||||
Map<ChatPaneDirection, String>? moveTargets,
|
||||
) {
|
||||
final outgoing = _motion.isRetainedOutgoing(pane.id);
|
||||
final peek = mobile?.peekId == pane.id || outgoing;
|
||||
@@ -368,6 +376,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
peek: peek,
|
||||
mobile: mobile != null,
|
||||
edges: sharedEdges[pane.id] ?? const {},
|
||||
moveTargets: moveTargets,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -385,6 +394,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
required bool peek,
|
||||
required bool mobile,
|
||||
required Set<String> edges,
|
||||
Map<ChatPaneDirection, String>? moveTargets,
|
||||
}) => KeyedSubtree(
|
||||
key: _views.putIfAbsent(pane.id, () => GlobalKey(debugLabel: pane.id)),
|
||||
child: FocusScope(
|
||||
@@ -408,6 +418,8 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
|
||||
bottomEdgeShared: edges.contains('bottom'),
|
||||
leftEdgeShared: edges.contains('left'),
|
||||
rightEdgeShared: edges.contains('right'),
|
||||
movable: moveTargets != null,
|
||||
moveTargets: moveTargets ?? const {},
|
||||
child: Builder(
|
||||
builder: (paneContext) =>
|
||||
widget.paneBuilder(paneContext, pane, active),
|
||||
|
||||
@@ -140,6 +140,29 @@ class ChatWorkspaceController extends ChangeNotifier {
|
||||
_changed();
|
||||
}
|
||||
|
||||
int _moveSerial = 0;
|
||||
Set<String> _movedPaneIds = const {};
|
||||
|
||||
/// Increments with each [swap], so a renderer can animate just that move.
|
||||
int get moveSerial => _moveSerial;
|
||||
Set<String> get movedPaneIds => _movedPaneIds;
|
||||
|
||||
/// The two panes trade places in the tree; the split sizes stay. Each pane
|
||||
/// keeps its id, so its retained chat view moves rather than rebuilding.
|
||||
/// [paneId] is the pane being moved and stays (or becomes) active.
|
||||
void swap(String paneId, String otherId) {
|
||||
if (_root == null || paneId == otherId) return;
|
||||
final all = panes;
|
||||
final a = all.where((p) => p.id == paneId).firstOrNull;
|
||||
final b = all.where((p) => p.id == otherId).firstOrNull;
|
||||
if (a == null || b == null) return;
|
||||
_root = swapChatWorkspacePanes(_root!, a, b);
|
||||
_active = paneId;
|
||||
_moveSerial++;
|
||||
_movedPaneIds = {paneId, otherId};
|
||||
_changed();
|
||||
}
|
||||
|
||||
void resize(String splitId, double ratio) {
|
||||
if (_root == null || !ratio.isFinite) return;
|
||||
_root = _resize(_root!, splitId, ratio.clamp(.01, .99));
|
||||
|
||||
@@ -118,6 +118,47 @@ class ChatWorkspaceGeometry {
|
||||
);
|
||||
}
|
||||
|
||||
/// The pane across [id]'s edge in [direction] (only a divider between
|
||||
/// them) that a move swaps with: the one spanning [id]'s centre line, else
|
||||
/// the one sharing the longest stretch of that edge. Null at an outer edge.
|
||||
String? adjacent(String id, ChatPaneDirection direction) {
|
||||
final origin = panes[id];
|
||||
if (origin == null) return null;
|
||||
const slack = .5;
|
||||
final horizontal =
|
||||
direction == ChatPaneDirection.left ||
|
||||
direction == ChatPaneDirection.right;
|
||||
final centre = horizontal ? origin.center.dy : origin.center.dx;
|
||||
String? best;
|
||||
var bestCentred = false;
|
||||
var bestOverlap = 0.0;
|
||||
for (final MapEntry(key: other, value: rect) in panes.entries) {
|
||||
if (other == id) continue;
|
||||
final gap = switch (direction) {
|
||||
ChatPaneDirection.left => origin.left - rect.right,
|
||||
ChatPaneDirection.right => rect.left - origin.right,
|
||||
ChatPaneDirection.up => origin.top - rect.bottom,
|
||||
ChatPaneDirection.down => rect.top - origin.bottom,
|
||||
};
|
||||
if (gap < -slack || gap > chatPaneDividerExtent + slack) continue;
|
||||
final overlap = horizontal
|
||||
? math.min(origin.bottom, rect.bottom) - math.max(origin.top, rect.top)
|
||||
: math.min(origin.right, rect.right) - math.max(origin.left, rect.left);
|
||||
if (overlap <= slack) continue;
|
||||
final centred = horizontal
|
||||
? rect.top <= centre && centre < rect.bottom
|
||||
: rect.left <= centre && centre < rect.right;
|
||||
if (best == null ||
|
||||
centred && !bestCentred ||
|
||||
centred == bestCentred && overlap > bestOverlap) {
|
||||
best = other;
|
||||
bestCentred = centred;
|
||||
bestOverlap = overlap;
|
||||
}
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
String? neighbor(String active, ChatPaneDirection direction) {
|
||||
final origin = panes[active];
|
||||
if (origin == null) return null;
|
||||
|
||||
@@ -22,3 +22,25 @@ class ChatWorkspaceSplit extends ChatWorkspaceNode {
|
||||
final ChatWorkspaceNode first, second;
|
||||
final double ratio;
|
||||
}
|
||||
|
||||
/// [root] with the leaves [a] and [b] trading places. Each leaf keeps its own
|
||||
/// node (identity and chat); every split keeps its id, axis and ratio.
|
||||
ChatWorkspaceNode swapChatWorkspacePanes(
|
||||
ChatWorkspaceNode root,
|
||||
ChatWorkspacePane a,
|
||||
ChatWorkspacePane b,
|
||||
) {
|
||||
ChatWorkspaceNode visit(ChatWorkspaceNode node) => switch (node) {
|
||||
ChatWorkspacePane(:final id) when id == a.id => b,
|
||||
ChatWorkspacePane(:final id) when id == b.id => a,
|
||||
ChatWorkspacePane() => node,
|
||||
ChatWorkspaceSplit() => ChatWorkspaceSplit(
|
||||
node.id,
|
||||
node.axis,
|
||||
visit(node.first),
|
||||
visit(node.second),
|
||||
ratio: node.ratio,
|
||||
),
|
||||
};
|
||||
return visit(root);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'chat_workspace_geometry.dart';
|
||||
|
||||
/// Describes the edge ownership of the pane currently being built, and the
|
||||
/// panes it can trade places with.
|
||||
class ChatWorkspacePaneScope extends InheritedWidget {
|
||||
const ChatWorkspacePaneScope({
|
||||
super.key,
|
||||
required this.topEdgeShared,
|
||||
required this.bottomEdgeShared,
|
||||
required this.leftEdgeShared,
|
||||
required this.rightEdgeShared,
|
||||
this.movable = false,
|
||||
this.moveTargets = const {},
|
||||
required super.child,
|
||||
});
|
||||
|
||||
final bool topEdgeShared;
|
||||
final bool bottomEdgeShared;
|
||||
final bool leftEdgeShared;
|
||||
final bool rightEdgeShared;
|
||||
|
||||
/// Whether the panes are tiled on screen, so moving one means something.
|
||||
/// A single pane, or the phone's one-at-a-time layout, never moves.
|
||||
final bool movable;
|
||||
|
||||
/// The pane id a move in each direction swaps with; an outer edge has none.
|
||||
final Map<ChatPaneDirection, String> moveTargets;
|
||||
|
||||
static ChatWorkspacePaneScope? maybeOf(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<ChatWorkspacePaneScope>();
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ChatWorkspacePaneScope oldWidget) =>
|
||||
topEdgeShared != oldWidget.topEdgeShared ||
|
||||
bottomEdgeShared != oldWidget.bottomEdgeShared ||
|
||||
leftEdgeShared != oldWidget.leftEdgeShared ||
|
||||
rightEdgeShared != oldWidget.rightEdgeShared ||
|
||||
movable != oldWidget.movable ||
|
||||
!mapEquals(moveTargets, oldWidget.moveTargets);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import '../../../ui/adaptive/host.dart';
|
||||
import 'chat_mobile_panes.dart';
|
||||
import 'chat_mobile_peek_divider.dart';
|
||||
import 'chat_pane_backdrop.dart';
|
||||
import 'chat_pane_move_motion.dart';
|
||||
import 'chat_pane_switch_motion.dart';
|
||||
import 'chat_tape_exit.dart';
|
||||
import 'chat_switch_card.dart';
|
||||
@@ -18,6 +19,7 @@ Widget chatWorkspaceSurface({
|
||||
required BuildContext context,
|
||||
required ChatPaneBackdrop backdrop,
|
||||
required ChatPaneSwitchMotion motion,
|
||||
required ChatPaneMoveMotion move,
|
||||
required ChatWorkspaceController controller,
|
||||
required ChatWorkspaceGeometry geometry,
|
||||
required ChatMobilePanes? mobile,
|
||||
@@ -65,12 +67,14 @@ Widget chatWorkspaceSurface({
|
||||
// built once per layout; ticks resize its real scroll viewport.
|
||||
AnimatedBuilder(
|
||||
key: ValueKey('chat-workspace-${pane.id}'),
|
||||
animation: motion.animation,
|
||||
animation: Listenable.merge([motion.animation, move.animation]),
|
||||
child: paneView(pane),
|
||||
builder: (context, child) => Positioned.fromRect(
|
||||
rect:
|
||||
motion.rectFor(pane.id) ??
|
||||
(collapsed ? Offset.zero & size : geometry.panes[pane.id]!),
|
||||
(collapsed
|
||||
? Offset.zero & size
|
||||
: move.rectFor(pane.id, geometry.panes[pane.id]!)),
|
||||
child: IgnorePointer(
|
||||
ignoring:
|
||||
motion.isRetainedOutgoing(pane.id) ||
|
||||
|
||||
Reference in New Issue
Block a user