Merge commit '98e2abd9af3a67c57ff42181aa1e5d1817dd3270' into pipelines/run-20261111-0410-cupertino-out-schedules-37d5

This commit is contained in:
2026-11-11 04:26:25 +00:00
66 changed files with 1891 additions and 3327 deletions
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'action_refusal.dart';
@@ -21,16 +20,8 @@ Future<void> showCancelRunPrompt({
}) {
final prompt = _CancelPrompt(
runId: runId,
cupertino: cupertino,
onSubmit: onSubmit,
);
if (cupertino) {
return showCupertinoDialog<void>(
context: context,
barrierDismissible: false,
builder: (_) => prompt,
);
}
return showDialog<void>(
context: context,
barrierDismissible: false,
@@ -39,14 +30,9 @@ Future<void> showCancelRunPrompt({
}
class _CancelPrompt extends StatefulWidget {
const _CancelPrompt({
required this.runId,
required this.cupertino,
required this.onSubmit,
});
const _CancelPrompt({required this.runId, required this.onSubmit});
final num runId;
final bool cupertino;
final CancelSubmit onSubmit;
@override
@@ -97,8 +83,7 @@ class _CancelPromptState extends State<_CancelPrompt> {
@override
Widget build(BuildContext context) {
final dialog = widget.cupertino ? _cupertino(context) : _material(context);
return PopScope(canPop: !_sending, child: dialog);
return PopScope(canPop: !_sending, child: _material(context));
}
bool get _confirmDisabled => _sending || _checking || _blocked;
@@ -124,30 +109,6 @@ class _CancelPromptState extends State<_CancelPrompt> {
);
}
Widget _cupertino(BuildContext context) {
return CupertinoAlertDialog(
title: Text(cancelDialogTitle(widget.runId)),
content: _body(
errorStyle: TextStyle(
color: CupertinoColors.systemRed.resolveFrom(context),
),
),
actions: [
CupertinoDialogAction(
key: cancelKeepKey,
onPressed: _sending ? null : _keep,
child: const Text(cancelKeepLabel),
),
CupertinoDialogAction(
key: cancelConfirmKey,
isDestructiveAction: true,
onPressed: _confirmDisabled ? null : _confirm,
child: const Text(cancelConfirmLabel),
),
],
);
}
Widget _body({required TextStyle errorStyle}) {
return Column(
mainAxisSize: MainAxisSize.min,
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
@@ -36,14 +35,6 @@ class _CancelRunActionState extends State<CancelRunAction> {
bool _dialogOpen = false;
Future<bool?>? _resync;
bool _usesCupertino(BuildContext context) {
final material = Localizations.of<MaterialLocalizations>(
context,
MaterialLocalizations,
);
return material == null;
}
Future<void> _open() async {
final id = cancelRunId(widget.run);
if (id == null || !canCancelRun(widget.run) || _dialogOpen) return;
@@ -52,7 +43,7 @@ class _CancelRunActionState extends State<CancelRunAction> {
await showCancelRunPrompt(
context: context,
runId: id,
cupertino: _usesCupertino(context),
cupertino: false,
onSubmit: () => _submit(id),
);
} finally {
@@ -103,16 +94,6 @@ class _CancelRunActionState extends State<CancelRunAction> {
if (cancelRunId(widget.run) == null || !canCancelRun(widget.run)) {
return const SizedBox.shrink();
}
if (_usesCupertino(context)) {
// The web tints Cancel as the one destructive run action.
return CupertinoButton.tinted(
sizeStyle: CupertinoButtonSize.small,
key: cancelActionKey,
color: CupertinoColors.systemRed,
onPressed: _open,
child: const Text(cancelActionLabel),
);
}
return OutlinedButton(
key: cancelActionKey,
style: OutlinedButton.styleFrom(
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
@@ -30,7 +29,8 @@ class HumanDecisionAction extends StatefulWidget {
final ApiGateway gateway;
final ValueChanged<JsonMap> onRunChanged;
/// Overrides the platform style; by default it follows the enclosing app.
/// Retained for callers that still pass a host style; the Material prompt is
/// used everywhere now.
final bool? cupertino;
@override
@@ -53,15 +53,6 @@ class _HumanDecisionActionState extends State<HumanDecisionAction> {
_pending = pendingDecision(widget.run);
}
bool _usesCupertino(BuildContext context) {
if (widget.cupertino != null) return widget.cupertino!;
final material = Localizations.of<MaterialLocalizations>(
context,
MaterialLocalizations,
);
return material == null;
}
Future<void> _open() async {
final decision = _pending;
if (decision == null || _dialogOpen) return;
@@ -71,7 +62,7 @@ class _HumanDecisionActionState extends State<HumanDecisionAction> {
context: context,
run: widget.run,
gateway: widget.gateway,
cupertino: _usesCupertino(context),
cupertino: widget.cupertino ?? false,
onRunChanged: _acceptRun,
isCurrent: () => _owns(decision.runId),
);
@@ -93,13 +84,6 @@ class _HumanDecisionActionState extends State<HumanDecisionAction> {
Widget build(BuildContext context) {
final decision = _pending;
if (decision == null) return const SizedBox.shrink();
if (_usesCupertino(context)) {
return CupertinoButton.filled(
key: decisionActionKey,
onPressed: _open,
child: const Text(decisionActionLabel),
);
}
return FilledButton(
key: decisionActionKey,
onPressed: _open,
@@ -1,10 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../domain/run_decisions.dart';
import '../domain/run_models.dart';
import 'action_refusal.dart';
import 'decision_option_row.dart';
import 'decision_wording.dart';
/// Sends the draft to the server. Returns null on success, or an
@@ -19,18 +17,7 @@ Future<void> showHumanDecisionPrompt({
required bool cupertino,
required DecisionSubmit onSubmit,
}) {
final prompt = _DecisionPrompt(
decision: decision,
cupertino: cupertino,
onSubmit: onSubmit,
);
if (cupertino) {
return showCupertinoDialog<void>(
context: context,
barrierDismissible: false,
builder: (_) => prompt,
);
}
final prompt = _DecisionPrompt(decision: decision, onSubmit: onSubmit);
return showDialog<void>(
context: context,
barrierDismissible: false,
@@ -39,14 +26,9 @@ Future<void> showHumanDecisionPrompt({
}
class _DecisionPrompt extends StatefulWidget {
const _DecisionPrompt({
required this.decision,
required this.cupertino,
required this.onSubmit,
});
const _DecisionPrompt({required this.decision, required this.onSubmit});
final PendingDecision decision;
final bool cupertino;
final DecisionSubmit onSubmit;
@override
@@ -112,8 +94,7 @@ class _DecisionPromptState extends State<_DecisionPrompt> {
@override
Widget build(BuildContext context) {
final dialog = widget.cupertino ? _cupertino(context) : _material(context);
return PopScope(canPop: !_sending, child: dialog);
return PopScope(canPop: !_sending, child: _material(context));
}
bool get _confirmDisabled => _sending || _checking || _blocked;
@@ -166,52 +147,6 @@ class _DecisionPromptState extends State<_DecisionPrompt> {
);
}
Widget _cupertino(BuildContext context) {
return CupertinoAlertDialog(
title: const Text(decisionWaitingTitle),
content: _body(
errorStyle: TextStyle(
color: CupertinoColors.systemRed.resolveFrom(context),
),
options: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
for (final (index, option) in widget.decision.options.indexed)
DecisionOptionRow(
key: decisionOptionKey(option.key),
label: option.key,
target: _targetText(option),
selected: _draft.selected == option.key,
divider: index > 0,
onTap: _sending ? null : () => _select(option.key),
),
],
),
feedback: CupertinoTextField(
key: decisionFeedbackKey,
controller: _feedback,
enabled: !_sending,
placeholder: decisionFeedbackLabel,
textInputAction: TextInputAction.done,
onChanged: _feedbackChanged,
onSubmitted: (_) => _confirm(),
),
),
actions: [
CupertinoDialogAction(
onPressed: _sending ? null : _cancel,
child: const Text(decisionCancelLabel),
),
CupertinoDialogAction(
isDefaultAction: true,
onPressed: _confirmDisabled || !_draft.canSubmit ? null : _confirm,
child: Text(_sending ? decisionSendingLabel : decisionConfirmLabel),
),
],
);
}
Widget _body({
required TextStyle errorStyle,
required Widget options,
@@ -1,109 +0,0 @@
import 'package:flutter/cupertino.dart';
/// One option row in the Cupertino decision prompt, keyed by the option.
ValueKey<String> decisionOptionKey(String option) =>
ValueKey<String>('human-decision-option-$option');
/// One choice of the Cupertino decision prompt: a check-list row.
///
/// The option reads as text in the label colour, not as a blue link, with its
/// target underneath in the secondary colour. An empty circle marks an
/// unpicked row and a filled check circle the picked one, so the choice is
/// visible before Confirm. The whole row is the tap target; semantics report
/// it as a selectable member of one exclusive group. A null [onTap] (while
/// sending) dims the row.
class DecisionOptionRow extends StatelessWidget {
const DecisionOptionRow({
super.key,
required this.label,
required this.selected,
required this.onTap,
this.target,
this.divider = false,
});
final String label;
final String? target;
final bool selected;
final bool divider;
final VoidCallback? onTap;
@override
Widget build(BuildContext context) {
final theme = CupertinoTheme.of(context);
final enabled = onTap != null;
final labelColor = enabled
? CupertinoColors.label.resolveFrom(context)
: CupertinoColors.tertiaryLabel.resolveFrom(context);
final mark = selected
? Icon(
CupertinoIcons.checkmark_circle_fill,
color: enabled
? theme.primaryColor
: CupertinoColors.tertiaryLabel.resolveFrom(context),
)
: Icon(
CupertinoIcons.circle,
color: CupertinoColors.tertiaryLabel.resolveFrom(context),
);
final row = Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
children: [
mark,
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
textAlign: TextAlign.start,
style: theme.textTheme.textStyle.copyWith(
color: labelColor,
fontWeight: selected ? FontWeight.w600 : null,
),
),
if (target case final target?)
Text(
target,
textAlign: TextAlign.start,
style: theme.textTheme.textStyle.copyWith(
fontSize: 13,
color: CupertinoColors.secondaryLabel.resolveFrom(
context,
),
),
),
],
),
),
],
),
);
return Semantics(
inMutuallyExclusiveGroup: true,
selected: selected,
checked: selected,
button: true,
enabled: enabled,
child: DecoratedBox(
decoration: BoxDecoration(
border: divider
? Border(
top: BorderSide(
color: CupertinoColors.separator.resolveFrom(context),
width: 0,
),
)
: null,
),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: onTap,
child: row,
),
),
);
}
}
@@ -1,7 +1,6 @@
import 'package:flutter/widgets.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../data/runs_repository.dart';
import '../domain/run_deletion.dart';
import 'delete_runs_dialog.dart';
@@ -25,7 +24,7 @@ Future<bool> confirmDeleteRuns(
context: context,
count: ids.length,
size: runsSizeLabel(deletable),
cupertino: cupertino ?? usesCupertinoHost(context),
cupertino: cupertino ?? false,
onSubmit: () async {
try {
onDeleted(await RunsRepository(gateway).deleteRuns(ids));
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../domain/run_deletion.dart';
@@ -22,23 +21,12 @@ Future<bool> showDeleteRunsPrompt({
required bool cupertino,
required DeleteRunsSubmit onSubmit,
}) async {
final prompt = _DeleteRunsPrompt(
count: count,
size: size,
cupertino: cupertino,
onSubmit: onSubmit,
final prompt = _DeleteRunsPrompt(count: count, size: size, onSubmit: onSubmit);
final result = await showDialog<bool>(
context: context,
barrierDismissible: false,
builder: (_) => prompt,
);
final result = cupertino
? await showCupertinoDialog<bool>(
context: context,
barrierDismissible: false,
builder: (_) => prompt,
)
: await showDialog<bool>(
context: context,
barrierDismissible: false,
builder: (_) => prompt,
);
return result ?? false;
}
@@ -46,13 +34,11 @@ class _DeleteRunsPrompt extends StatefulWidget {
const _DeleteRunsPrompt({
required this.count,
required this.size,
required this.cupertino,
required this.onSubmit,
});
final int count;
final String? size;
final bool cupertino;
final DeleteRunsSubmit onSubmit;
@override
@@ -88,7 +74,7 @@ class _DeleteRunsPromptState extends State<_DeleteRunsPrompt> {
@override
Widget build(BuildContext context) => PopScope(
canPop: !_sending,
child: widget.cupertino ? _cupertinoDialog(context) : _material(context),
child: _material(context),
);
Widget _material(BuildContext context) {
@@ -116,26 +102,6 @@ class _DeleteRunsPromptState extends State<_DeleteRunsPrompt> {
);
}
Widget _cupertinoDialog(BuildContext context) => CupertinoAlertDialog(
title: Text(deleteRunsTitle(widget.count)),
content: _body(
TextStyle(color: CupertinoColors.systemRed.resolveFrom(context)),
),
actions: [
CupertinoDialogAction(
key: deleteRunsKeepKey,
onPressed: _sending ? null : _keep,
child: const Text('Cancel'),
),
CupertinoDialogAction(
key: deleteRunsConfirmKey,
isDestructiveAction: true,
onPressed: _sending ? null : _confirm,
child: Text(_sending ? 'Deleting…' : 'Delete'),
),
],
);
Widget _body(TextStyle errorStyle) => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
@@ -42,8 +41,6 @@ class RetryRunAction extends StatefulWidget {
class _RetryRunActionState extends State<RetryRunAction> {
bool _dialogOpen = false;
bool _usesCupertino(BuildContext context) => _cupertinoLocale(context);
Future<void> _open() async {
if (_dialogOpen) return;
_dialogOpen = true;
@@ -67,14 +64,6 @@ class _RetryRunActionState extends State<RetryRunAction> {
if (retryRunId(widget.run) == null || !canRetryRun(widget.run)) {
return const SizedBox.shrink();
}
if (_usesCupertino(context)) {
return CupertinoButton.tinted(
sizeStyle: CupertinoButtonSize.small,
key: retryActionKey,
onPressed: _open,
child: const Text(retryActionLabel),
);
}
return OutlinedButton(
key: retryActionKey,
onPressed: _open,
@@ -83,10 +72,6 @@ class _RetryRunActionState extends State<RetryRunAction> {
}
}
bool _cupertinoLocale(BuildContext context) =>
Localizations.of<MaterialLocalizations>(context, MaterialLocalizations) ==
null;
/// Opens the retry prompt for a failed [run]; only its confirm sends
/// `retry_run`. An accepted reply reaches [onRunChanged] while [owns] still
/// holds, and a new run id opens through [onRunOpened]. A refusal re-reads the
@@ -121,7 +106,7 @@ Future<void> openRetryRunPrompt(
await showRetryRunPrompt(
context: context,
runId: id,
cupertino: _cupertinoLocale(context),
cupertino: false,
onSubmit: (intent) async {
try {
final updated = await repository.retryRun(
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'action_refusal.dart';
@@ -24,16 +23,8 @@ Future<void> showRetryRunPrompt({
}) {
final prompt = _RetryPrompt(
runId: runId,
cupertino: cupertino,
onSubmit: onSubmit,
);
if (cupertino) {
return showCupertinoDialog<void>(
context: context,
barrierDismissible: false,
builder: (_) => prompt,
);
}
return showDialog<void>(
context: context,
barrierDismissible: false,
@@ -42,14 +33,9 @@ Future<void> showRetryRunPrompt({
}
class _RetryPrompt extends StatefulWidget {
const _RetryPrompt({
required this.runId,
required this.cupertino,
required this.onSubmit,
});
const _RetryPrompt({required this.runId, required this.onSubmit});
final num runId;
final bool cupertino;
final RetrySubmit onSubmit;
@override
@@ -116,8 +102,7 @@ class _RetryPromptState extends State<_RetryPrompt> {
@override
Widget build(BuildContext context) {
final dialog = widget.cupertino ? _cupertino(context) : _material(context);
return PopScope(canPop: !_sending, child: dialog);
return PopScope(canPop: !_sending, child: _material(context));
}
bool get _confirmDisabled => _sending || _checking || _blocked;
@@ -150,36 +135,6 @@ class _RetryPromptState extends State<_RetryPrompt> {
);
}
Widget _cupertino(BuildContext context) {
return CupertinoAlertDialog(
title: Text(_dialogTitle),
content: _body(
errorStyle: TextStyle(
color: CupertinoColors.systemRed.resolveFrom(context),
),
),
actions: [
if (_showRestart)
CupertinoDialogAction(
key: retryRestartKey,
onPressed: _sending || _checking ? null : _restart,
child: const Text(restartConfirmLabel),
),
CupertinoDialogAction(
key: retryKeepKey,
onPressed: _sending ? null : _keep,
child: const Text(retryKeepLabel),
),
CupertinoDialogAction(
key: retryConfirmKey,
isDestructiveAction: _mode == RetryMode.restart,
onPressed: _confirmDisabled ? null : _confirm,
child: Text(_confirmLabel),
),
],
);
}
Widget _body({required TextStyle errorStyle}) {
return Column(
mainAxisSize: MainAxisSize.min,
@@ -1,9 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../core/error_reason.dart';
import '../../../ui/adaptive/host.dart';
import '../data/runs_repository.dart';
/// The browser client's export-only repair wording, kept verbatim.
@@ -131,22 +129,15 @@ class _SessionExportRepairActionState extends State<SessionExportRepairAction> {
final label = _sending
? sessionExportRepairBusyLabel
: sessionExportRepairLabel;
final cupertino = usesCupertinoHost(context);
final button = cupertino
? CupertinoButton(
padding: EdgeInsets.zero,
onPressed: enabled ? _send : null,
child: Text(label),
)
: TextButton(onPressed: enabled ? _send : null, child: Text(label));
final button = TextButton(
onPressed: enabled ? _send : null,
child: Text(label),
);
return Column(
key: sessionExportRepairKey,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (cupertino)
button
else
Tooltip(message: sessionExportRepairHelp, child: button),
Tooltip(message: sessionExportRepairHelp, child: button),
if (_refusal != null)
Padding(
padding: const EdgeInsets.only(top: 8),
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
@@ -33,8 +32,6 @@ class RunTitleAction extends StatefulWidget {
class _RunTitleActionState extends State<RunTitleAction> {
bool _dialogOpen = false;
bool _usesCupertino(BuildContext context) => _cupertinoLocale(context);
Future<void> _open() async {
if (_dialogOpen) return;
_dialogOpen = true;
@@ -55,14 +52,6 @@ class _RunTitleActionState extends State<RunTitleAction> {
@override
Widget build(BuildContext context) {
if (runTitleId(widget.run) == null) return const SizedBox.shrink();
if (_usesCupertino(context)) {
return CupertinoButton.tinted(
sizeStyle: CupertinoButtonSize.small,
key: runTitleActionKey,
onPressed: _open,
child: const Text(runTitleActionLabel),
);
}
return OutlinedButton(
key: runTitleActionKey,
onPressed: _open,
@@ -71,10 +60,6 @@ class _RunTitleActionState extends State<RunTitleAction> {
}
}
bool _cupertinoLocale(BuildContext context) =>
Localizations.of<MaterialLocalizations>(context, MaterialLocalizations) ==
null;
/// Opens the rename prompt for [run]; only Save sends `set_run_title`, and the
/// server's returned detail reaches [onRunChanged] while [owns] still holds
/// for that run id. Shared by the button and the run detail's more menu.
@@ -92,7 +77,7 @@ Future<void> openRunTitleEditor(
context: context,
runId: id,
initialTitle: storedRunTitle(run),
cupertino: _cupertinoLocale(context),
cupertino: false,
onSubmit: (title) async {
if (saving) return const ActionRefusal(actionAlreadySending);
saving = true;
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'action_refusal.dart';
@@ -26,16 +25,8 @@ Future<void> showRunTitlePrompt({
final prompt = _TitlePrompt(
runId: runId,
initialTitle: initialTitle,
cupertino: cupertino,
onSubmit: onSubmit,
);
if (cupertino) {
return showCupertinoDialog<void>(
context: context,
barrierDismissible: false,
builder: (_) => prompt,
);
}
return showDialog<void>(
context: context,
barrierDismissible: false,
@@ -47,13 +38,11 @@ class _TitlePrompt extends StatefulWidget {
const _TitlePrompt({
required this.runId,
required this.initialTitle,
required this.cupertino,
required this.onSubmit,
});
final num runId;
final String initialTitle;
final bool cupertino;
final TitleSubmit onSubmit;
@override
@@ -97,8 +86,7 @@ class _TitlePromptState extends State<_TitlePrompt> {
@override
Widget build(BuildContext context) {
final dialog = widget.cupertino ? _cupertino(context) : _material(context);
return PopScope(canPop: !_sending, child: dialog);
return PopScope(canPop: !_sending, child: _material(context));
}
Widget _material(BuildContext context) {
@@ -133,39 +121,6 @@ class _TitlePromptState extends State<_TitlePrompt> {
);
}
Widget _cupertino(BuildContext context) {
return CupertinoAlertDialog(
title: const Text(runTitleDialogTitle),
content: _body(
field: CupertinoTextField(
key: runTitleFieldKey,
controller: _title,
enabled: !_sending,
autofocus: true,
placeholder: runTitleFieldLabel,
textInputAction: TextInputAction.done,
onSubmitted: (_) => _save(),
),
errorStyle: TextStyle(
color: CupertinoColors.systemRed.resolveFrom(context),
),
),
actions: [
CupertinoDialogAction(
key: runTitleCancelKey,
onPressed: _sending ? null : _cancel,
child: const Text(runTitleCancelLabel),
),
CupertinoDialogAction(
key: runTitleSaveKey,
isDefaultAction: true,
onPressed: _sending ? null : _save,
child: const Text(runTitleSaveLabel),
),
],
);
}
Widget _body({required Widget field, required TextStyle errorStyle}) {
return Column(
mainAxisSize: MainAxisSize.min,
+19 -55
View File
@@ -1,10 +1,8 @@
import '../ui/motion/fade_through_stack.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../ui/adaptive/segmented_bar.dart';
import '../ui/adaptive/floating_bar_layout.dart';
import '../ui/adaptive/floating_destination_bar.dart';
import 'attention_badge.dart';
import 'destination.dart';
@@ -37,6 +35,9 @@ class AdaptiveShell extends StatefulWidget {
final ListPaneWidthStore listPaneWidthStore;
final Map<AppDestination, WidgetBuilder> destinationBodies;
/// Retained for callers that still pass it; the shell always draws the
/// Material controls and scaffold whether this is set or not.
final bool cupertino;
/// The destination a route owner selected. When null the shell keeps its own
@@ -120,7 +121,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
key: const ValueKey('shell.badge.chat.unread'),
count: _bar.badge(destination, ShellBadgeKind.unread),
label: 'unread chats',
cupertino: widget.cupertino,
cupertino: false,
child: icon,
);
}
@@ -130,12 +131,12 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
final attention = widget.attentionCount > 0;
return AttentionDestinationIcon(
count: widget.attentionCount,
cupertino: widget.cupertino,
cupertino: false,
child: ActivityBadge(
key: const ValueKey('shell.badge.runs.running'),
count: attention ? 0 : _bar.badge(destination, ShellBadgeKind.running),
label: 'runs in progress',
cupertino: widget.cupertino,
cupertino: false,
child: icon,
),
);
@@ -202,7 +203,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
alignment: AlignmentDirectional.bottomStart,
child: FloatingDestinationBar(
showLabels: true,
cupertino: widget.cupertino,
cupertino: false,
currentIndex: index,
onTap: (value) => _select(shellTabDestinations[value]),
items: _destinationItems(),
@@ -240,24 +241,6 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
},
child: child,
);
if (widget.cupertino) {
return backable(
ShellSystemInsets(
padding: system,
child: CupertinoPageScaffold(
navigationBar: topBar,
child: SafeArea(
top: false,
bottom: false,
child: FloatingBarOverlay(
bar: bar,
child: _destinationStack(contents),
),
),
),
),
);
}
return backable(
ShellSystemInsets(
padding: system,
@@ -352,10 +335,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
final item = destinationDetails(destination);
return FloatingDestinationItem(
key: ValueKey('shell.destination.${destination.name}'),
icon: _icon(
destination,
widget.cupertino ? item.cupertinoIcon : item.icon,
),
icon: _icon(destination, item.icon),
label: item.label,
);
}).toList();
@@ -367,18 +347,17 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
String label, {
required bool page,
}) {
final cupertino = widget.cupertino;
final onBack = spec?.onBack ?? (page ? _closePage : null);
final published = spec?.actions ?? const <Widget>[];
final onSearch = widget.onSearch;
return SegmentedBar(
cupertino: cupertino,
cupertino: false,
automaticallyImplyLeading: false,
leading: onBack == null
? null
: SegmentedBackButton(
key: const ValueKey('shell.back'),
cupertino: cupertino,
cupertino: false,
onPressed: onBack,
),
title: spec?.title ?? label,
@@ -401,22 +380,12 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
// A screen whose main pill is its own field (Search) needs no
// separate Search action.
else if (onSearch != null && spec?.titleWidget == null && !page)
cupertino
? CupertinoButton(
key: const ValueKey('shell.search'),
padding: EdgeInsets.zero,
onPressed: onSearch,
child: const Icon(
CupertinoIcons.search,
semanticLabel: 'Search',
),
)
: IconButton(
key: const ValueKey('shell.search'),
onPressed: onSearch,
tooltip: 'Search',
icon: const Icon(Icons.search),
),
IconButton(
key: const ValueKey('shell.search'),
onPressed: onSearch,
tooltip: 'Search',
icon: const Icon(Icons.search),
),
...widget.barActions,
],
);
@@ -438,10 +407,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
/// split never remounts it.
///
/// It rebuilds itself when [listenable] (the focused destination's published
/// bar) changes; [initial] supplies the size and obstruction, which do not
/// depend on the published contents.
class _ListPaneBar extends StatelessWidget
implements ObstructingPreferredSizeWidget {
/// bar) changes; [initial] supplies the size, which does not depend on the
/// published contents.
class _ListPaneBar extends StatelessWidget implements PreferredSizeWidget {
const _ListPaneBar({
required this.listenable,
required this.initial,
@@ -461,10 +429,6 @@ class _ListPaneBar extends StatelessWidget
@override
Size get preferredSize => initial.preferredSize;
@override
bool shouldFullyObstruct(BuildContext context) =>
initial.shouldFullyObstruct(context);
@override
Widget build(BuildContext context) => ListenableBuilder(
listenable: listenable,
+20 -67
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../features/attention/domain/attention_models.dart';
@@ -8,9 +7,8 @@ import '../ui/motion/motion.dart';
///
/// The bell itself lives in the Runs heading, so without this the count would
/// be visible only on that destination; the web mirrors it on the rail and
/// dock tab. Material hosts use the framework [Badge]; Cupertino has no badge
/// control, so its tab bar and sidebar get the host's red count overlay. Zero
/// draws the bare icon, and a count labels the item exactly like the bell:
/// dock tab. Material hosts use the framework [Badge]. Zero draws the bare
/// icon, and a count labels the item exactly like the bell:
/// `Notifications, {n} needing attention`.
class AttentionDestinationIcon extends StatelessWidget {
const AttentionDestinationIcon({
@@ -21,24 +19,25 @@ class AttentionDestinationIcon extends StatelessWidget {
});
final int count;
/// Retained for callers that still pass it; the icon is always the Material
/// [Badge] whether this is set or not.
final bool cupertino;
final Widget child;
@override
Widget build(BuildContext context) {
final visible = count > 0;
final Widget icon = cupertino
? _CupertinoCountOverlay(count: count, visible: visible, child: child)
: Badge(
label: visible
? MotionSwitcher(
scale: true,
child: Text('$count', key: ValueKey(count)),
)
: null,
isLabelVisible: visible,
child: child,
);
final Widget icon = Badge(
label: visible
? MotionSwitcher(
scale: true,
child: Text('$count', key: ValueKey(count)),
)
: null,
isLabelVisible: visible,
child: child,
);
if (!visible) return icon;
// The number alone would read as a stray "3"; the item carries the bell's
// full label instead.
@@ -49,51 +48,6 @@ class AttentionDestinationIcon extends StatelessWidget {
}
}
/// The iOS tab-badge idiom: a red stadium with the count over the icon's
/// trailing corner. Content-driven size; only the overlap offset is fixed.
class _CupertinoCountOverlay extends StatelessWidget {
const _CupertinoCountOverlay({
required this.count,
required this.visible,
required this.child,
});
final int count;
final bool visible;
final Widget child;
@override
Widget build(BuildContext context) {
if (!visible) return child;
final style = CupertinoTheme.of(
context,
).textTheme.tabLabelTextStyle.copyWith(color: CupertinoColors.white);
return Stack(
clipBehavior: Clip.none,
children: [
child,
PositionedDirectional(
top: -6,
end: -10,
child: DecoratedBox(
decoration: ShapeDecoration(
color: CupertinoColors.systemRed.resolveFrom(context),
shape: const StadiumBorder(),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1),
child: MotionSwitcher(
scale: true,
child: Text('$count', key: ValueKey(count), style: style),
),
),
),
),
],
);
}
}
/// A small count on a tab icon: blue for activity (runs in progress, unread
/// chats), so it reads apart from the red needs-you count.
class ActivityBadge extends StatelessWidget {
@@ -108,6 +62,9 @@ class ActivityBadge extends StatelessWidget {
final int count;
final String label;
/// Retained for callers that still pass it; the badge uses the Material
/// theme colours whether this is set or not.
final bool cupertino;
final bool bottom;
final Widget child;
@@ -115,12 +72,8 @@ class ActivityBadge extends StatelessWidget {
@override
Widget build(BuildContext context) {
final visible = count > 0;
final color = cupertino
? CupertinoColors.systemBlue.resolveFrom(context)
: Theme.of(context).colorScheme.primary;
final text = cupertino
? CupertinoColors.white
: Theme.of(context).colorScheme.onPrimary;
final color = Theme.of(context).colorScheme.primary;
final text = Theme.of(context).colorScheme.onPrimary;
final stack = Stack(
clipBehavior: Clip.none,
children: [
+5 -1
View File
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
enum AppDestination { pipelines, runs, chat, search, settings }
@@ -20,6 +20,10 @@ AppDestination shellTabFor(AppDestination destination) =>
? destination
: AppDestination.pipelines;
/// The label and icons for [value].
///
/// [cupertinoIcon] is retained in the record for callers that still read it;
/// the shell itself draws [icon] on its Material path.
({String label, IconData icon, IconData cupertinoIcon}) destinationDetails(
AppDestination value,
) => switch (value) {
+3 -12
View File
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/segmented_bar.dart';
import '../ui/motion/container_transform_route.dart';
import '../ui/motion/container_transform_source.dart';
@@ -93,17 +91,14 @@ PageRoute<void> detailPageRoute(
ContainerTransformLink? growFrom,
}) {
final page = DetailPane(destination: destination, builder: builder);
final cupertino = usesCupertinoHost(context);
if (growFrom != null) {
return ContainerTransformPageRoute<void>(
link: growFrom,
cupertino: cupertino,
cupertino: false,
builder: (_) => page,
);
}
return cupertino
? CupertinoPageRoute<void>(builder: (_) => page)
: MaterialPageRoute<void>(builder: (_) => page);
return MaterialPageRoute<void>(builder: (_) => page);
}
/// An open item's own bar over its content: what the content publishes
@@ -151,11 +146,10 @@ class _DetailPaneState extends State<DetailPane> {
// status-bar inset itself. The scaffold and the body's place in it stay
// the same either way, so switching never remounts the content.
final barless = spec?.barless ?? false;
final cupertino = usesCupertinoHost(context);
final bar = barless
? null
: SegmentedBar(
cupertino: cupertino,
cupertino: false,
automaticallyImplyLeading: widget.implyBack,
title: title,
subtitle: spec?.subtitle,
@@ -171,9 +165,6 @@ class _DetailPaneState extends State<DetailPane> {
// pads its lists by the bar's height (top) and by the system's or a
// floating tab bar's (bottom), floating its own tabs clear of them.
final content = SafeArea(top: false, bottom: false, child: body);
if (cupertino) {
return CupertinoPageScaffold(navigationBar: bar, child: content);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
+4 -5
View File
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/host.dart';
import '../ui/motion/surface_visibility.dart';
/// The open item's own navigator beside a list on a wide window.
@@ -43,9 +41,10 @@ class _DetailPaneNavigatorState extends State<DetailPaneNavigator> {
@override
Widget build(BuildContext context) {
final Page<void> root = usesCupertinoHost(context)
? CupertinoPage<void>(key: _rootKey, child: widget.child)
: MaterialPage<void>(key: _rootKey, child: widget.child);
final Page<void> root = MaterialPage<void>(
key: _rootKey,
child: widget.child,
);
// Only the shown tab's pane answers the system Back: a page left open in
// another tab's pane stays there while Back acts on the current tab. The
// route asks every handler on it, so a hidden pane also ignores the call.
+2 -11
View File
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/host.dart';
import 'destination.dart';
/// The detail pane beside a list before anything is chosen: the
@@ -19,22 +17,15 @@ class EmptyDetailPane extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final details = destinationDetails(destination);
final color = cupertino
? CupertinoColors.secondaryLabel.resolveFrom(context)
: Theme.of(context).colorScheme.onSurfaceVariant;
final color = Theme.of(context).colorScheme.onSurfaceVariant;
return Center(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
cupertino ? details.cupertinoIcon : details.icon,
size: 32,
color: color,
),
Icon(details.icon, size: 32, color: color),
const SizedBox(height: 12),
Text(
message,
+1 -8
View File
@@ -1,9 +1,7 @@
import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/resize_grip.dart';
/// How wide the divider's invisible grab area is, centred on its line.
@@ -17,12 +15,7 @@ class ListPaneDividerLine extends StatelessWidget {
const ListPaneDividerLine({super.key});
@override
Widget build(BuildContext context) => usesCupertinoHost(context)
? Container(
width: 1,
color: CupertinoColors.separator.resolveFrom(context),
)
: const VerticalDivider(width: 1);
Widget build(BuildContext context) => const VerticalDivider(width: 1);
}
/// The grab area over [ListPaneDividerLine]: dragging it (mouse or touch)
+4 -34
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'destination.dart';
@@ -10,48 +9,19 @@ class ShellDestinationMenu extends StatelessWidget {
required this.current,
required this.onSelected,
});
/// Retained for callers that still pass it; the menu is always the Material
/// popup whether this is set or not.
final bool cupertino;
final AppDestination current;
final ValueChanged<AppDestination> onSelected;
Future<void> _choose(BuildContext context) async {
final value = await showCupertinoModalPopup<AppDestination>(
context: context,
builder: (context) => CupertinoActionSheet(
title: const Text('Main navigation'),
actions: [
for (final destination in AppDestination.values)
CupertinoActionSheetAction(
isDefaultAction: destination == current,
onPressed: () => Navigator.pop(context, destination),
child: Text(destinationDetails(destination).label),
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () => Navigator.pop(context),
child: const Text('Cancel'),
),
),
);
if (value != null && context.mounted) onSelected(value);
}
@override
Widget build(BuildContext context) {
final child = Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(cupertino ? CupertinoIcons.square_grid_2x2 : Icons.apps),
const Text('Menu'),
],
children: const [Icon(Icons.apps), Text('Menu')],
);
if (cupertino) {
return Semantics(
button: true,
label: 'Main navigation',
child: CupertinoButton(onPressed: () => _choose(context), child: child),
);
}
return PopupMenuButton<AppDestination>(
tooltip: 'Main navigation',
onSelected: onSelected,