Narrow list panes: readable bar title, More overflow menu, rows keep status and actions
The floating bar keeps the title at its own width (up to half the bar) and moves overflowable actions into one More menu instead of squeezing them below their touch targets. List rows keep their leading status avatar and More actions at any list-pane width; the time moves under the subtitle.
This commit is contained in:
@@ -182,37 +182,40 @@ void main() {
|
||||
expect(_paint(tester, '9d ago').color, isNot(accent));
|
||||
});
|
||||
|
||||
testWidgets('$host: a narrow pane drops the avatar, time and menu', (
|
||||
tester,
|
||||
) async {
|
||||
_size(tester, 240);
|
||||
await tester.pumpWidget(_host(cupertino, _row()));
|
||||
expect(find.byKey(const Key('avatar')), findsNothing);
|
||||
expect(find.text('9d ago'), findsNothing);
|
||||
expect(find.byKey(const Key('menu')), findsNothing);
|
||||
expect(find.text('Running'), findsOneWidget);
|
||||
expect(find.text('pipeline · 2 stages'), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('$host: keepMenuWhenCompact keeps the menu', (tester) async {
|
||||
_size(tester, 240);
|
||||
await tester.pumpWidget(
|
||||
_host(
|
||||
cupertino,
|
||||
AppListRow(
|
||||
keepMenuWhenCompact: true,
|
||||
title: const Text('Chat'),
|
||||
menu: AppOverflowMenu<int>(
|
||||
key: const Key('menu'),
|
||||
actions: const [AppMenuAction(value: 1, label: 'Star')],
|
||||
onSelected: (_, _) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(find.byKey(const Key('menu')), findsOneWidget);
|
||||
});
|
||||
for (final width in [240.0, 270.0]) {
|
||||
for (final brightness in Brightness.values) {
|
||||
testWidgets('$host ${brightness.name}: a ${width.toInt()}px pane keeps '
|
||||
'the status avatar and the menu, and the time under the subtitle', (
|
||||
tester,
|
||||
) async {
|
||||
_size(tester, width);
|
||||
await tester.pumpWidget(
|
||||
_host(cupertino, brightness: brightness, _row(title: _longTitle)),
|
||||
);
|
||||
final row = tester.getRect(find.byKey(const Key('row')));
|
||||
final avatar = tester.getRect(find.byKey(const Key('avatar')));
|
||||
final menu = tester.getRect(find.byKey(const Key('menu')));
|
||||
// Both inside the row, at the leading and trailing edges.
|
||||
expect(avatar.left, greaterThanOrEqualTo(row.left));
|
||||
expect(menu.right, lessThanOrEqualTo(row.right));
|
||||
expect(menu.width, greaterThanOrEqualTo(44));
|
||||
expect(menu.height, greaterThanOrEqualTo(44));
|
||||
expect(find.text('Running'), findsOneWidget);
|
||||
expect(find.text('pipeline · 2 stages'), findsNothing);
|
||||
// The time sits on its own line, under the subtitle.
|
||||
final time = tester.getRect(find.text('9d ago'));
|
||||
final subtitle = tester.getRect(find.text('Running'));
|
||||
expect(time.top, greaterThanOrEqualTo(subtitle.bottom));
|
||||
expect(time.left, greaterThan(avatar.right));
|
||||
expect(time.right, lessThan(menu.left));
|
||||
// The title ellipsises between them.
|
||||
final title = tester.getRect(find.text(_longTitle));
|
||||
expect(title.left, greaterThan(avatar.right));
|
||||
expect(title.right, lessThanOrEqualTo(menu.left));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (final brightness in Brightness.values) {
|
||||
testWidgets('$host ${brightness.name}: 320px at 2x text ellipsises '
|
||||
|
||||
Reference in New Issue
Block a user