Files
pipelines/app/lib/features/runs/ui/run_decision_notice.dart
T

81 lines
2.6 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../actions/decision_action.dart';
import '../actions/decision_wording.dart';
import '../domain/run_decisions.dart';
/// A recorded human checkpoint, never an audit-export/resource wait.
class RunDecisionNotice extends StatelessWidget {
const RunDecisionNotice({
super.key,
required this.run,
required this.gateway,
required this.onRunChanged,
});
final JsonMap run;
final ApiGateway gateway;
final ValueChanged<JsonMap> onRunChanged;
@override
Widget build(BuildContext context) {
final pending = pendingDecision(run);
if (pending == null) return const SizedBox.shrink();
// One full-width line of the header strip: the glyph in the waiting
// colour, the title over its meta line, and the action on the trailing
// edge. The strip is already the frame, so the banner draws no card,
// border or tint of its own. The same banner on both hosts.
final cupertino = usesCupertinoHost(context);
final color = CupertinoColors.systemTeal.resolveFrom(context);
final metaStyle = cupertino
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
color: CupertinoColors.secondaryLabel.resolveFrom(context),
)
: Theme.of(context).textTheme.bodySmall;
return Container(
key: const Key('run-decision-banner'),
width: double.infinity,
padding: const EdgeInsets.only(top: 8, bottom: 4),
child: Row(
children: [
Icon(
cupertino ? CupertinoIcons.clock : Icons.schedule,
color: color,
size: 18,
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Semantics(
header: true,
child: const Text(
decisionWaitingTitle,
style: TextStyle(fontWeight: FontWeight.w600),
),
),
const SizedBox(height: 2),
Text(
decisionMeta(pending),
style: metaStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
const SizedBox(width: 12),
HumanDecisionAction(
run: run,
gateway: gateway,
onRunChanged: onRunChanged,
),
],
),
);
}
}