Loop mobile chats as a tape and remember resizable peek height

This commit is contained in:
2026-11-07 13:20:30 +00:00
parent 19958e81c5
commit f34ab8e985
15 changed files with 590 additions and 210 deletions
@@ -12,6 +12,7 @@ class ChatMobilePanes {
required String activeId,
required String? peekId,
required Size size,
double peekFraction = .2,
}) {
final active = panes.firstWhere((pane) => pane.id == activeId);
this.activeId = active.id;
@@ -29,7 +30,9 @@ class ChatMobilePanes {
this.activeId = active.id;
const gap = 6.0;
final available = math.max(0.0, size.height - gap);
final peekHeight = available * .2;
final maximum = available * .2;
final minimum = math.min(48.0, maximum);
final peekHeight = (available * peekFraction).clamp(minimum, maximum);
contentHeight = available - peekHeight;
// Selection always promotes the active conversation to the top.
rects[active.id] = Rect.fromLTWH(0, 0, size.width, contentHeight);
@@ -0,0 +1,74 @@
import 'dart:math' as math;
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
/// A transparent touch target centred on the active chat's coloured bottom
/// border. Height is bounded by the original 20% peek and a nonzero minimum.
class ChatMobilePeekDivider extends StatefulWidget {
const ChatMobilePeekDivider({
super.key,
required this.height,
required this.available,
required this.onChanged,
});
final double height;
final double available;
final ValueChanged<double> onChanged;
@override
State<ChatMobilePeekDivider> createState() => _ChatMobilePeekDividerState();
}
class _ChatMobilePeekDividerState extends State<ChatMobilePeekDivider> {
double? _dragHeight;
double get _maximum => widget.available * .2;
double get _minimum => math.min(48.0, _maximum);
void _change(double value) {
if (widget.available <= 0) return;
widget.onChanged(value.clamp(_minimum, _maximum) / widget.available);
}
void _step(double delta) => _change(widget.height + delta);
@override
Widget build(BuildContext context) => Semantics(
identifier: 'chat-mobile-peek-divider',
label: 'Resize inactive chat',
slider: true,
value: '${widget.height.round()} pixels',
increasedValue:
'${(widget.height + 16).clamp(_minimum, _maximum).round()} pixels',
decreasedValue:
'${(widget.height - 16).clamp(_minimum, _maximum).round()} pixels',
onIncrease: () => _step(16),
onDecrease: () => _step(-16),
child: Focus(
onKeyEvent: (_, event) {
if (event is! KeyDownEvent && event is! KeyRepeatEvent) {
return KeyEventResult.ignored;
}
if (event.logicalKey == LogicalKeyboardKey.arrowUp) {
_step(16);
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
_step(-16);
} else {
return KeyEventResult.ignored;
}
return KeyEventResult.handled;
},
child: MouseRegion(
cursor: SystemMouseCursors.resizeRow,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onVerticalDragStart: (_) => _dragHeight = widget.height,
onVerticalDragUpdate: (details) {
_dragHeight = (_dragHeight ?? widget.height) - details.delta.dy;
_change(_dragHeight!);
},
onVerticalDragEnd: (_) => _dragHeight = null,
onVerticalDragCancel: () => _dragHeight = null,
child: const SizedBox.expand(),
),
),
),
);
}
@@ -2,10 +2,9 @@ import 'dart:ui' as ui;
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
/// One bounded, temporary picture behind crossing panes. It fills vacated
/// regions without a second live chat tree or per-frame capture. The current
/// picture can seed an interrupted swap; every old image is released after
/// its last painted frame. Pixel scale is capped at two (~9 MB at 560×1000).
/// One bounded, temporary picture for the outgoing tape segment. It avoids a
/// second live chat tree or per-frame capture. Every old image is released
/// after its last painted frame. Pixel scale is capped at two (~9 MB at 560×1000).
class ChatPaneBackdrop extends ChangeNotifier {
ChatPaneBackdrop(this.motion) {
motion.addStatusListener(_settled);
@@ -16,22 +15,27 @@ class ChatPaneBackdrop extends ChangeNotifier {
bool _scheduled = false;
bool _disposed = false;
void capture(BuildContext context) {
bool capture(BuildContext context) {
final boundary = pictureKey.currentContext?.findRenderObject();
if (boundary is! _PictureBoundary || !boundary.hasPicture) {
return;
return false;
}
var ready = true;
assert(() {
ready = !boundary.debugNeedsPaint;
return true;
}());
if (!ready) return;
if (!ready) return false;
final old = image;
image = boundary.toImageSync(
pixelRatio: MediaQuery.devicePixelRatioOf(context).clamp(1, 2),
);
try {
image = boundary.toImageSync(
pixelRatio: MediaQuery.devicePixelRatioOf(context).clamp(1, 2),
);
} on Object {
return false;
}
if (old != null) _release(old);
return true;
}
void _settled(AnimationStatus status) {
@@ -1,38 +0,0 @@
import 'package:flutter/material.dart';
/// A raised foreground while phone chats cross. The transcript still lays out
/// at its real animated height, so the settled peek can reach its final row.
class ChatPaneSwapCard extends StatelessWidget {
const ChatPaneSwapCard({
super.key,
required this.enabled,
required this.lift,
required this.child,
});
final bool enabled;
final double lift;
final Widget child;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final amount = enabled ? lift : 0.0;
final radius = BorderRadius.circular(16 * amount);
return DecoratedBox(
decoration: BoxDecoration(
color: enabled ? theme.colorScheme.surface : null,
borderRadius: radius,
boxShadow: [
BoxShadow(
color: theme.shadowColor.withValues(alpha: .24 * amount),
blurRadius: 24 * amount,
spreadRadius: 2 * amount,
offset: Offset(0, -6 * amount),
),
],
),
child: ClipRRect(borderRadius: radius, child: child),
);
}
}
@@ -1,11 +1,10 @@
import 'dart:math' as math;
import 'dart:ui' show lerpDouble;
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
/// One continuous phone-pane swap. Both cards travel together; the incoming card grows
/// ahead of the outgoing card shrinking. Chrome follows the shared ease; an interrupted swap starts at their current values.
/// The app's scheduler speed preference scales this ticker once globally.
/// A looping vertical tape. The old active picture exits above the incoming
/// live chat, while its retained live view re-enters below at the peek height.
/// Every live transcript exists once and keeps its real visible viewport.
class ChatPaneSwitchMotion {
ChatPaneSwitchMotion({required TickerProvider vsync})
: _controller = AnimationController(
@@ -14,8 +13,8 @@ class ChatPaneSwitchMotion {
value: 1,
);
static const Duration duration = Duration(milliseconds: 480);
static const Curve curve = Cubic(.22, .7, .24, 1);
static const Duration duration = Duration(milliseconds: 560);
static const Curve curve = Cubic(.4, 0, .2, 1);
final AnimationController _controller;
Animation<double> get animation => _controller.view;
final Map<String, Animation<double>> _reveals = {};
@@ -24,8 +23,9 @@ class ChatPaneSwitchMotion {
Map<String, double> _barFrom = const {};
Map<String, double> _barTo = const {};
Size? _size;
String? _incomingId;
Map<String, double> _liftFrom = const {};
String? _activeId;
String? _outgoingId;
Rect? outgoingSourceRect;
bool get isAnimating => _controller.isAnimating;
double get _progress => curve.transform(_controller.value);
@@ -41,22 +41,29 @@ class ChatPaneSwitchMotion {
required bool switching,
required bool animate,
}) {
final travel = switching && animate && _size == size && _to.isNotEmpty;
final travel =
switching &&
animate &&
_size == size &&
_to.length > 1 &&
rects.length > 1 &&
_activeId != activeId;
_size = size;
if (travel) {
final ids = {..._to.keys, ...rects.keys};
_liftFrom = {for (final id in ids) id: liftFor(id)};
_from = {for (final id in ids) id: rectFor(id) ?? rects[id]!};
_barFrom = {for (final id in ids) id: _reveal(id)};
_incomingId = activeId;
_outgoingId = _activeId;
outgoingSourceRect = _to[_outgoingId];
final peek = rects.values.firstWhere((rect) => rect.top > 0);
_from = {..._to, activeId: _to[activeId] ?? peek};
_to = rects;
_barFrom = {for (final id in rects.keys) id: 0};
_barTo = {for (final id in rects.keys) id: id == activeId ? 1 : 0};
_activeId = activeId;
_controller.forward(from: 0);
} else if (!mapEquals(rects, _to) || !animate) {
_incomingId = null;
_liftFrom = const {};
_from = rects;
_to = rects;
_from = _to = rects;
_activeId = activeId;
_outgoingId = null;
outgoingSourceRect = null;
_barFrom = _barTo = {
for (final id in rects.keys) id: id == activeId ? 1 : 0,
};
@@ -69,41 +76,33 @@ class ChatPaneSwitchMotion {
_from = _to = const {};
_barFrom = _barTo = const {};
_size = null;
_incomingId = null;
_liftFrom = const {};
_activeId = _outgoingId = null;
outgoingSourceRect = null;
_controller.value = 1;
}
Rect? rectFor(String id) {
final to = _to[id];
if (to == null) return null;
final from = _from[id] ?? to;
final t = _progress;
// Separate travel from resizing: overlapping cards should read as passing
// over/under each other rather than collapsing into the same small strip.
final sizeT = id == _incomingId ? Curves.easeOut.transform(t) : t * t;
return Rect.fromLTWH(
lerpDouble(from.left, to.left, t)!,
lerpDouble(from.top, to.top, t)!,
lerpDouble(from.width, to.width, t)!,
lerpDouble(from.height, to.height, sizeT)!,
);
if (_outgoingId == id && outgoingSourceRect != null) {
// The old active's snapshot owns its top exit. Its single live tree is
// already a true small viewport and loops in from below the screen.
final gap = to.top - _to[_activeId]!.bottom;
return to.translate(0, (_size!.height + gap - to.top) * (1 - _progress));
}
return Rect.lerp(_from[id] ?? to, to, _progress);
}
/// A short lift on the foreground card; interruptions keep the current
/// elevation before handing the foreground to the newly selected pane.
double liftFor(String id) {
final t = _controller.value;
final previous = (_liftFrom[id] ?? 0) * (1 - _progress);
final lift = id == _incomingId ? math.sin(math.pi * t) : 0.0;
return (previous + lift).clamp(0.0, 1.0);
Rect? get exitingRect {
final source = outgoingSourceRect;
final incoming = _from[_activeId];
if (!isAnimating || source == null || incoming == null) return null;
return source.translate(0, -incoming.top * _progress);
}
void dispose() => _controller.dispose();
}
/// Stable per-pane listenable: a role swap never replaces the reveal animation
/// or jumps its opacity back to an endpoint when a switch is interrupted.
class _PaneReveal extends Animation<double> {
_PaneReveal(this.motion, this.id);
final ChatPaneSwitchMotion motion;
@@ -0,0 +1,37 @@
import 'dart:ui' as ui;
import 'package:flutter/widgets.dart';
/// Only the top exit is a picture. The looping chat below remains one retained
/// live tree; the picture is released when the tape completes.
class ChatTapeExit extends CustomPainter {
const ChatTapeExit({
required this.image,
required this.source,
required this.workspace,
});
final ui.Image image;
final Rect source;
final Size workspace;
@override
void paint(Canvas canvas, Size size) {
final scale = image.width / workspace.width;
canvas.drawImageRect(
image,
Rect.fromLTRB(
source.left * scale,
source.top * scale,
source.right * scale,
source.bottom * scale,
),
Offset.zero & size,
Paint(),
);
}
@override
bool shouldRepaint(ChatTapeExit oldDelegate) =>
image != oldDelegate.image ||
source != oldDelegate.source ||
workspace != oldDelegate.workspace;
}
@@ -4,12 +4,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'chat_workspace_controller.dart';
import 'chat_workspace_divider.dart';
import 'chat_workspace_geometry.dart';
import 'chat_mobile_panes.dart';
import 'chat_pane_switch_motion.dart';
import 'chat_pane_backdrop.dart';
import 'chat_pane_swap_card.dart';
import 'chat_workspace_surface.dart';
export 'chat_workspace_controller.dart';
export 'chat_workspace_geometry.dart' show ChatPaneDirection;
@@ -29,6 +28,7 @@ class ChatWorkspace extends StatefulWidget {
this.singlePane = false,
this.mobilePeeks = false,
this.paneTitle,
this.onVisibleSessionIdsChanged,
});
final ChatWorkspaceController controller;
final ChatWorkspacePaneBuilder paneBuilder;
@@ -38,6 +38,7 @@ class ChatWorkspace extends StatefulWidget {
final bool singlePane;
final bool mobilePeeks;
final String Function(ChatWorkspacePane)? paneTitle;
final ValueChanged<Set<String>>? onVisibleSessionIdsChanged;
/// Keyboard navigation only: the owner can focus the target composer.
/// Pointer activation leaves text-selection and pointer focus alone.
@@ -54,6 +55,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
late final ChatPaneSwitchMotion _motion;
ChatWorkspaceGeometry? _geometry;
String? _lastActiveId;
Set<String> _visibleSessionIds = const {};
String? _peekId;
late final ChatPaneBackdrop _backdrop;
void _backdropChanged() {
@@ -64,11 +66,31 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
void initState() {
super.initState();
_motion = ChatPaneSwitchMotion(vsync: this);
_motion.animation.addStatusListener(_motionSettled);
_backdrop = ChatPaneBackdrop(_motion.animation)
..addListener(_backdropChanged);
HardwareKeyboard.instance.addHandler(_key);
}
void _reportVisible(Set<String> ids) {
if (setEquals(ids, _visibleSessionIds)) return;
_visibleSessionIds = Set.unmodifiable(ids);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && setEquals(ids, _visibleSessionIds)) {
widget.onVisibleSessionIdsChanged?.call(_visibleSessionIds);
}
});
}
void _motionSettled(AnimationStatus status) {
if (status != AnimationStatus.completed) return;
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && widget.controller.activePaneId != _lastActiveId) {
setState(() {});
}
});
}
bool _key(KeyEvent event) {
if (!widget.shortcutsEnabled ||
widget.controller.paneCount <= 1 ||
@@ -116,6 +138,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
void dispose() {
HardwareKeyboard.instance.removeHandler(_key);
_backdrop.dispose();
_motion.animation.removeStatusListener(_motionSettled);
_motion.dispose();
_focus.dispose();
for (final node in _panes.values) {
@@ -132,12 +155,21 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
builder: (context, _) => LayoutBuilder(
builder: (context, constraints) {
final root = widget.controller.root;
if (root == null) return const SizedBox.shrink();
if (root == null) {
_reportVisible({});
return const SizedBox.shrink();
}
final geometry = ChatWorkspaceGeometry(root, constraints.biggest);
_geometry = geometry;
final collapsed = widget.singlePane || geometry.collapsed;
final panes = widget.controller.panes;
final activeId = widget.controller.activePaneId;
// Finish one joined loop before taking the latest requested role.
// Repeated taps/chords never tear the tape or duplicate a live chat.
final activeId =
_motion.isAnimating &&
panes.any((pane) => pane.id == _lastActiveId)
? _lastActiveId
: widget.controller.activePaneId;
final switching = _lastActiveId != activeId;
if (switching) {
_peekId = _lastActiveId;
@@ -149,12 +181,14 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
activeId: activeId,
peekId: _peekId,
size: constraints.biggest,
peekFraction: widget.controller.mobilePeekFraction,
)
: null;
if (mobile != null &&
switching &&
!MediaQuery.disableAnimationsOf(context)) {
_backdrop.capture(context);
var animate = !MediaQuery.disableAnimationsOf(context);
if (mobile != null && switching && animate) {
// The top exit requires a fresh picture. If painting is not ready,
// settle safely instead of moving the only live tree offscreen.
animate = _backdrop.capture(context);
}
if (mobile == null) {
_motion.rest();
@@ -164,59 +198,33 @@ class _ChatWorkspaceState extends State<ChatWorkspace>
size: constraints.biggest,
activeId: activeId!,
switching: switching,
animate: !MediaQuery.disableAnimationsOf(context),
animate: animate,
);
}
_reportVisible({
for (final pane in panes)
if (mobile != null
? mobile.rects.containsKey(pane.id)
: !collapsed || pane.id == activeId)
pane.sessionId,
});
final existing = panes.map((p) => p.id).toSet();
for (final id
in _panes.keys.where((id) => !existing.contains(id)).toList()) {
final node = _panes.remove(id)!;
WidgetsBinding.instance.addPostFrameCallback((_) => node.dispose());
}
final ordered = mobile?.paintOrder(panes) ?? panes;
return ChatPanePicture(
key: _backdrop.pictureKey,
child: Stack(
fit: StackFit.expand,
clipBehavior: Clip.hardEdge,
children: [
if (_backdrop.image != null)
IgnorePointer(
child: RawImage(image: _backdrop.image, fit: BoxFit.fill),
),
for (final pane in ordered)
// A switch moves the retained pane view; the view itself is
// built once per layout; ticks resize its real scroll viewport.
AnimatedBuilder(
key: ValueKey('chat-workspace-${pane.id}'),
animation: _motion.animation,
child: _paneView(pane, mobile, collapsed, activeId),
builder: (context, child) => Positioned.fromRect(
rect:
_motion.rectFor(pane.id) ??
(collapsed
? Offset.zero & constraints.biggest
: geometry.panes[pane.id]!),
child: ChatPaneSwapCard(
enabled: mobile != null,
lift: _motion.liftFor(pane.id),
child: child!,
),
),
),
if (!collapsed && mobile == null)
for (final divider in geometry.dividers)
Positioned.fromRect(
key: ValueKey('chat-workspace-${divider.split.id}'),
rect: divider.rect,
child: ChatWorkspaceDivider(
geometry: divider,
onChanged: (ratio) =>
widget.controller.resize(divider.split.id, ratio),
),
),
],
),
return chatWorkspaceSurface(
context: context,
backdrop: _backdrop,
motion: _motion,
controller: widget.controller,
geometry: geometry,
mobile: mobile,
collapsed: collapsed,
size: constraints.biggest,
panes: panes,
paneView: (pane) => _paneView(pane, mobile, collapsed, activeId),
);
},
),
@@ -9,6 +9,16 @@ export 'chat_workspace_nodes.dart';
class ChatWorkspaceController extends ChangeNotifier {
ChatWorkspaceNode? _root;
String? _active;
double _mobilePeekFraction = .2;
double get mobilePeekFraction => _mobilePeekFraction;
void resizeMobilePeek(double fraction) {
if (!fraction.isFinite) return;
final next = fraction.clamp(.02, .2);
if (next == _mobilePeekFraction) return;
_mobilePeekFraction = next;
_changed();
}
int _serial = 0;
int _revision = 0;
int get revision => _revision;
@@ -51,6 +61,7 @@ class ChatWorkspaceController extends ChangeNotifier {
if (expectedRevision != null && expectedRevision != _revision) return false;
_root = snapshot.root;
_active = snapshot.activePaneId;
_mobilePeekFraction = snapshot.mobilePeekFraction;
_serial = 0;
_changed();
return true;
@@ -61,6 +72,7 @@ class ChatWorkspaceController extends ChangeNotifier {
_root,
_active,
sidebarMode: sidebarMode,
mobilePeekFraction: _mobilePeekFraction,
);
void _changed() {
@@ -10,27 +10,42 @@ const chatWorkspaceSidebarModes = {'expanded', 'compact', 'hidden'};
/// Validated local presentation state. It contains identities and geometry only,
/// never credentials, messages, drafts, or commands to create/reopen a session.
class ChatWorkspaceSnapshot {
const ChatWorkspaceSnapshot._(this.root, this.activePaneId, this.sidebarMode);
const ChatWorkspaceSnapshot._(
this.root,
this.activePaneId,
this.sidebarMode,
this.mobilePeekFraction,
);
final ChatWorkspaceNode? root;
final String? activePaneId;
final String sidebarMode;
final double mobilePeekFraction;
static ChatWorkspaceSnapshot? fromLayout(
ChatWorkspaceNode? root,
String? activePaneId, {
String sidebarMode = 'expanded',
double mobilePeekFraction = .2,
}) {
try {
final codec = _NodeCodec();
if (root != null) codec.write(root, 1);
if (!chatWorkspaceSidebarModes.contains(sidebarMode) ||
if (!mobilePeekFraction.isFinite ||
mobilePeekFraction < .02 ||
mobilePeekFraction > .2 ||
!chatWorkspaceSidebarModes.contains(sidebarMode) ||
(root == null
? activePaneId != null
: !codec.paneIds.contains(activePaneId))) {
return null;
}
final snapshot = ChatWorkspaceSnapshot._(root, activePaneId, sidebarMode);
final snapshot = ChatWorkspaceSnapshot._(
root,
activePaneId,
sidebarMode,
mobilePeekFraction,
);
return snapshot.encode().length <= chatWorkspaceSnapshotMaxLength
? snapshot
: null;
@@ -44,6 +59,7 @@ class ChatWorkspaceSnapshot {
'root': root == null ? null : _NodeCodec().write(root!, 1),
'active_pane': activePaneId,
'sidebar_mode': sidebarMode,
'mobile_peek_fraction': mobilePeekFraction,
});
static ChatWorkspaceSnapshot? decode(String source) {
@@ -60,10 +76,17 @@ class ChatWorkspaceSnapshot {
final root = data['root'] == null ? null : codec.read(data['root'], 1);
final active = data['active_pane'];
final sidebar = data['sidebar_mode'] ?? 'expanded';
final peek = data['mobile_peek_fraction'] ?? .2;
if (peek is! num) return null;
if (active != null && active is! String || sidebar is! String) {
return null;
}
return fromLayout(root, active as String?, sidebarMode: sidebar);
return fromLayout(
root,
active as String?,
sidebarMode: sidebar,
mobilePeekFraction: peek.toDouble(),
);
} on Object {
return null;
}
@@ -0,0 +1,98 @@
import 'package:flutter/material.dart';
import 'chat_mobile_panes.dart';
import 'chat_mobile_peek_divider.dart';
import 'chat_pane_backdrop.dart';
import 'chat_pane_switch_motion.dart';
import 'chat_tape_exit.dart';
import 'chat_workspace_controller.dart';
import 'chat_workspace_divider.dart';
import 'chat_workspace_geometry.dart';
/// Rendering only: retained live panes stay stable siblings, while the outgoing
/// picture and mobile drag target sit alongside them in the same clipped stack.
Widget chatWorkspaceSurface({
required BuildContext context,
required ChatPaneBackdrop backdrop,
required ChatPaneSwitchMotion motion,
required ChatWorkspaceController controller,
required ChatWorkspaceGeometry geometry,
required ChatMobilePanes? mobile,
required bool collapsed,
required Size size,
required List<ChatWorkspacePane> panes,
required Widget Function(ChatWorkspacePane) paneView,
}) {
final ordered = mobile?.paintOrder(panes) ?? panes;
return ChatPanePicture(
key: backdrop.pictureKey,
child: Stack(
fit: StackFit.expand,
clipBehavior: Clip.hardEdge,
children: [
if (mobile != null)
ColoredBox(color: Theme.of(context).colorScheme.surface),
if (backdrop.image != null && mobile != null)
AnimatedBuilder(
animation: motion.animation,
builder: (context, _) {
final rect = motion.exitingRect;
final source = motion.outgoingSourceRect;
if (rect == null || source == null) {
return const SizedBox.shrink();
}
return Positioned.fromRect(
key: const ValueKey('chat-tape-exit'),
rect: rect,
child: IgnorePointer(
child: CustomPaint(
painter: ChatTapeExit(
image: backdrop.image!,
source: source,
workspace: size,
),
),
),
);
},
),
for (final pane in ordered)
// A switch moves the retained pane view; the view itself is
// built once per layout; ticks resize its real scroll viewport.
AnimatedBuilder(
key: ValueKey('chat-workspace-${pane.id}'),
animation: motion.animation,
child: paneView(pane),
builder: (context, child) => Positioned.fromRect(
rect:
motion.rectFor(pane.id) ??
(collapsed ? Offset.zero & size : geometry.panes[pane.id]!),
child: child!,
),
),
if (mobile?.peekId != null && !motion.isAnimating)
Positioned(
top: mobile!.contentHeight - 12,
left: 0,
right: 0,
height: 24,
child: ChatMobilePeekDivider(
height: mobile.rects[mobile.peekId]!.height,
available: size.height - 6,
onChanged: controller.resizeMobilePeek,
),
),
if (!collapsed && mobile == null)
for (final divider in geometry.dividers)
Positioned.fromRect(
key: ValueKey('chat-workspace-${divider.split.id}'),
rect: divider.rect,
child: ChatWorkspaceDivider(
geometry: divider,
onChanged: (ratio) =>
controller.resize(divider.split.id, ratio),
),
),
],
),
);
}