Integrate active-on-top mobile pane rendering optimization
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/semantics.dart';
|
||||
import 'dart:math' as math;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'chat_workspace_controller.dart';
|
||||
@@ -17,6 +18,7 @@ class ChatMobilePanes {
|
||||
.firstOrNull ??
|
||||
panes.where((pane) => pane.id != activeId).firstOrNull;
|
||||
if (peek == null) {
|
||||
contentHeight = size.height;
|
||||
rects[active.id] = Offset.zero & size;
|
||||
return;
|
||||
}
|
||||
@@ -24,80 +26,123 @@ class ChatMobilePanes {
|
||||
const gap = 6.0;
|
||||
final available = math.max(0.0, size.height - gap);
|
||||
final peekHeight = available * .2;
|
||||
final activeHeight = available - peekHeight;
|
||||
final activeFirst = panes.indexOf(active) < panes.indexOf(peek);
|
||||
rects[activeFirst ? active.id : peek.id] = Rect.fromLTWH(
|
||||
0,
|
||||
contentHeight = available - peekHeight;
|
||||
// Selection always promotes the active conversation to the top.
|
||||
rects[active.id] = Rect.fromLTWH(0, 0, size.width, contentHeight);
|
||||
rects[peek.id] = Rect.fromLTWH(
|
||||
0,
|
||||
contentHeight + gap,
|
||||
size.width,
|
||||
activeFirst ? activeHeight : peekHeight,
|
||||
);
|
||||
final topHeight = activeFirst ? activeHeight : peekHeight;
|
||||
rects[activeFirst ? peek.id : active.id] = Rect.fromLTWH(
|
||||
0,
|
||||
topHeight + gap,
|
||||
size.width,
|
||||
activeFirst ? peekHeight : activeHeight,
|
||||
peekHeight,
|
||||
);
|
||||
}
|
||||
late final double contentHeight;
|
||||
final rects = <String, Rect>{};
|
||||
String? peekId;
|
||||
}
|
||||
|
||||
/// Keep a peek's full header/transcript layout available without squeezing its
|
||||
/// composer into a tiny viewport. The clipped preview cannot take input focus.
|
||||
class ChatMobilePaneViewport extends StatelessWidget {
|
||||
/// Both mobile threads retain the same full content layout. Only the cheap
|
||||
/// viewport clip and position change during a switch; transcript layout, scroll
|
||||
/// anchoring and backdrop painting do not repeat on every animation tick.
|
||||
class ChatMobilePaneViewport extends StatefulWidget {
|
||||
const ChatMobilePaneViewport({
|
||||
super.key,
|
||||
required this.peek,
|
||||
required this.active,
|
||||
required this.animate,
|
||||
required this.child,
|
||||
required this.onActivate,
|
||||
required this.label,
|
||||
required this.paneId,
|
||||
this.contentHeight,
|
||||
});
|
||||
final bool peek;
|
||||
final bool active;
|
||||
final bool animate;
|
||||
final Widget child;
|
||||
final VoidCallback onActivate;
|
||||
final String label;
|
||||
final String paneId;
|
||||
final double? contentHeight;
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final height = constraints.maxHeight;
|
||||
return ClipRect(
|
||||
State<ChatMobilePaneViewport> createState() => _ChatMobilePaneViewportState();
|
||||
}
|
||||
|
||||
class _ChatMobilePaneViewportState extends State<ChatMobilePaneViewport>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late final AnimationController _reveal = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 120),
|
||||
value: 1,
|
||||
);
|
||||
late final Animation<double> _opacity = Tween(
|
||||
begin: .75,
|
||||
end: 1.0,
|
||||
).animate(CurvedAnimation(parent: _reveal, curve: Curves.easeOutCubic));
|
||||
late final Animation<Offset> _slide = Tween(
|
||||
begin: const Offset(0, .005),
|
||||
end: Offset.zero,
|
||||
).animate(CurvedAnimation(parent: _reveal, curve: Curves.easeOutCubic));
|
||||
@override
|
||||
void didUpdateWidget(covariant ChatMobilePaneViewport oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (!widget.animate || !widget.active) {
|
||||
_reveal.value = 1;
|
||||
} else if (!oldWidget.active) {
|
||||
_reveal.forward(from: 0);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_reveal.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ClipRect(
|
||||
child: FadeTransition(
|
||||
key: ValueKey('chat-reveal-${widget.paneId}'),
|
||||
opacity: _opacity,
|
||||
child: SlideTransition(
|
||||
position: _slide,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
OverflowBox(
|
||||
alignment: Alignment.topCenter,
|
||||
minHeight: height,
|
||||
maxHeight: peek ? math.max(height, 300) : height,
|
||||
minHeight: widget.contentHeight,
|
||||
maxHeight: widget.contentHeight,
|
||||
child: SizedBox(
|
||||
height: peek ? math.max(height, 300) : height,
|
||||
height: widget.contentHeight,
|
||||
child: ExcludeFocus(
|
||||
excluding: peek,
|
||||
excluding: widget.peek,
|
||||
child: ExcludeSemantics(
|
||||
excluding: peek,
|
||||
child: IgnorePointer(ignoring: peek, child: child),
|
||||
excluding: widget.peek,
|
||||
child: IgnorePointer(
|
||||
ignoring: widget.peek,
|
||||
child: RepaintBoundary(child: widget.child),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (peek)
|
||||
if (widget.peek)
|
||||
Semantics(
|
||||
key: ValueKey('chat-peek-$paneId'),
|
||||
identifier: 'chat-peek-$paneId',
|
||||
key: ValueKey('chat-peek-${widget.paneId}'),
|
||||
identifier: 'chat-peek-${widget.paneId}',
|
||||
container: true,
|
||||
label: 'Expand $label',
|
||||
sortKey: const OrdinalSortKey(1),
|
||||
label: 'Expand ${widget.label}',
|
||||
button: true,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onActivate,
|
||||
onTap: widget.onActivate,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/semantics.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -135,10 +136,6 @@ class _ChatWorkspaceState extends State<ChatWorkspace> {
|
||||
size: constraints.biggest,
|
||||
)
|
||||
: null;
|
||||
final duration =
|
||||
mobile != null && !MediaQuery.disableAnimationsOf(context)
|
||||
? const Duration(milliseconds: 220)
|
||||
: Duration.zero;
|
||||
final existing = panes.map((p) => p.id).toSet();
|
||||
for (final id
|
||||
in _panes.keys.where((id) => !existing.contains(id)).toList()) {
|
||||
@@ -150,9 +147,7 @@ class _ChatWorkspaceState extends State<ChatWorkspace> {
|
||||
clipBehavior: Clip.hardEdge,
|
||||
children: [
|
||||
for (final pane in panes)
|
||||
AnimatedPositioned.fromRect(
|
||||
duration: duration,
|
||||
curve: Curves.easeInOutCubic,
|
||||
Positioned.fromRect(
|
||||
key: ValueKey('chat-workspace-${pane.id}'),
|
||||
rect:
|
||||
mobile?.rects[pane.id] ??
|
||||
@@ -170,6 +165,11 @@ class _ChatWorkspaceState extends State<ChatWorkspace> {
|
||||
pane.id != widget.controller.activePaneId,
|
||||
child: ChatMobilePaneViewport(
|
||||
peek: mobile?.peekId == pane.id,
|
||||
active: pane.id == activeId,
|
||||
animate:
|
||||
mobile != null &&
|
||||
!MediaQuery.disableAnimationsOf(context),
|
||||
contentHeight: mobile?.contentHeight,
|
||||
label: widget.paneTitle?.call(pane) ?? pane.sessionId,
|
||||
paneId: pane.id,
|
||||
onActivate: () {
|
||||
@@ -193,6 +193,9 @@ class _ChatWorkspaceState extends State<ChatWorkspace> {
|
||||
child: Semantics(
|
||||
identifier: 'chat-pane-${pane.id}',
|
||||
container: true,
|
||||
sortKey: mobile == null
|
||||
? null
|
||||
: const OrdinalSortKey(0),
|
||||
child: widget.paneBuilder(
|
||||
context,
|
||||
pane,
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Mobile chat client release — 6 November 2026
|
||||
|
||||
Mobile source `be6c6a47` (including renderer follow-up `2cadebab`) landed in main; ancestry verified after landing. Chat headers offer Add chat pane, the phone list offers Open below, narrow views animate active/inactive panes at80/20, and unfolded list/detail workspaces retain the sidebar hide/compact controls. Stable thread identities retain drafts and desktop geometry; native phone Back remains stock Navigator behavior.
|
||||
|
||||
Final checks: chat891, application143, shell123 passed. Combined main source additionally passed application143 and Settings118, with clean bounded analysis. The earlier pre-fix application run's two Back assertions were corrected and the entire application suite rerun successfully. Production web and APK builds passed. Browser Material/Cupertino screenshots and a real intermediate-frame transition film were inspected; see mobile-chat-peeks.md for captures. No physical Android/Fold test or device installation was performed.
|
||||
|
||||
Published Android **29900029**, APK SHA256 `4912777b1ff082cb96592d249ba2c905ad26c7f2da8e5764feb10e47d6c829ad`; signing identity matches the installed release. Web JS SHA256 `ad037520239082188dd45bd2966ebf39d27b56fcd765804965eb8f86bf01b3ee`. Authenticated loopback and public HTTPS JS/feed/APK downloads matched built bytes.
|
||||
|
||||
Rollback directories under `~/.local/share/pipelines/lib/`: `app-web.before-web-update-1794001949383637000` and `app-updates.before-client-update-1794001949507188000`.
|
||||
|
||||
This publication intentionally uses the mobile-only branch source. Storage code is landed in main but its client entry and matching backend are not published yet: the live gate still reports one active Codex chat. No server restart, production retention activation or cleanup occurred. See docs/notes/storage-delivery-pending.md for staged binaries and the guarded rollout. Deferred desktop/export work remains untouched.
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
|
||||
|
||||
@@ -30,6 +31,7 @@ class _Draft extends StatefulWidget {
|
||||
|
||||
class _DraftState extends State<_Draft> {
|
||||
final controller = TextEditingController();
|
||||
int layouts = 0;
|
||||
@override
|
||||
void dispose() {
|
||||
controller.dispose();
|
||||
@@ -37,14 +39,43 @@ class _DraftState extends State<_Draft> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
Material(child: TextField(controller: controller));
|
||||
Widget build(BuildContext context) => Material(
|
||||
child: _LayoutCounter(
|
||||
onLayout: () => layouts++,
|
||||
child: TextField(controller: controller),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _LayoutCounter extends SingleChildRenderObjectWidget {
|
||||
const _LayoutCounter({required this.onLayout, required super.child});
|
||||
final VoidCallback onLayout;
|
||||
@override
|
||||
RenderObject createRenderObject(BuildContext context) =>
|
||||
_CountLayouts(onLayout);
|
||||
@override
|
||||
void updateRenderObject(
|
||||
BuildContext context,
|
||||
covariant _CountLayouts renderObject,
|
||||
) {
|
||||
renderObject.onLayout = onLayout;
|
||||
}
|
||||
}
|
||||
|
||||
class _CountLayouts extends RenderProxyBox {
|
||||
_CountLayouts(this.onLayout);
|
||||
VoidCallback onLayout;
|
||||
@override
|
||||
void performLayout() {
|
||||
onLayout();
|
||||
super.performLayout();
|
||||
}
|
||||
}
|
||||
|
||||
Finder _rect(String pane) => find.byKey(ValueKey('chat-workspace-$pane'));
|
||||
void main() {
|
||||
testWidgets(
|
||||
'mobile peeks animate80/20 and retain drafts and saved geometry',
|
||||
'active chat promotes to top with cheap reveal and stable thread layout',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = const Size(560, 800);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
@@ -75,40 +106,42 @@ void main() {
|
||||
expect(oldHeight, closeTo((800 - 6) * .2, 1));
|
||||
expect(tester.getSize(_rect(second)).height, closeTo((800 - 6) * .8, 1));
|
||||
await tester.pumpAndSettle();
|
||||
final positionState = tester.state(_rect(first));
|
||||
await tester.tap(find.byKey(ValueKey('chat-peek-$first')));
|
||||
expect(
|
||||
controller.activePane?.sessionId,
|
||||
'a',
|
||||
reason: 'tap activates peek immediately',
|
||||
reason: 'tap activates immediately',
|
||||
);
|
||||
await tester.pump();
|
||||
expect(tester.state(_rect(first)), same(positionState));
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
expect(
|
||||
tester.widget<AnimatedPositioned>(_rect(first)).duration,
|
||||
const Duration(milliseconds: 220),
|
||||
expect(tester.getRect(_rect(first)).top, 0);
|
||||
expect(tester.getSize(_rect(first)).height, closeTo((800 - 6) * .8, 1));
|
||||
expect(tester.getRect(_rect(second)).top, closeTo((800 - 6) * .8 + 6, 1));
|
||||
final aLayouts = (aState as _DraftState).layouts;
|
||||
final bLayouts = (bState as _DraftState).layouts;
|
||||
await tester.pump(const Duration(milliseconds: 60));
|
||||
final reveal = tester.widget<FadeTransition>(
|
||||
find.byKey(ValueKey('chat-reveal-$first')),
|
||||
);
|
||||
final intermediate = tester.getSize(_rect(first)).height;
|
||||
expect(intermediate, greaterThan(oldHeight));
|
||||
expect(intermediate, lessThan((800 - 6) * .8));
|
||||
// Content follows the animated viewport, rather than jumping to the
|
||||
// target height and leaving a blank area during the transition.
|
||||
expect(reveal.opacity.value, greaterThan(.75));
|
||||
expect(reveal.opacity.value, lessThan(1));
|
||||
// The short animation only composites retained content. In particular,
|
||||
// neither transcript nor composer receives a new size on each tick.
|
||||
expect(
|
||||
tester.getSize(find.byKey(const ValueKey('a'))).height,
|
||||
closeTo(intermediate, 1),
|
||||
closeTo((800 - 6) * .8, 1),
|
||||
);
|
||||
final shrinkingHeight = tester.getSize(_rect(second)).height;
|
||||
expect(
|
||||
tester.getSize(find.byKey(const ValueKey('b'))).height,
|
||||
closeTo(shrinkingHeight < 300 ? 300 : shrinkingHeight, 1),
|
||||
closeTo((800 - 6) * .8, 1),
|
||||
);
|
||||
expect(aState.layouts, aLayouts);
|
||||
expect(bState.layouts, bLayouts);
|
||||
await tester.pumpAndSettle();
|
||||
expect(controller.activePane?.sessionId, 'a');
|
||||
expect(tester.getSize(_rect(first)).height, closeTo((800 - 6) * .8, 1));
|
||||
expect(tester.state(find.byKey(const ValueKey('a'))), same(aState));
|
||||
expect(tester.state(find.byKey(const ValueKey('b'))), same(bState));
|
||||
expect((bState as _DraftState).controller.text, 'Draft b');
|
||||
expect(bState.controller.text, 'Draft b');
|
||||
expect(
|
||||
tester
|
||||
.widget<EditableText>(
|
||||
@@ -121,8 +154,22 @@ void main() {
|
||||
.hasFocus,
|
||||
isFalse,
|
||||
);
|
||||
controller.activate(second);
|
||||
await tester.tap(find.byKey(ValueKey('chat-peek-$second')));
|
||||
await tester.pump();
|
||||
expect(tester.getRect(_rect(second)).top, 0);
|
||||
await tester.pump(const Duration(milliseconds: 20));
|
||||
await tester.tap(find.byKey(ValueKey('chat-peek-$first')));
|
||||
await tester.pump();
|
||||
await tester.tap(find.byKey(ValueKey('chat-peek-$second')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.getRect(_rect(second)).top, 0);
|
||||
expect(
|
||||
tester
|
||||
.widget<FadeTransition>(find.byKey(ValueKey('chat-reveal-$second')))
|
||||
.opacity
|
||||
.value,
|
||||
1,
|
||||
);
|
||||
expect(controller.snapshot()!.encode(), saved);
|
||||
await tester.pumpWidget(_host(controller, mobile: false));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -152,6 +199,14 @@ void main() {
|
||||
controller.activate(first);
|
||||
await tester.pump();
|
||||
expect(tester.getSize(_rect(first)).height, closeTo((800 - 6) * .8, 1));
|
||||
expect(tester.getRect(_rect(first)).top, 0);
|
||||
expect(
|
||||
tester
|
||||
.widget<FadeTransition>(find.byKey(ValueKey('chat-reveal-$first')))
|
||||
.opacity
|
||||
.value,
|
||||
1,
|
||||
);
|
||||
expect(find.byType(_Draft), findsNWidgets(2));
|
||||
expect(find.byType(_Draft, skipOffstage: false), findsNWidgets(3));
|
||||
controller.activate(third);
|
||||
|
||||
Reference in New Issue
Block a user