fix(chat): centre the pending dots on the activity text
The dots were period glyphs sitting on the baseline, so they read low beside the label. They are now round dots sized from the surrounding text, vertically centred with it and scaling with it.
This commit is contained in:
@@ -194,8 +194,42 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('.'), findsNWidgets(3));
|
||||
// Three steady dots, all fully drawn, with no animation scheduled.
|
||||
final opacities = tester
|
||||
.widgetList<Opacity>(
|
||||
find.descendant(
|
||||
of: find.byType(ChatResponsePending),
|
||||
matching: find.byType(Opacity),
|
||||
),
|
||||
)
|
||||
.map((widget) => widget.opacity);
|
||||
expect(opacities, [1, 1, 1]);
|
||||
expect(find.bySemanticsLabel('Assistant is responding'), findsOneWidget);
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
});
|
||||
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('the pending dots sit on the activity text\'s middle '
|
||||
'($cupertino)', (tester) async {
|
||||
final gateway = _Gateway();
|
||||
addTearDown(gateway.close);
|
||||
await _host(tester, gateway, cupertino: cupertino);
|
||||
await _send(tester);
|
||||
|
||||
final dots = tester.getRect(
|
||||
find.byKey(const Key('chat-response-pending-dots')),
|
||||
);
|
||||
final label = tester.getRect(find.textContaining('Thinking'));
|
||||
expect(dots.center.dy, closeTo(label.center.dy, 1));
|
||||
expect(dots.height, lessThanOrEqualTo(label.height));
|
||||
// Round dots, not baseline glyphs.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(ChatResponsePending),
|
||||
matching: find.text('.'),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user