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:shared_preferences/shared_preferences.dart';
|
||||
import 'package:pipelines_app/features/chat/screen.dart';
|
||||
import 'package:pipelines_app/features/pipelines/screen.dart';
|
||||
@@ -175,39 +176,24 @@ void main() {
|
||||
selected,
|
||||
reason: '$destination: $rowKey after opening $key',
|
||||
);
|
||||
// Every list uses the shared row and its highlight.
|
||||
final context = tester.element(row);
|
||||
if (cupertino) {
|
||||
final color = destination == 'Runs'
|
||||
? tester.widget<CupertinoButton>(row).color
|
||||
: tester.widget<CupertinoListTile>(row).backgroundColor;
|
||||
expect(
|
||||
color,
|
||||
selected
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(
|
||||
context,
|
||||
)
|
||||
: isNull,
|
||||
);
|
||||
} else if (destination == 'Runs') {
|
||||
final id = rowKey.split('-').last;
|
||||
expect(
|
||||
tester
|
||||
.widget<Material>(
|
||||
find.byKey(ValueKey('run-row-surface-$id')),
|
||||
expect(tester.widget<AppListRow>(row).selected, selected);
|
||||
final surface = find.descendant(
|
||||
of: row,
|
||||
matching: find.byKey(appListRowSurfaceKey),
|
||||
);
|
||||
expect(
|
||||
cupertino
|
||||
? tester.widget<ColoredBox>(surface).color
|
||||
: tester.widget<Material>(surface).color,
|
||||
selected
|
||||
? AppListRow.selectedColor(
|
||||
context,
|
||||
cupertino: cupertino,
|
||||
)
|
||||
.color,
|
||||
selected
|
||||
? Theme.of(context).colorScheme.secondaryContainer
|
||||
: Colors.transparent,
|
||||
);
|
||||
} else {
|
||||
final tile = tester.widget<ListTile>(row);
|
||||
expect(tile.selected, selected);
|
||||
expect(
|
||||
tile.selectedTileColor,
|
||||
Theme.of(context).colorScheme.secondaryContainer,
|
||||
);
|
||||
}
|
||||
: const Color(0x00000000),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (destination == 'Chat') {
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
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/application/app_session.dart';
|
||||
import 'package:pipelines_app/application/pipelines_destination.dart';
|
||||
import 'package:pipelines_app/application/server_endpoint.dart';
|
||||
@@ -202,7 +203,9 @@ void main() {
|
||||
await tester.pump();
|
||||
expect(find.text('hash-alpha'), findsOneWidget);
|
||||
expect(
|
||||
tester.widget<ListTile>(find.byKey(const Key('pipeline-row-1'))).selected,
|
||||
tester
|
||||
.widget<AppListRow>(find.byKey(const Key('pipeline-row-1')))
|
||||
.selected,
|
||||
isTrue,
|
||||
);
|
||||
|
||||
@@ -229,7 +232,9 @@ void main() {
|
||||
expect(find.text('Reconnecting to Pipelines…'), findsNothing);
|
||||
expect(find.text('hash-alpha'), findsOneWidget);
|
||||
expect(
|
||||
tester.widget<ListTile>(find.byKey(const Key('pipeline-row-1'))).selected,
|
||||
tester
|
||||
.widget<AppListRow>(find.byKey(const Key('pipeline-row-1')))
|
||||
.selected,
|
||||
isTrue,
|
||||
reason: 'A reconnect must not remount the screen or drop the selection.',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user