merge(app): land decision banner
This commit is contained in:
@@ -23,14 +23,56 @@ class RunDecisionNotice extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final pending = pendingDecision(run);
|
||||
if (pending == null) return const SizedBox.shrink();
|
||||
final content = Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// 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: [
|
||||
Semantics(header: true, child: const Text(decisionWaitingTitle)),
|
||||
Text(decisionMeta(pending)),
|
||||
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,
|
||||
@@ -39,16 +81,5 @@ class RunDecisionNotice extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
);
|
||||
if (usesCupertinoHost(context)) {
|
||||
return CupertinoListSection.insetGrouped(
|
||||
children: [
|
||||
DefaultTextStyle(
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
child: content,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return Card(child: content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,17 @@ void main() {
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(decisionWaitingTitle), findsOneWidget);
|
||||
// The web's decision banner spans the header, with Decide trailing.
|
||||
final banner = tester.getRect(
|
||||
find.byKey(const Key('run-decision-banner')),
|
||||
);
|
||||
final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs')));
|
||||
expect(banner.left, tabs.left);
|
||||
expect(banner.width, greaterThan(tabs.width));
|
||||
expect(
|
||||
tester.getCenter(find.byKey(decisionActionKey)).dx,
|
||||
greaterThan(banner.center.dx),
|
||||
);
|
||||
await tester.tap(find.byKey(decisionActionKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user