Preserve caption focus and scale readable chat controls

This commit is contained in:
2026-11-07 21:02:41 +00:00
parent 03ac760361
commit 1da3da92a3
7 changed files with 109 additions and 19 deletions
@@ -199,7 +199,7 @@ void main() {
final actions = find.byKey(const Key('chat-actions-island'));
expect(selectors, findsOneWidget);
expect(actions, findsOneWidget);
if (width >= 800) {
if (width / 2 >= 800) {
expect(
tester.getTopRight(selectors).dx,
lessThan(tester.getTopLeft(actions).dx),
@@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
void main() {
testWidgets('caption clicks select once and preserve text-field focus', (
tester,
) async {
final focus = FocusNode();
addTearDown(focus.dispose);
var selections = 0;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Column(
children: [
TextField(focusNode: focus),
FloatingDestinationBar(
cupertino: false,
currentIndex: 0,
showLabels: true,
items: const [
FloatingDestinationItem(
label: 'Chat',
icon: Icon(Icons.chat),
),
],
onTap: (_) => selections++,
),
],
),
),
),
);
await tester.pumpAndSettle();
focus.requestFocus();
await tester.pump();
expect(focus.hasFocus, isTrue);
await tester.tap(find.text('Chat'));
await tester.pump();
expect(selections, 1);
expect(focus.hasFocus, isTrue);
expect(tester.takeException(), isNull);
});
}