polish compact pipeline and run lists
This commit is contained in:
@@ -208,8 +208,9 @@ class PipelineListPanel extends StatelessWidget {
|
||||
),
|
||||
visualDensity: VisualDensity.compact,
|
||||
leading: compact ? null : _pipelineIdentityIcon(context),
|
||||
title: _rowTitle(context, pipeline),
|
||||
subtitle: _rowMetadata(context, pipeline, now),
|
||||
title: _rowTitle(context, pipeline, compact: compact),
|
||||
subtitle: _rowMetadata(context, pipeline, now, compact: compact),
|
||||
trailing: compact ? null : const Icon(Icons.chevron_right),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -236,8 +237,13 @@ class PipelineListPanel extends StatelessWidget {
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||
: null,
|
||||
leading: compact ? null : _pipelineIdentityIcon(context),
|
||||
title: _rowTitle(context, pipeline),
|
||||
subtitle: _rowMetadata(context, pipeline, now),
|
||||
title: _rowTitle(context, pipeline, compact: compact),
|
||||
subtitle: _rowMetadata(
|
||||
context,
|
||||
pipeline,
|
||||
now,
|
||||
compact: compact,
|
||||
),
|
||||
trailing: compact ? null : const CupertinoListTileChevron(),
|
||||
onTap: () => controller.openPipeline(
|
||||
pipeline.id,
|
||||
@@ -252,8 +258,21 @@ class PipelineListPanel extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// The row's title line: its name, and its version and id in the corner.
|
||||
Widget _rowTitle(BuildContext context, PipelineSummary pipeline) {
|
||||
/// A narrow split pane keeps the name alone; the detail preserves identity.
|
||||
Widget _rowTitle(
|
||||
BuildContext context,
|
||||
PipelineSummary pipeline, {
|
||||
required bool compact,
|
||||
}) {
|
||||
final muted = _mutedStyle(context);
|
||||
if (compact) {
|
||||
return Text(
|
||||
pipeline.displayName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
);
|
||||
}
|
||||
return _measured(
|
||||
Row(
|
||||
children: [
|
||||
@@ -286,8 +305,9 @@ class PipelineListPanel extends StatelessWidget {
|
||||
Widget _rowMetadata(
|
||||
BuildContext context,
|
||||
PipelineSummary pipeline,
|
||||
DateTime now,
|
||||
) {
|
||||
DateTime now, {
|
||||
required bool compact,
|
||||
}) {
|
||||
final style = _mutedStyle(context);
|
||||
final what = [
|
||||
pipelineStageSummary(pipeline),
|
||||
@@ -328,6 +348,35 @@ class PipelineListPanel extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
// A 640px window can leave this pane about 130px wide. At that size the
|
||||
// latest state is the useful decision signal; stage counts, timestamps,
|
||||
// graph cues and version live in the selected pipeline's detail instead.
|
||||
if (compact) {
|
||||
// Do not turn an in-flight or failed run-history read into a false
|
||||
// no-runs claim. The normal row also stays blank until history is known.
|
||||
if (badge == null) return lastRun;
|
||||
return Semantics(
|
||||
label: runStateLabel(badge.state),
|
||||
child: Row(
|
||||
children: [
|
||||
RunStatusIcon(
|
||||
state: badge.state,
|
||||
label: runStateLabel(badge.state),
|
||||
size: 14,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Text(
|
||||
runStateLabel(badge.state),
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return _measured(
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
||||
@@ -364,7 +364,7 @@ class RunListRow extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
final scheduled = run['scheduled'] == true;
|
||||
Widget body(bool withMenu) => Row(
|
||||
Widget body(bool withMenu, bool compact) => Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
@@ -377,24 +377,50 @@ class RunListRow extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
line(title, id == null ? null : '#$id', titleStyle),
|
||||
const SizedBox(height: 2),
|
||||
line(
|
||||
[?pipelineLabel, if (scheduled) 'Scheduled'].join(' · '),
|
||||
facts.duration,
|
||||
small,
|
||||
),
|
||||
line(facts.when, facts.progress, small),
|
||||
// The run's path, each stage in its own result colour.
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: RunPathMini(run: run),
|
||||
),
|
||||
),
|
||||
],
|
||||
children: compact
|
||||
? [
|
||||
Text(
|
||||
title,
|
||||
style: titleStyle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
// The stored pipeline name is a fallback when the API
|
||||
// has no human-readable pipeline title. Avoid repeating
|
||||
// it if it already supplies the row title.
|
||||
[
|
||||
?pipelineLabel,
|
||||
if (scheduled) 'Scheduled',
|
||||
if (run['executing'] == true && facts.progress != null)
|
||||
facts.progress!,
|
||||
if (pipelineLabel == null && facts.duration != null)
|
||||
facts.duration!,
|
||||
].join(' · '),
|
||||
style: small,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
]
|
||||
: [
|
||||
line(title, id == null ? null : '#$id', titleStyle),
|
||||
const SizedBox(height: 2),
|
||||
line(
|
||||
[?pipelineLabel, if (scheduled) 'Scheduled'].join(' · '),
|
||||
facts.duration,
|
||||
small,
|
||||
),
|
||||
line(facts.when, facts.progress, small),
|
||||
// The run's path, each stage in its own result colour.
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: RunPathMini(run: run),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (withMenu &&
|
||||
@@ -417,8 +443,10 @@ class RunListRow extends StatelessWidget {
|
||||
final padded = Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) =>
|
||||
body(constraints.maxWidth >= _menuMinRowWidth),
|
||||
builder: (context, constraints) {
|
||||
final compact = constraints.maxWidth < _menuMinRowWidth;
|
||||
return body(!compact, compact);
|
||||
},
|
||||
),
|
||||
);
|
||||
return Semantics(
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -114,6 +116,101 @@ void main() {
|
||||
expect(find.textContaining('updated 17 Oct 21:26'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('compact split panes prioritise a pipeline name and state', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(640, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: 200,
|
||||
height: 700,
|
||||
child: PipelinesScreen(gateway: gatewayFor(PipelineFixture())),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final firstRow = find.byKey(const Key('pipeline-row-1'));
|
||||
expect(
|
||||
find.descendant(of: firstRow, matching: find.text('Alpha review')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: firstRow, matching: find.text('Succeeded')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: firstRow, matching: find.textContaining('v2 · #1')),
|
||||
findsNothing,
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: firstRow,
|
||||
matching: find.byIcon(Icons.account_tree_outlined),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('compact rows do not claim no runs while history is loading', (
|
||||
tester,
|
||||
) async {
|
||||
final fixture = PipelineFixture();
|
||||
final runs = Completer<Map<String, dynamic>>();
|
||||
final gateway = FakeGateway(
|
||||
(type, fields) => switch (type) {
|
||||
'list_pipelines' => pipelineListReply(fixture.summaries),
|
||||
'list_runs' => runs.future,
|
||||
_ => errorReply('unexpected $type'),
|
||||
},
|
||||
);
|
||||
tester.view.physicalSize = const Size(640, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: Center(
|
||||
child: SizedBox(
|
||||
width: 200,
|
||||
height: 700,
|
||||
child: PipelinesScreen(gateway: gateway),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
|
||||
final firstRow = find.byKey(const Key('pipeline-row-1'));
|
||||
expect(firstRow, findsOneWidget);
|
||||
expect(
|
||||
find.descendant(of: firstRow, matching: find.text('No runs recorded')),
|
||||
findsNothing,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: firstRow, matching: find.text('no runs recorded')),
|
||||
findsNothing,
|
||||
);
|
||||
|
||||
runs.complete(runListReply(fixture.runs));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.descendant(of: firstRow, matching: find.text('Succeeded')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('Cupertino keeps native tiles with the same row identity', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
@@ -104,4 +104,30 @@ void main() {
|
||||
expect(find.byKey(const ValueKey('run-list-more-menu-42')), findsOneWidget);
|
||||
expect(find.byKey(runMoreMenuKey), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('compact rows keep a title and one metadata line', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(240, 400);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: RunListRow(
|
||||
run: _finished,
|
||||
now: DateTime.utc(2026, 10, 22),
|
||||
gateway: _FakeGateway(),
|
||||
onRunChanged: (_) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Ship the release notes'), findsOneWidget);
|
||||
expect(find.text('release'), findsOneWidget);
|
||||
expect(find.text('2m 5s'), findsNothing);
|
||||
expect(find.byKey(const ValueKey('run-list-more-menu-42')), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user