import 'package:flutter/widgets.dart'; import '../../../core/api_gateway.dart'; import '../../artifacts/ui/artifact_gallery_action.dart'; import '../../schedules/ui/run/schedule_run_action.dart'; import '../actions/cancel_eligibility.dart'; import '../actions/cancel_run_action.dart'; import '../actions/retry_action.dart'; import '../actions/retry_eligibility.dart'; import '../actions/title_action.dart'; import 'run_decision_notice.dart'; /// Native actions on the loaded run, all using the app's one gateway and /// applying only accepted server detail through the same controller callback. class RunDetailActions extends StatelessWidget { const RunDetailActions({ super.key, required this.run, required this.gateway, required this.onRunChanged, this.onRunOpened, }); final JsonMap run; final ApiGateway gateway; final ValueChanged onRunChanged; /// Opens the new run named by an accepted retry reply; see [RetryRunAction]. final ValueChanged? onRunOpened; @override Widget build(BuildContext context) => Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ // Every run action uses one native style, as the web's `.run-action`: // outlined on Material, tinted on Cupertino; Cancel alone is tinted // destructive. Standard native spacing keeps adjacent buttons distinct. // Only actions that render are included: a hidden zero-size child still // consumes Wrap spacing and would double the visible gap. Wrap( spacing: 8, runSpacing: 4, crossAxisAlignment: WrapCrossAlignment.center, children: [ if (runTitleId(run) != null) RunTitleAction( run: run, gateway: gateway, onRunChanged: onRunChanged, ), if (canScheduleRun(run)) ScheduleRunAction(run: run, gateway: gateway), if (retryRunId(run) != null && canRetryRun(run)) RetryRunAction( run: run, gateway: gateway, onRunChanged: onRunChanged, onRunOpened: onRunOpened, ), if (cancelRunId(run) != null && canCancelRun(run)) CancelRunAction( run: run, gateway: gateway, onRunChanged: onRunChanged, ), if (showRunArtifactsAction(run)) RunArtifactsButton(run: run, gateway: gateway), ], ), RunDecisionNotice(run: run, gateway: gateway, onRunChanged: onRunChanged), ], ); }