fix(chat): collapse trust/rating strips while the keyboard is open

On short screens (e.g. landscape) the fixed-height trust and rating
strips plus the composer overflowed the body once the keyboard shrank
it. Wrap the two secondary strips in HideWhenKeyboardOpen so they yield
their vertical space while typing and reappear when the keyboard closes.
This commit is contained in:
vjrj 2026-07-13 17:19:47 +02:00
parent 37761a029c
commit f1e4fe377a
2 changed files with 44 additions and 2 deletions

View file

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tane/ui/chat_screen.dart';
void main() {
Widget host({required double keyboardInset}) => MediaQuery(
data: MediaQueryData(viewInsets: EdgeInsets.only(bottom: keyboardInset)),
child: const Directionality(
textDirection: TextDirection.ltr,
child: HideWhenKeyboardOpen(child: Text('banner')),
),
);
testWidgets('shows its child when the keyboard is closed', (tester) async {
await tester.pumpWidget(host(keyboardInset: 0));
expect(find.text('banner'), findsOneWidget);
});
testWidgets('hides its child when the keyboard is open', (tester) async {
await tester.pumpWidget(host(keyboardInset: 300));
expect(find.text('banner'), findsNothing);
});
}