Share one list row across runs, pipelines, chat, search and schedules
AppListRow (Material + Cupertino) with avatar, bold title and trailing time, one muted line, one overflow menu style, inset dividers, selected and emphasised states and a compact mode. Pipelines get a legible initial avatar, schedule rows shrink to two lines with Edit/Pause/Delete in an overflow menu, and the shell chat list scrolls behind the bar.
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:ui' show Tristate;
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/sessions/chat_sessions_screen.dart';
|
||||
|
||||
import 'chat_test_harness.dart';
|
||||
@@ -59,24 +60,23 @@ void main() {
|
||||
Tristate.isTrue,
|
||||
active,
|
||||
);
|
||||
if (cupertino) {
|
||||
final tile = tester.widget<CupertinoListTile>(row);
|
||||
expect(
|
||||
tile.backgroundColor,
|
||||
active
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(
|
||||
tester.element(row),
|
||||
)
|
||||
: isNull,
|
||||
);
|
||||
} else {
|
||||
final tile = tester.widget<ListTile>(row);
|
||||
expect(tile.selected, active);
|
||||
expect(
|
||||
tile.selectedTileColor,
|
||||
Theme.of(tester.element(row)).colorScheme.secondaryContainer,
|
||||
);
|
||||
}
|
||||
expect(tester.widget<AppListRow>(row).selected, active);
|
||||
final surface = find.descendant(
|
||||
of: row,
|
||||
matching: find.byKey(appListRowSurfaceKey),
|
||||
);
|
||||
final color = cupertino
|
||||
? tester.widget<ColoredBox>(surface).color
|
||||
: tester.widget<Material>(surface).color;
|
||||
expect(
|
||||
color,
|
||||
active
|
||||
? AppListRow.selectedColor(
|
||||
tester.element(row),
|
||||
cupertino: cupertino,
|
||||
)
|
||||
: const Color(0x00000000),
|
||||
);
|
||||
}
|
||||
|
||||
expectRow('a', true);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/sessions/session_list_cupertino.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/sessions/session_row_content.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/sessions/session_row_style.dart';
|
||||
|
||||
/// A grouped Cupertino list, the host the web client runs on macOS/iOS.
|
||||
/// The Cupertino list, the host the web client runs on macOS/iOS.
|
||||
Future<void> _pumpRows(
|
||||
WidgetTester tester,
|
||||
List<JsonMap> sessions, {
|
||||
@@ -193,7 +194,7 @@ void main() {
|
||||
|
||||
// Unread is bold with an accent time and dot; read rows are not.
|
||||
expect(_styleOf(tester, 'Unread chat').fontWeight, FontWeight.w700);
|
||||
expect(_styleOf(tester, 'Read chat').fontWeight, FontWeight.w500);
|
||||
expect(_styleOf(tester, 'Read chat').fontWeight, FontWeight.w600);
|
||||
expect(find.byKey(const Key('chat-row-unread')), findsOneWidget);
|
||||
final accent = CupertinoTheme.of(
|
||||
tester.element(find.text('5 min ago')),
|
||||
@@ -216,10 +217,10 @@ void main() {
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byType(CupertinoListTile), findsNWidgets(2));
|
||||
expect(find.byType(AppListRow), findsNWidgets(2));
|
||||
expect(
|
||||
tester.getTopLeft(find.byKey(const Key('chat-row-s2'))).dy,
|
||||
greaterThan(
|
||||
greaterThanOrEqualTo(
|
||||
tester.getBottomLeft(find.byKey(const Key('chat-row-s1'))).dy,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/app_list_row.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/sessions/session_list_material.dart';
|
||||
import 'package:pipelines_app/features/chat/ui/sessions/session_row_content.dart';
|
||||
import 'expand_closed.dart';
|
||||
|
||||
/// The Android host: a Material grouped list with its native separators.
|
||||
/// The Android host: the Material list with the shared row's dividers.
|
||||
Future<void> _pumpRows(
|
||||
WidgetTester tester,
|
||||
List<JsonMap> sessions, {
|
||||
@@ -107,11 +108,16 @@ void main() {
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// Native Material separators sit between rows, not around the group.
|
||||
expect(find.byType(Divider), findsOneWidget);
|
||||
// One inset divider between the rows, none after the last; it starts
|
||||
// under the text, not at the edge.
|
||||
expect(find.byKey(appListRowDividerKey), findsOneWidget);
|
||||
expect(
|
||||
tester.getTopLeft(find.byKey(appListRowDividerKey)).dx,
|
||||
closeTo(title.left, 1),
|
||||
);
|
||||
expect(
|
||||
tester.getTopLeft(find.byKey(const Key('chat-row-s2'))).dy,
|
||||
greaterThan(
|
||||
greaterThanOrEqualTo(
|
||||
tester.getBottomLeft(find.byKey(const Key('chat-row-s1'))).dy,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user