polish compact pipeline and run lists
This commit is contained in:
@@ -208,8 +208,9 @@ class PipelineListPanel extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
leading: compact ? null : _pipelineIdentityIcon(context),
|
leading: compact ? null : _pipelineIdentityIcon(context),
|
||||||
title: _rowTitle(context, pipeline),
|
title: _rowTitle(context, pipeline, compact: compact),
|
||||||
subtitle: _rowMetadata(context, pipeline, now),
|
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)
|
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||||
: null,
|
: null,
|
||||||
leading: compact ? null : _pipelineIdentityIcon(context),
|
leading: compact ? null : _pipelineIdentityIcon(context),
|
||||||
title: _rowTitle(context, pipeline),
|
title: _rowTitle(context, pipeline, compact: compact),
|
||||||
subtitle: _rowMetadata(context, pipeline, now),
|
subtitle: _rowMetadata(
|
||||||
|
context,
|
||||||
|
pipeline,
|
||||||
|
now,
|
||||||
|
compact: compact,
|
||||||
|
),
|
||||||
trailing: compact ? null : const CupertinoListTileChevron(),
|
trailing: compact ? null : const CupertinoListTileChevron(),
|
||||||
onTap: () => controller.openPipeline(
|
onTap: () => controller.openPipeline(
|
||||||
pipeline.id,
|
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.
|
/// 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);
|
final muted = _mutedStyle(context);
|
||||||
|
if (compact) {
|
||||||
|
return Text(
|
||||||
|
pipeline.displayName,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||||
|
);
|
||||||
|
}
|
||||||
return _measured(
|
return _measured(
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -286,8 +305,9 @@ class PipelineListPanel extends StatelessWidget {
|
|||||||
Widget _rowMetadata(
|
Widget _rowMetadata(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
PipelineSummary pipeline,
|
PipelineSummary pipeline,
|
||||||
DateTime now,
|
DateTime now, {
|
||||||
) {
|
required bool compact,
|
||||||
|
}) {
|
||||||
final style = _mutedStyle(context);
|
final style = _mutedStyle(context);
|
||||||
final what = [
|
final what = [
|
||||||
pipelineStageSummary(pipeline),
|
pipelineStageSummary(pipeline),
|
||||||
@@ -328,6 +348,35 @@ class PipelineListPanel extends StatelessWidget {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink();
|
: 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(
|
return _measured(
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ class RunListRow extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
final scheduled = run['scheduled'] == true;
|
final scheduled = run['scheduled'] == true;
|
||||||
Widget body(bool withMenu) => Row(
|
Widget body(bool withMenu, bool compact) => Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
@@ -377,24 +377,50 @@ class RunListRow extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: compact
|
||||||
line(title, id == null ? null : '#$id', titleStyle),
|
? [
|
||||||
const SizedBox(height: 2),
|
Text(
|
||||||
line(
|
title,
|
||||||
[?pipelineLabel, if (scheduled) 'Scheduled'].join(' · '),
|
style: titleStyle,
|
||||||
facts.duration,
|
maxLines: 1,
|
||||||
small,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
line(facts.when, facts.progress, small),
|
const SizedBox(height: 2),
|
||||||
// The run's path, each stage in its own result colour.
|
Text(
|
||||||
Padding(
|
// The stored pipeline name is a fallback when the API
|
||||||
padding: const EdgeInsets.only(top: 4),
|
// has no human-readable pipeline title. Avoid repeating
|
||||||
child: Align(
|
// it if it already supplies the row title.
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
[
|
||||||
child: RunPathMini(run: run),
|
?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 &&
|
if (withMenu &&
|
||||||
@@ -417,8 +443,10 @@ class RunListRow extends StatelessWidget {
|
|||||||
final padded = Padding(
|
final padded = Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) =>
|
builder: (context, constraints) {
|
||||||
body(constraints.maxWidth >= _menuMinRowWidth),
|
final compact = constraints.maxWidth < _menuMinRowWidth;
|
||||||
|
return body(!compact, compact);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Semantics(
|
return Semantics(
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -114,6 +116,101 @@ void main() {
|
|||||||
expect(find.textContaining('updated 17 Oct 21:26'), findsOneWidget);
|
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', (
|
testWidgets('Cupertino keeps native tiles with the same row identity', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
@@ -104,4 +104,30 @@ void main() {
|
|||||||
expect(find.byKey(const ValueKey('run-list-more-menu-42')), findsOneWidget);
|
expect(find.byKey(const ValueKey('run-list-more-menu-42')), findsOneWidget);
|
||||||
expect(find.byKey(runMoreMenuKey), findsNothing);
|
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