diff --git a/app/lib/features/chat/conversation/chat_pane_presentation.dart b/app/lib/features/chat/conversation/chat_pane_presentation.dart index 84b51acb..9150c8f3 100644 --- a/app/lib/features/chat/conversation/chat_pane_presentation.dart +++ b/app/lib/features/chat/conversation/chat_pane_presentation.dart @@ -47,29 +47,38 @@ class ChatPaneBarReveal extends StatelessWidget { final reveal = presentation.barReveal; final peek = presentation.peek; // One tree in both roles, so the bar's element outlives a switch. - return AnimatedBuilder( - animation: reveal, - child: IgnorePointer( - ignoring: peek, - child: SizeTransition( - alignment: Alignment.topCenter, - sizeFactor: reveal, - child: FadeTransition( - opacity: reveal, - child: SlideTransition( - position: Tween( - begin: const Offset(0, -slide), - end: Offset.zero, - ).animate(reveal), - // The bar's own picture holds while it slides; only its offset - // and alpha change per tick. - child: RepaintBoundary(child: bar), + // Overlay slots cap chrome at the pane height. A resting peek can be + // shorter than its retained composer (large text + keyboard). Give only + // chrome its natural height before SizeTransition consumes that height; + // the transcript itself always keeps the real pane constraints. + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + AnimatedBuilder( + animation: reveal, + child: IgnorePointer( + ignoring: peek, + child: SizeTransition( + alignment: Alignment.topCenter, + sizeFactor: reveal, + child: FadeTransition( + opacity: reveal, + child: SlideTransition( + position: Tween( + begin: const Offset(0, -slide), + end: Offset.zero, + ).animate(reveal), + // The bar's own picture holds while it slides; only its offset + // and alpha change per tick. + child: RepaintBoundary(child: bar), + ), + ), ), ), + builder: (context, child) => + Offstage(offstage: peek && reveal.value <= 0, child: child), ), - ), - builder: (context, child) => - Offstage(offstage: peek && reveal.value <= 0, child: child), + ], ); } } diff --git a/app/test/features/chat/conversation/chat_pane_presentation_test.dart b/app/test/features/chat/conversation/chat_pane_presentation_test.dart index 9597b9b7..7cc22f2d 100644 --- a/app/test/features/chat/conversation/chat_pane_presentation_test.dart +++ b/app/test/features/chat/conversation/chat_pane_presentation_test.dart @@ -14,6 +14,7 @@ Future _pump( WidgetTester tester, { required bool peek, required double reveal, + double? height, }) async { final gateway = FakeChatGateway(); addTearDown(gateway.close); @@ -31,14 +32,17 @@ Future _pump( await tester.pumpWidget( MaterialApp( home: Scaffold( - body: ChatPanePresentation( - peek: peek, - barReveal: AlwaysStoppedAnimation(reveal), - child: ChatThreadView( - gateway: gateway, - sessionId: 's', - title: 'Presented', - onBack: () {}, + body: SizedBox( + height: height, + child: ChatPanePresentation( + peek: peek, + barReveal: AlwaysStoppedAnimation(reveal), + child: ChatThreadView( + gateway: gateway, + sessionId: 's', + title: 'Presented', + onBack: () {}, + ), ), ), ), @@ -105,6 +109,24 @@ void main() { }, ); + testWidgets( + 'a retained peek composer measures naturally in a tiny viewport', + (tester) async { + await _pump(tester, peek: true, reveal: 0, height: 60); + expect(tester.takeException(), isNull); + expect( + find.byWidgetPredicate( + (widget) => widget is EditableText && !widget.readOnly, + ), + findsNothing, + ); + expect( + find.byKey(const ValueKey('chat-composer-s'), skipOffstage: false), + findsOneWidget, + ); + }, + ); + testWidgets('without a presentation the bar is itself', (tester) async { final gateway = FakeChatGateway(); addTearDown(gateway.close);