merge(app): land run status kicker
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../domain/run_models.dart';
|
||||
import 'run_changes_action.dart';
|
||||
import 'run_detail_content.dart';
|
||||
@@ -71,12 +72,16 @@ Widget buildCupertinoRunDetail({
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
RunStatusKicker(
|
||||
state: runStateOf(run['status']),
|
||||
label: runStatusLabel(run),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
detailTitle(run),
|
||||
style: theme.textTheme.navLargeTitleTextStyle,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(runStatusLabel(run)),
|
||||
Text('Run ${run['id']} · Pipeline ${detailPipeline(run)}'),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../domain/run_models.dart';
|
||||
import 'run_changes_action.dart';
|
||||
import 'run_detail_content.dart';
|
||||
@@ -59,6 +60,16 @@ Widget buildMaterialRunDetail({
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: RunStatusKicker(
|
||||
state: runStateOf(run['status']),
|
||||
label: runStatusLabel(run),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
|
||||
child: Text(detailTitle(run), style: theme.textTheme.headlineSmall),
|
||||
),
|
||||
Padding(
|
||||
@@ -68,7 +79,6 @@ Widget buildMaterialRunDetail({
|
||||
runSpacing: 4,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Chip(label: Text(runStatusLabel(run))),
|
||||
Text('Run ${run['id']}'),
|
||||
Text('Pipeline ${detailPipeline(run)}'),
|
||||
headerActions,
|
||||
|
||||
@@ -71,3 +71,32 @@ IconData _cupertinoIcon(String state) => switch (state) {
|
||||
'waiting' || 'queued' => CupertinoIcons.clock,
|
||||
_ => CupertinoIcons.question_circle,
|
||||
};
|
||||
|
||||
/// The run detail's kicker above its title, as the web's `run-kicker`: the
|
||||
/// status glyph and the state word in the state's colour.
|
||||
class RunStatusKicker extends StatelessWidget {
|
||||
const RunStatusKicker({super.key, required this.state, required this.label});
|
||||
|
||||
final String state;
|
||||
final String label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = runStatusColor(state).resolveFrom(context);
|
||||
return Row(
|
||||
key: const Key('run-status-kicker'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
RunStatusIcon(state: state, label: label, size: 16),
|
||||
const SizedBox(width: 6),
|
||||
// A long state (`cancel requested`) wraps rather than overflowing a
|
||||
// 320px pane at 2x text.
|
||||
Flexible(
|
||||
child: ExcludeSemantics(
|
||||
child: Text(label, style: TextStyle(color: color)),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,8 +147,13 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(find.text('Nightly build'), findsOneWidget);
|
||||
expect(find.textContaining('Original prompt'), findsOneWidget);
|
||||
// Both hosts lead with the web's status kicker above the title.
|
||||
expect(find.byKey(const Key('run-status-kicker')), findsOneWidget);
|
||||
expect(
|
||||
tester.getTopLeft(find.byKey(const Key('run-status-kicker'))).dy,
|
||||
lessThan(tester.getTopLeft(find.text('Nightly build')).dy),
|
||||
);
|
||||
if (platform == AppPlatform.material) {
|
||||
expect(find.byType(Chip), findsOneWidget);
|
||||
expect(
|
||||
tester.widget(find.byKey(const ValueKey('run-detail-summary-input'))),
|
||||
isA<ExpansionTile>(),
|
||||
|
||||
Reference in New Issue
Block a user