WIP: pipeline page Runs/Run icon actions (run #230)

This commit is contained in:
2026-11-01 20:37:29 +00:00
parent 4503febb07
commit f8903e2f6d
6 changed files with 42 additions and 89 deletions
@@ -7,6 +7,7 @@ import '../../runs/data/runs_repository.dart';
import '../pipeline_models.dart';
import '../pipelines_controller.dart';
import '../run_pipeline_intent.dart';
import '../widgets/pipeline_bar_buttons.dart';
import '../widgets/pipeline_controls.dart';
import 'run_pipeline_dialog.dart';
import 'run_pipeline_wording.dart';
@@ -171,13 +172,12 @@ class _RunPipelineActionState extends State<RunPipelineAction> {
Widget build(BuildContext context) {
final label = const Text(runPipelineActionLabel);
if (widget.inBar) {
return pipelineBarAction(
return pipelineBarIconButton(
context,
key: runPipelineActionKey,
primary: true,
materialIcon: Icons.play_arrow,
label: 'Run ${widget.detail.displayName}',
icon: Icons.play_arrow_rounded,
cupertinoIcon: CupertinoIcons.play_fill,
label: runPipelineActionLabel,
onPressed: _open,
);
}
@@ -195,58 +195,3 @@ class _RunPipelineActionState extends State<RunPipelineAction> {
);
}
}
/// A pipeline action in its top bar's actions pill: the icon and word as one
/// compact button. The primary action (Run) is filled so it reads apart from
/// the plain ones around it.
Widget pipelineBarAction(
BuildContext context, {
required Key key,
required bool primary,
required IconData materialIcon,
required IconData cupertinoIcon,
required String label,
required VoidCallback? onPressed,
}) {
if (useCupertinoControls(context)) {
final content = Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(cupertinoIcon, size: 18),
const SizedBox(width: 6),
Flexible(child: Text(label, maxLines: 1, softWrap: false)),
],
);
const padding = EdgeInsets.symmetric(horizontal: 12, vertical: 6);
return primary
? CupertinoButton.filled(
key: key,
padding: padding,
minimumSize: Size.zero,
onPressed: onPressed,
child: content,
)
: CupertinoButton(
key: key,
padding: padding,
minimumSize: Size.zero,
onPressed: onPressed,
child: content,
);
}
final icon = Icon(materialIcon);
final text = Text(label, maxLines: 1, softWrap: false);
return primary
? FilledButton.icon(
key: key,
onPressed: onPressed,
icon: icon,
label: text,
)
: TextButton.icon(
key: key,
onPressed: onPressed,
icon: icon,
label: text,
);
}