merge(app): land decision banner
This commit is contained in:
@@ -23,14 +23,56 @@ class RunDecisionNotice extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final pending = pendingDecision(run);
|
final pending = pendingDecision(run);
|
||||||
if (pending == null) return const SizedBox.shrink();
|
if (pending == null) return const SizedBox.shrink();
|
||||||
final content = Padding(
|
// As the web's `.decision-card`: one full-width banner in the waiting
|
||||||
padding: const EdgeInsets.all(16),
|
// colour, with the glyph, the title over its meta line, and the action on
|
||||||
child: Column(
|
// the trailing edge. The same banner on both hosts.
|
||||||
mainAxisSize: MainAxisSize.min,
|
final cupertino = usesCupertinoHost(context);
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
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: [
|
children: [
|
||||||
Semantics(header: true, child: const Text(decisionWaitingTitle)),
|
Icon(
|
||||||
Text(decisionMeta(pending)),
|
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(
|
HumanDecisionAction(
|
||||||
run: run,
|
run: run,
|
||||||
gateway: gateway,
|
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();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text(decisionWaitingTitle), findsOneWidget);
|
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.tap(find.byKey(decisionActionKey));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
Reference in New Issue
Block a user