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

86 lines
2.8 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();
// As the web's `.decision-card`: one full-width banner in the waiting
// colour, with the glyph, the title over its meta line, and the action on
// the trailing edge. 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,
margin: const EdgeInsets.only(top: 8),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
decoration: BoxDecoration(
color: color.withValues(alpha: 0.12),
border: Border.all(color: color),
borderRadius: BorderRadius.circular(10),
),
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,
),
],
),
);
}
}