From 364fd5b5386f179d5fd2033e9ce0f25a79e6c2c0 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 04:18:26 +0000 Subject: [PATCH 1/2] Remove Cupertino run action branches Keep the Material-only run action behavior while preserving public Cupertino parameters for callers that will be cleaned up separately. Narrow the related tests to the supported Material path. --- .../features/runs/actions/cancel_dialog.dart | 43 +----- .../runs/actions/cancel_run_action.dart | 21 +-- .../runs/actions/decision_action.dart | 22 +-- .../runs/actions/decision_dialog.dart | 71 +--------- .../runs/actions/decision_option_row.dart | 109 --------------- .../runs/actions/delete_runs_action.dart | 3 +- .../runs/actions/delete_runs_dialog.dart | 46 +------ .../features/runs/actions/retry_action.dart | 17 +-- .../features/runs/actions/retry_dialog.dart | 49 +------ .../actions/session_export_repair_action.dart | 19 +-- .../features/runs/actions/title_action.dart | 17 +-- .../features/runs/actions/title_dialog.dart | 47 +------ .../runs/actions/cancel_action_test.dart | 52 ------- .../runs/actions/cancel_resilience_test.dart | 42 ++---- .../runs/actions/cancel_test_support.dart | 13 +- .../runs/actions/decision_action_test.dart | 118 +++++----------- .../actions/decision_resilience_test.dart | 44 ++---- .../runs/actions/retry_action_test.dart | 109 ++------------- .../runs/actions/retry_safety_test.dart | 55 ++++---- .../runs/actions/retry_test_support.dart | 11 +- .../runs/actions/title_action_test.dart | 60 -------- .../runs/actions/title_resilience_test.dart | 90 +++++------- .../runs/actions/title_test_support.dart | 12 +- .../runs/ui/run_cancel_wiring_test.dart | 95 ++++++------- .../runs/ui/run_decide_deep_link_test.dart | 56 +++----- .../runs/ui/run_decision_wiring_test.dart | 128 ++++++++---------- .../runs/ui/run_retry_guard_test.dart | 6 +- .../runs/ui/run_retry_layout_test.dart | 92 ++++++------- .../runs/ui/run_retry_wiring_support.dart | 10 +- .../runs/ui/run_retry_wiring_test.dart | 103 ++++++-------- .../ui/run_session_repair_action_test.dart | 19 +-- .../runs/ui/run_title_wiring_test.dart | 51 +------ .../features/runs/ui/runs_delete_test.dart | 12 +- 33 files changed, 381 insertions(+), 1261 deletions(-) delete mode 100644 app/lib/features/runs/actions/decision_option_row.dart diff --git a/app/lib/features/runs/actions/cancel_dialog.dart b/app/lib/features/runs/actions/cancel_dialog.dart index 1654f442..6a80880d 100644 --- a/app/lib/features/runs/actions/cancel_dialog.dart +++ b/app/lib/features/runs/actions/cancel_dialog.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'action_refusal.dart'; @@ -21,16 +20,8 @@ Future showCancelRunPrompt({ }) { final prompt = _CancelPrompt( runId: runId, - cupertino: cupertino, onSubmit: onSubmit, ); - if (cupertino) { - return showCupertinoDialog( - context: context, - barrierDismissible: false, - builder: (_) => prompt, - ); - } return showDialog( context: context, barrierDismissible: false, @@ -39,14 +30,9 @@ Future 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, diff --git a/app/lib/features/runs/actions/cancel_run_action.dart b/app/lib/features/runs/actions/cancel_run_action.dart index 68c4ecc3..38a687e9 100644 --- a/app/lib/features/runs/actions/cancel_run_action.dart +++ b/app/lib/features/runs/actions/cancel_run_action.dart @@ -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 { bool _dialogOpen = false; Future? _resync; - bool _usesCupertino(BuildContext context) { - final material = Localizations.of( - context, - MaterialLocalizations, - ); - return material == null; - } - Future _open() async { final id = cancelRunId(widget.run); if (id == null || !canCancelRun(widget.run) || _dialogOpen) return; @@ -52,7 +43,7 @@ class _CancelRunActionState extends State { await showCancelRunPrompt( context: context, runId: id, - cupertino: _usesCupertino(context), + cupertino: false, onSubmit: () => _submit(id), ); } finally { @@ -103,16 +94,6 @@ class _CancelRunActionState extends State { 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( diff --git a/app/lib/features/runs/actions/decision_action.dart b/app/lib/features/runs/actions/decision_action.dart index 7635f1c4..3c1f2bdd 100644 --- a/app/lib/features/runs/actions/decision_action.dart +++ b/app/lib/features/runs/actions/decision_action.dart @@ -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 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 { _pending = pendingDecision(widget.run); } - bool _usesCupertino(BuildContext context) { - if (widget.cupertino != null) return widget.cupertino!; - final material = Localizations.of( - context, - MaterialLocalizations, - ); - return material == null; - } - Future _open() async { final decision = _pending; if (decision == null || _dialogOpen) return; @@ -71,7 +62,7 @@ class _HumanDecisionActionState extends State { 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 { 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, diff --git a/app/lib/features/runs/actions/decision_dialog.dart b/app/lib/features/runs/actions/decision_dialog.dart index c1ceea50..9f477a5e 100644 --- a/app/lib/features/runs/actions/decision_dialog.dart +++ b/app/lib/features/runs/actions/decision_dialog.dart @@ -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 showHumanDecisionPrompt({ required bool cupertino, required DecisionSubmit onSubmit, }) { - final prompt = _DecisionPrompt( - decision: decision, - cupertino: cupertino, - onSubmit: onSubmit, - ); - if (cupertino) { - return showCupertinoDialog( - context: context, - barrierDismissible: false, - builder: (_) => prompt, - ); - } + final prompt = _DecisionPrompt(decision: decision, onSubmit: onSubmit); return showDialog( context: context, barrierDismissible: false, @@ -39,14 +26,9 @@ Future 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, diff --git a/app/lib/features/runs/actions/decision_option_row.dart b/app/lib/features/runs/actions/decision_option_row.dart deleted file mode 100644 index 94e4e800..00000000 --- a/app/lib/features/runs/actions/decision_option_row.dart +++ /dev/null @@ -1,109 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -/// One option row in the Cupertino decision prompt, keyed by the option. -ValueKey decisionOptionKey(String option) => - ValueKey('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, - ), - ), - ); - } -} diff --git a/app/lib/features/runs/actions/delete_runs_action.dart b/app/lib/features/runs/actions/delete_runs_action.dart index aa3685d5..d0fd904e 100644 --- a/app/lib/features/runs/actions/delete_runs_action.dart +++ b/app/lib/features/runs/actions/delete_runs_action.dart @@ -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 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)); diff --git a/app/lib/features/runs/actions/delete_runs_dialog.dart b/app/lib/features/runs/actions/delete_runs_dialog.dart index ef28ee3d..44e48bac 100644 --- a/app/lib/features/runs/actions/delete_runs_dialog.dart +++ b/app/lib/features/runs/actions/delete_runs_dialog.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../domain/run_deletion.dart'; @@ -22,23 +21,12 @@ Future 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( + context: context, + barrierDismissible: false, + builder: (_) => prompt, ); - final result = cupertino - ? await showCupertinoDialog( - context: context, - barrierDismissible: false, - builder: (_) => prompt, - ) - : await showDialog( - 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, diff --git a/app/lib/features/runs/actions/retry_action.dart b/app/lib/features/runs/actions/retry_action.dart index 8fec7a34..c38ef52c 100644 --- a/app/lib/features/runs/actions/retry_action.dart +++ b/app/lib/features/runs/actions/retry_action.dart @@ -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 { bool _dialogOpen = false; - bool _usesCupertino(BuildContext context) => _cupertinoLocale(context); - Future _open() async { if (_dialogOpen) return; _dialogOpen = true; @@ -67,14 +64,6 @@ class _RetryRunActionState extends State { 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 { } } -bool _cupertinoLocale(BuildContext context) => - Localizations.of(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 openRetryRunPrompt( await showRetryRunPrompt( context: context, runId: id, - cupertino: _cupertinoLocale(context), + cupertino: false, onSubmit: (intent) async { try { final updated = await repository.retryRun( diff --git a/app/lib/features/runs/actions/retry_dialog.dart b/app/lib/features/runs/actions/retry_dialog.dart index 846133a1..c0f8d1a3 100644 --- a/app/lib/features/runs/actions/retry_dialog.dart +++ b/app/lib/features/runs/actions/retry_dialog.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'action_refusal.dart'; @@ -24,16 +23,8 @@ Future showRetryRunPrompt({ }) { final prompt = _RetryPrompt( runId: runId, - cupertino: cupertino, onSubmit: onSubmit, ); - if (cupertino) { - return showCupertinoDialog( - context: context, - barrierDismissible: false, - builder: (_) => prompt, - ); - } return showDialog( context: context, barrierDismissible: false, @@ -42,14 +33,9 @@ Future 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, diff --git a/app/lib/features/runs/actions/session_export_repair_action.dart b/app/lib/features/runs/actions/session_export_repair_action.dart index 140c80c4..75e7a3f2 100644 --- a/app/lib/features/runs/actions/session_export_repair_action.dart +++ b/app/lib/features/runs/actions/session_export_repair_action.dart @@ -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 { 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), diff --git a/app/lib/features/runs/actions/title_action.dart b/app/lib/features/runs/actions/title_action.dart index f09eb585..e4e01d0e 100644 --- a/app/lib/features/runs/actions/title_action.dart +++ b/app/lib/features/runs/actions/title_action.dart @@ -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 { bool _dialogOpen = false; - bool _usesCupertino(BuildContext context) => _cupertinoLocale(context); - Future _open() async { if (_dialogOpen) return; _dialogOpen = true; @@ -55,14 +52,6 @@ class _RunTitleActionState extends State { @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 { } } -bool _cupertinoLocale(BuildContext context) => - Localizations.of(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 openRunTitleEditor( context: context, runId: id, initialTitle: storedRunTitle(run), - cupertino: _cupertinoLocale(context), + cupertino: false, onSubmit: (title) async { if (saving) return const ActionRefusal(actionAlreadySending); saving = true; diff --git a/app/lib/features/runs/actions/title_dialog.dart b/app/lib/features/runs/actions/title_dialog.dart index 9ae03a11..d9dd0302 100644 --- a/app/lib/features/runs/actions/title_dialog.dart +++ b/app/lib/features/runs/actions/title_dialog.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'action_refusal.dart'; @@ -26,16 +25,8 @@ Future showRunTitlePrompt({ final prompt = _TitlePrompt( runId: runId, initialTitle: initialTitle, - cupertino: cupertino, onSubmit: onSubmit, ); - if (cupertino) { - return showCupertinoDialog( - context: context, - barrierDismissible: false, - builder: (_) => prompt, - ); - } return showDialog( 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, diff --git a/app/test/features/runs/actions/cancel_action_test.dart b/app/test/features/runs/actions/cancel_action_test.dart index 09354fc1..937f2be2 100644 --- a/app/test/features/runs/actions/cancel_action_test.dart +++ b/app/test/features/runs/actions/cancel_action_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -60,7 +59,6 @@ void main() { initial: executingRun(), changed: changed, ), - cupertino: false, ), ); @@ -96,55 +94,6 @@ void main() { }, ); - testWidgets( - 'cupertino cancel uses a native prompt and sends only on confirm', - (tester) async { - final accepted = acceptedCancelRun(); - final gateway = FakeCancelGateway( - (type, fields) async => {'run_detail': accepted}, - ); - final changed = []; - await tester.pumpWidget( - cancelApp( - CancelHost( - gateway: gateway, - initial: executingRun(), - changed: changed, - ), - cupertino: true, - ), - ); - - expect(find.byKey(cancelActionKey), findsOneWidget); - expect(find.byType(CupertinoButton), findsOneWidget); - expect(find.byType(OutlinedButton), findsNothing); - - await tester.tap(find.byKey(cancelActionKey)); - await tester.pumpAndSettle(); - expect(find.byType(CupertinoAlertDialog), findsOneWidget); - expect(find.byType(AlertDialog), findsNothing); - expect(find.text(cancelDialogTitle(7)), findsOneWidget); - expect(find.text(cancelDialogMessage), findsOneWidget); - expect(gateway.calls, isEmpty); - - await tester.tap(find.byKey(cancelKeepKey)); - await tester.pumpAndSettle(); - expect(gateway.calls, isEmpty); - expect(find.byType(CupertinoAlertDialog), findsNothing); - - await tester.tap(find.byKey(cancelActionKey)); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(cancelConfirmKey)); - await tester.pumpAndSettle(); - - expect(gateway.calls.map((call) => call.type), ['cancel_run']); - expect(gateway.calls.single.fields, {'run_id': 7}); - expect(changed.single, equals(accepted)); - expect(find.byType(CupertinoAlertDialog), findsNothing); - expect(find.byKey(cancelActionKey), findsNothing); - }, - ); - testWidgets('the action is absent for runs the web does not cancel', ( tester, ) async { @@ -178,7 +127,6 @@ void main() { initial: run, changed: changed, ), - cupertino: false, ), ); expect( diff --git a/app/test/features/runs/actions/cancel_resilience_test.dart b/app/test/features/runs/actions/cancel_resilience_test.dart index 675c58b2..111db6cc 100644 --- a/app/test/features/runs/actions/cancel_resilience_test.dart +++ b/app/test/features/runs/actions/cancel_resilience_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -13,7 +12,6 @@ Future _pump( WidgetTester tester, FakeCancelGateway gateway, List changed, { - bool cupertino = false, double textScale = 1, JsonMap? run, }) async { @@ -24,7 +22,6 @@ Future _pump( initial: run ?? executingRun(), changed: changed, ), - cupertino: cupertino, textScale: textScale, ), ); @@ -239,33 +236,20 @@ void main() { addTearDown(tester.view.resetPhysicalSize); addTearDown(tester.view.resetDevicePixelRatio); - for (final cupertino in [false, true]) { - final gateway = FakeCancelGateway( - (type, fields) async => {'run_detail': acceptedCancelRun()}, - ); - await _pump( - tester, - gateway, - [], - cupertino: cupertino, - textScale: 2, - ); - await tester.tap(find.byKey(cancelActionKey)); - await tester.pumpAndSettle(); + final gateway = FakeCancelGateway( + (type, fields) async => {'run_detail': acceptedCancelRun()}, + ); + await _pump(tester, gateway, [], textScale: 2); + await tester.tap(find.byKey(cancelActionKey)); + await tester.pumpAndSettle(); - expect(tester.takeException(), isNull, reason: 'cupertino=$cupertino'); - expect(find.text(cancelDialogTitle(7)), findsOneWidget); - expect(find.text(cancelDialogMessage), findsOneWidget); - expect( - cupertino - ? find.byType(CupertinoAlertDialog) - : find.byType(AlertDialog), - findsOneWidget, - ); - expect(gateway.calls, isEmpty); + expect(tester.takeException(), isNull); + expect(find.text(cancelDialogTitle(7)), findsOneWidget); + expect(find.text(cancelDialogMessage), findsOneWidget); + expect(find.byType(AlertDialog), findsOneWidget); + expect(gateway.calls, isEmpty); - await tester.tap(find.byKey(cancelKeepKey)); - await tester.pumpAndSettle(); - } + await tester.tap(find.byKey(cancelKeepKey)); + await tester.pumpAndSettle(); }); } diff --git a/app/test/features/runs/actions/cancel_test_support.dart b/app/test/features/runs/actions/cancel_test_support.dart index 7acee8d9..7edb882f 100644 --- a/app/test/features/runs/actions/cancel_test_support.dart +++ b/app/test/features/runs/actions/cancel_test_support.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/features/runs/actions/cancel_run_action.dart'; @@ -77,23 +76,13 @@ class _CancelHostState extends State { } } -Widget cancelApp( - Widget child, { - required bool cupertino, - double textScale = 1, -}) { +Widget cancelApp(Widget child, {double textScale = 1}) { Widget media(BuildContext context, Widget? app) => MediaQuery( data: MediaQuery.of( context, ).copyWith(textScaler: TextScaler.linear(textScale)), child: app!, ); - if (cupertino) { - return CupertinoApp( - builder: media, - home: CupertinoPageScaffold(child: Center(child: child)), - ); - } return MaterialApp( builder: media, home: Scaffold(body: Center(child: child)), diff --git a/app/test/features/runs/actions/decision_action_test.dart b/app/test/features/runs/actions/decision_action_test.dart index 9f4c4b45..217e4e96 100644 --- a/app/test/features/runs/actions/decision_action_test.dart +++ b/app/test/features/runs/actions/decision_action_test.dart @@ -1,9 +1,7 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/features/runs/actions/decision_action.dart'; -import 'package:pipelines_app/features/runs/actions/decision_option_row.dart'; import 'package:pipelines_app/features/runs/actions/decision_wording.dart'; typedef _Handler = Future Function(String type, JsonMap fields); @@ -63,18 +61,7 @@ JsonMap _decided() => { 'steps': const [], }; -Widget _app(Widget child, {required bool cupertino, double textScale = 1}) { - if (cupertino) { - return CupertinoApp( - builder: (context, app) => MediaQuery( - data: MediaQuery.of( - context, - ).copyWith(textScaler: TextScaler.linear(textScale)), - child: app!, - ), - home: CupertinoPageScaffold(child: Center(child: child)), - ); - } +Widget _app(Widget child, {double textScale = 1}) { return MaterialApp( builder: (context, app) => MediaQuery( data: MediaQuery.of( @@ -90,7 +77,6 @@ Future _pump( WidgetTester tester, _FakeGateway gateway, JsonMap run, { - required bool cupertino, required List changed, double textScale = 1, }) async { @@ -101,7 +87,6 @@ Future _pump( gateway: gateway, onRunChanged: changed.add, ), - cupertino: cupertino, textScale: textScale, ), ); @@ -126,7 +111,6 @@ void main() { tester, gateway, _waitingRun(), - cupertino: false, changed: changed, ); @@ -166,76 +150,41 @@ void main() { }, ); - testWidgets( - 'cupertino decision uses a native dialog and omits empty feedback', - (tester) async { - final gateway = _FakeGateway( - (type, fields) async => { - 'run_detail': type == 'decide_run' ? _decided() : _waitingRun(), - }, - ); - final changed = []; - await _pump( - tester, - gateway, - _waitingRun(), - cupertino: true, - changed: changed, - ); + testWidgets('a decision without feedback omits the field', (tester) async { + final gateway = _FakeGateway( + (type, fields) async => { + 'run_detail': type == 'decide_run' ? _decided() : _waitingRun(), + }, + ); + final changed = []; + await _pump(tester, gateway, _waitingRun(), changed: changed); - expect(find.byKey(decisionActionKey), findsOneWidget); - expect(find.byType(FilledButton), findsNothing); - await _open(tester); - expect(find.byType(CupertinoAlertDialog), findsOneWidget); - expect(find.text(decisionWaitingTitle), findsOneWidget); - expect(gateway.calls, isEmpty); + expect(find.byKey(decisionActionKey), findsOneWidget); + expect(find.byType(FilledButton), findsOneWidget); + await _open(tester); + expect(find.byType(AlertDialog), findsOneWidget); + expect(find.text(decisionWaitingTitle), findsOneWidget); + expect(gateway.calls, isEmpty); - final confirm = find.widgetWithText( - CupertinoDialogAction, - decisionConfirmLabel, - ); - expect(tester.widget(confirm).onPressed, isNull); - // Options are check-list rows, not blue link buttons: an empty circle - // until one is picked, then a filled check on that row only. - final skip = find.byKey(decisionOptionKey('skip')); - expect(skip, findsOneWidget); - expect( - find.ancestor( - of: find.text('skip'), - matching: find.byType(CupertinoButton), - ), - findsNothing, - ); - expect(find.byIcon(CupertinoIcons.checkmark_circle_fill), findsNothing); - expect( - find.descendant(of: skip, matching: find.byIcon(CupertinoIcons.circle)), - findsOneWidget, - ); - await tester.tap(find.text('skip')); - await tester.pump(); - expect(gateway.calls, isEmpty); - expect( - find.descendant( - of: skip, - matching: find.byIcon(CupertinoIcons.checkmark_circle_fill), - ), - findsOneWidget, - ); - expect(find.byIcon(CupertinoIcons.checkmark_circle_fill), findsOneWidget); + final confirm = find.widgetWithText(FilledButton, decisionConfirmLabel); + expect(tester.widget(confirm).onPressed, isNull); + await tester.tap(find.text('skip')); + await tester.pump(); + expect(gateway.calls, isEmpty); + expect(tester.widget(confirm).onPressed, isNotNull); - await tester.tap(find.text(decisionConfirmLabel)); - await tester.pumpAndSettle(); + await tester.tap(find.text(decisionConfirmLabel)); + await tester.pumpAndSettle(); - expect(gateway.calls.map((call) => call.type), ['decide_run']); - expect(gateway.calls.single.fields, { - 'run_id': 7, - 'stage': 'human', - 'option': 'skip', - }); - expect(changed.single['status'], 'succeeded'); - expect(find.byType(CupertinoAlertDialog), findsNothing); - }, - ); + expect(gateway.calls.map((call) => call.type), ['decide_run']); + expect(gateway.calls.single.fields, { + 'run_id': 7, + 'stage': 'human', + 'option': 'skip', + }); + expect(changed.single['status'], 'succeeded'); + expect(find.byType(AlertDialog), findsNothing); + }); testWidgets('Cancel dismisses the draft without sending anything', ( tester, @@ -248,7 +197,6 @@ void main() { tester, gateway, _waitingRun(), - cupertino: false, changed: changed, ); @@ -277,7 +225,7 @@ void main() { ('export pending', _waitingRun(exportPending: 2)), ('model stage', _waitingRun(type: 'model')), ]) { - await _pump(tester, gateway, run, cupertino: false, changed: changed); + await _pump(tester, gateway, run, changed: changed); expect( find.byKey(decisionActionKey), findsNothing, diff --git a/app/test/features/runs/actions/decision_resilience_test.dart b/app/test/features/runs/actions/decision_resilience_test.dart index e755ddc5..da490421 100644 --- a/app/test/features/runs/actions/decision_resilience_test.dart +++ b/app/test/features/runs/actions/decision_resilience_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -61,19 +60,13 @@ JsonMap _decided() => { 'steps': const [], }; -Widget _app(Widget child, {required bool cupertino, double textScale = 1}) { +Widget _app(Widget child, {double textScale = 1}) { Widget media(BuildContext context, Widget? app) => MediaQuery( data: MediaQuery.of( context, ).copyWith(textScaler: TextScaler.linear(textScale)), child: app!, ); - if (cupertino) { - return CupertinoApp( - builder: media, - home: CupertinoPageScaffold(child: Center(child: child)), - ); - } return MaterialApp( builder: media, home: Scaffold(body: Center(child: child)), @@ -84,7 +77,6 @@ Future _pump( WidgetTester tester, _FakeGateway gateway, List changed, { - bool cupertino = false, double textScale = 1, }) async { await tester.pumpWidget( @@ -94,7 +86,6 @@ Future _pump( gateway: gateway, onRunChanged: changed.add, ), - cupertino: cupertino, textScale: textScale, ), ); @@ -323,29 +314,16 @@ void main() { addTearDown(tester.view.resetPhysicalSize); addTearDown(tester.view.resetDevicePixelRatio); - for (final cupertino in [false, true]) { - final gateway = _FakeGateway( - (type, fields) async => {'run_detail': _decided()}, - ); - await _pump( - tester, - gateway, - [], - cupertino: cupertino, - textScale: 2, - ); - await tester.tap(find.byKey(decisionActionKey)); - await tester.pumpAndSettle(); + final gateway = _FakeGateway( + (type, fields) async => {'run_detail': _decided()}, + ); + await _pump(tester, gateway, [], textScale: 2); + await tester.tap(find.byKey(decisionActionKey)); + await tester.pumpAndSettle(); - expect(tester.takeException(), isNull, reason: 'cupertino=$cupertino'); - expect(find.text(decisionWaitingTitle), findsOneWidget); - expect(find.text('Ship it?'), findsOneWidget); - expect( - cupertino - ? find.byType(CupertinoAlertDialog) - : find.byType(AlertDialog), - findsOneWidget, - ); - } + expect(tester.takeException(), isNull); + expect(find.text(decisionWaitingTitle), findsOneWidget); + expect(find.text('Ship it?'), findsOneWidget); + expect(find.byType(AlertDialog), findsOneWidget); }); } diff --git a/app/test/features/runs/actions/retry_action_test.dart b/app/test/features/runs/actions/retry_action_test.dart index ad6f6623..5bd9f666 100644 --- a/app/test/features/runs/actions/retry_action_test.dart +++ b/app/test/features/runs/actions/retry_action_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -146,81 +145,6 @@ void main() { }, ); - testWidgets( - 'cupertino retry uses a native prompt and sends only on confirm', - (tester) async { - final accepted = retriedRun(); - final gateway = FakeRetryGateway( - (type, fields) async => {'run_detail': accepted}, - ); - final changed = []; - await pumpRetry( - tester, - gateway: gateway, - changed: changed, - cupertino: true, - ); - - expect(find.byKey(retryActionKey), findsOneWidget); - expect(find.byType(CupertinoButton), findsOneWidget); - expect(find.byType(OutlinedButton), findsNothing); - - await tester.tap(find.byKey(retryActionKey)); - await tester.pumpAndSettle(); - expect(find.byType(CupertinoAlertDialog), findsOneWidget); - expect(find.byType(AlertDialog), findsNothing); - expect(find.text(retryDialogTitle(7)), findsOneWidget); - expect(find.text(retryDialogMessage), findsOneWidget); - expect(gateway.calls, isEmpty); - - await tester.tap(find.byKey(retryKeepKey)); - await tester.pumpAndSettle(); - expect(gateway.calls, isEmpty); - expect(find.byType(CupertinoAlertDialog), findsNothing); - - await tester.tap(find.byKey(retryActionKey)); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(retryConfirmKey)); - await tester.pumpAndSettle(); - - expect(gateway.retries, hasLength(1)); - final fields = gateway.retries.single.fields; - expect(fields['run_id'], 7); - expect(fields.containsKey('retry_mode'), isFalse); - expect(fields['request_key'], startsWith('app-retry-7-')); - expect(changed.single, equals(accepted)); - expect(find.byType(CupertinoAlertDialog), findsNothing); - }, - ); - - testWidgets('cupertino restart switches to the restart confirmation', ( - tester, - ) async { - final gateway = FakeRetryGateway( - (type, fields) async => {'run_detail': retriedRun()}, - ); - await pumpRetry( - tester, - gateway: gateway, - changed: [], - cupertino: true, - ); - - await tester.tap(find.byKey(retryActionKey)); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(retryRestartKey)); - await tester.pumpAndSettle(); - - expect(find.byType(CupertinoAlertDialog), findsOneWidget); - expect(find.text(restartDialogTitle(7)), findsOneWidget); - expect(find.text(restartDialogMessage), findsOneWidget); - expect(gateway.calls, isEmpty); - - await tester.tap(find.byKey(retryConfirmKey)); - await tester.pumpAndSettle(); - expect(gateway.retries.single.fields['retry_mode'], 'restart'); - }); - testWidgets('the action is absent for runs the web does not retry', ( tester, ) async { @@ -236,25 +160,22 @@ void main() { ('succeeded', failedRun(status: 'succeeded'), false), ('canceled', failedRun(status: 'canceled'), false), ]; - for (final cupertino in [false, true]) { - for (final (label, run, visible) in cases) { - await tester.pumpWidget( - retryApp( - RetryHost( - key: ValueKey('$label-$cupertino'), - gateway: gateway, - initial: run, - changed: changed, - ), - cupertino: cupertino, + for (final (label, run, visible) in cases) { + await tester.pumpWidget( + retryApp( + RetryHost( + key: ValueKey(label), + gateway: gateway, + initial: run, + changed: changed, ), - ); - expect( - find.byKey(retryActionKey), - visible ? findsOneWidget : findsNothing, - reason: '$label cupertino=$cupertino', - ); - } + ), + ); + expect( + find.byKey(retryActionKey), + visible ? findsOneWidget : findsNothing, + reason: label, + ); } expect(gateway.calls, isEmpty); expect(changed, isEmpty); diff --git a/app/test/features/runs/actions/retry_safety_test.dart b/app/test/features/runs/actions/retry_safety_test.dart index df9e7e88..73c115df 100644 --- a/app/test/features/runs/actions/retry_safety_test.dart +++ b/app/test/features/runs/actions/retry_safety_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -95,39 +94,31 @@ void main() { addTearDown(tester.view.resetPhysicalSize); addTearDown(tester.view.resetDevicePixelRatio); - for (final cupertino in [false, true]) { - final gateway = FakeRetryGateway( - (type, fields) async => {'run_detail': retriedRun()}, - ); - await pumpRetry( - tester, - gateway: gateway, - changed: [], - cupertino: cupertino, - textScale: 2, - ); + final gateway = FakeRetryGateway( + (type, fields) async => {'run_detail': retriedRun()}, + ); + await pumpRetry( + tester, + gateway: gateway, + changed: [], + textScale: 2, + ); - await tester.tap(find.byKey(retryActionKey)); - await tester.pumpAndSettle(); - expect(tester.takeException(), isNull, reason: 'cupertino=$cupertino'); - expect(find.text(retryDialogTitle(7)), findsOneWidget); - expect(find.text(retryDialogMessage), findsOneWidget); - expect( - cupertino - ? find.byType(CupertinoAlertDialog) - : find.byType(AlertDialog), - findsOneWidget, - ); + await tester.tap(find.byKey(retryActionKey)); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + expect(find.text(retryDialogTitle(7)), findsOneWidget); + expect(find.text(retryDialogMessage), findsOneWidget); + expect(find.byType(AlertDialog), findsOneWidget); - await tester.tap(find.byKey(retryRestartKey)); - await tester.pumpAndSettle(); - expect(tester.takeException(), isNull, reason: 'restart=$cupertino'); - expect(find.text(restartDialogTitle(7)), findsOneWidget); - expect(find.text(restartDialogMessage), findsOneWidget); + await tester.tap(find.byKey(retryRestartKey)); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + expect(find.text(restartDialogTitle(7)), findsOneWidget); + expect(find.text(restartDialogMessage), findsOneWidget); - await tester.tap(find.byKey(retryKeepKey)); - await tester.pumpAndSettle(); - expect(gateway.calls, isEmpty); - } + await tester.tap(find.byKey(retryKeepKey)); + await tester.pumpAndSettle(); + expect(gateway.calls, isEmpty); }); } diff --git a/app/test/features/runs/actions/retry_test_support.dart b/app/test/features/runs/actions/retry_test_support.dart index 67556d05..59ca3d77 100644 --- a/app/test/features/runs/actions/retry_test_support.dart +++ b/app/test/features/runs/actions/retry_test_support.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -71,19 +70,13 @@ class _RetryHostState extends State { } } -Widget retryApp(Widget child, {required bool cupertino, double textScale = 1}) { +Widget retryApp(Widget child, {double textScale = 1}) { Widget media(BuildContext context, Widget? app) => MediaQuery( data: MediaQuery.of( context, ).copyWith(textScaler: TextScaler.linear(textScale)), child: app!, ); - if (cupertino) { - return CupertinoApp( - builder: media, - home: CupertinoPageScaffold(child: Center(child: child)), - ); - } return MaterialApp( builder: media, home: Scaffold(body: Center(child: child)), @@ -94,7 +87,6 @@ Future pumpRetry( WidgetTester tester, { required FakeRetryGateway gateway, required List changed, - bool cupertino = false, double textScale = 1, JsonMap? run, }) async { @@ -105,7 +97,6 @@ Future pumpRetry( initial: run ?? failedRun(), changed: changed, ), - cupertino: cupertino, textScale: textScale, ), ); diff --git a/app/test/features/runs/actions/title_action_test.dart b/app/test/features/runs/actions/title_action_test.dart index 110fda20..b56f4753 100644 --- a/app/test/features/runs/actions/title_action_test.dart +++ b/app/test/features/runs/actions/title_action_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -11,11 +10,6 @@ import 'title_test_support.dart'; String _materialFieldText(WidgetTester tester) => tester.widget(find.byKey(runTitleFieldKey)).controller!.text; -String _cupertinoFieldText(WidgetTester tester) => tester - .widget(find.byKey(runTitleFieldKey)) - .controller! - .text; - void main() { testWidgets( 'material rename starts from the stored title, typing sends nothing, ' @@ -29,7 +23,6 @@ void main() { await tester.pumpWidget( titleApp( TitleHost(gateway: gateway, initial: titledRun(), changed: changed), - cupertino: false, ), ); @@ -85,55 +78,6 @@ void main() { }, ); - testWidgets('cupertino rename is native and sends only on Save', ( - tester, - ) async { - final accepted = renamedRun(title: 'Release build'); - final gateway = FakeTitleGateway( - (type, fields) async => {'run_detail': accepted}, - ); - final changed = []; - await tester.pumpWidget( - titleApp( - TitleHost(gateway: gateway, initial: titledRun(), changed: changed), - cupertino: true, - ), - ); - - expect(find.byKey(runTitleActionKey), findsOneWidget); - expect(find.byType(CupertinoButton), findsOneWidget); - expect(find.byType(OutlinedButton), findsNothing); - expect(gateway.calls, isEmpty); - - await tester.tap(find.byKey(runTitleActionKey)); - await tester.pumpAndSettle(); - expect(find.byType(CupertinoAlertDialog), findsOneWidget); - expect(find.byType(AlertDialog), findsNothing); - expect(_cupertinoFieldText(tester), 'Nightly build'); - - await tester.enterText(find.byKey(runTitleFieldKey), 'Typed only'); - await tester.pump(); - expect(gateway.calls, isEmpty); - await tester.tap(find.byKey(runTitleCancelKey)); - await tester.pumpAndSettle(); - expect(find.byType(CupertinoAlertDialog), findsNothing); - expect(gateway.calls, isEmpty); - - await tester.tap(find.byKey(runTitleActionKey)); - await tester.pumpAndSettle(); - await tester.enterText(find.byKey(runTitleFieldKey), 'Release build'); - await tester.tap(find.byKey(runTitleSaveKey)); - await tester.pumpAndSettle(); - - expect(gateway.calls.map((call) => call.type), ['set_run_title']); - expect(gateway.calls.single.fields, { - 'run_id': 7, - 'title': 'Release build', - }); - expect(changed.single, equals(accepted)); - expect(find.byType(CupertinoAlertDialog), findsNothing); - }); - testWidgets('a blank title is sent exactly and the server refusal is shown', ( tester, ) async { @@ -145,7 +89,6 @@ void main() { await tester.pumpWidget( titleApp( TitleHost(gateway: gateway, initial: titledRun(), changed: changed), - cupertino: false, ), ); @@ -189,7 +132,6 @@ void main() { ), changed: changed, ), - cupertino: false, ), ); await tester.tap(find.byKey(runTitleActionKey)); @@ -206,7 +148,6 @@ void main() { initial: titledRun(title: null, prompt: 'prompt is not a title'), changed: changed, ), - cupertino: false, ), ); await tester.tap(find.byKey(runTitleActionKey)); @@ -231,7 +172,6 @@ void main() { initial: {'title': 'No id'}, changed: [], ), - cupertino: false, ), ); diff --git a/app/test/features/runs/actions/title_resilience_test.dart b/app/test/features/runs/actions/title_resilience_test.dart index 32a566c3..97eb4b7e 100644 --- a/app/test/features/runs/actions/title_resilience_test.dart +++ b/app/test/features/runs/actions/title_resilience_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -13,7 +12,6 @@ Future _pump( WidgetTester tester, FakeTitleGateway gateway, List changed, { - bool cupertino = false, double textScale = 1, JsonMap? run, }) async { @@ -24,7 +22,6 @@ Future _pump( initial: run ?? titledRun(), changed: changed, ), - cupertino: cupertino, textScale: textScale, ), ); @@ -35,18 +32,10 @@ Future _open(WidgetTester tester) async { await tester.pumpAndSettle(); } -String _fieldText(WidgetTester tester, {required bool cupertino}) { - if (cupertino) { - return tester - .widget(find.byKey(runTitleFieldKey)) - .controller! - .text; - } - return tester - .widget(find.byKey(runTitleFieldKey)) - .controller! - .text; -} +String _fieldText(WidgetTester tester) => tester + .widget(find.byKey(runTitleFieldKey)) + .controller! + .text; void main() { testWidgets('a failed save keeps the prompt open with the draft intact', ( @@ -71,7 +60,7 @@ void main() { }); expect(find.text(refusal), findsOneWidget); expect(find.byKey(runTitleErrorKey), findsOneWidget); - expect(_fieldText(tester, cupertino: false), ' Renamed draft '); + expect(_fieldText(tester), ' Renamed draft '); expect(find.byType(AlertDialog), findsOneWidget); expect(changed, isEmpty); expect( @@ -87,7 +76,7 @@ void main() { (type, fields) async => throw const NotConnectedError(), ); final changed = []; - await _pump(tester, gateway, changed, cupertino: true); + await _pump(tester, gateway, changed); await _open(tester); await tester.enterText(find.byKey(runTitleFieldKey), 'Unsent title'); @@ -95,8 +84,8 @@ void main() { await tester.pumpAndSettle(); expect(find.byKey(runTitleErrorKey), findsOneWidget); - expect(_fieldText(tester, cupertino: true), 'Unsent title'); - expect(find.byType(CupertinoAlertDialog), findsOneWidget); + expect(_fieldText(tester), 'Unsent title'); + expect(find.byType(AlertDialog), findsOneWidget); expect(changed, isEmpty); }); @@ -172,7 +161,6 @@ void main() { initial: titledRun(id: 8, title: 'Another run'), changed: changed, ), - cupertino: false, ), ); await tester.pump(); @@ -198,46 +186,32 @@ void main() { addTearDown(tester.view.resetDevicePixelRatio); const refusal = 'the title is too long for this run; shorten it'; - for (final cupertino in [false, true]) { - final gateway = FakeTitleGateway( - (type, fields) async => throw const ProtocolError(refusal), - ); - await _pump( - tester, - gateway, - [], - cupertino: cupertino, - textScale: 2, - ); - await _open(tester); + final gateway = FakeTitleGateway( + (type, fields) async => throw const ProtocolError(refusal), + ); + await _pump(tester, gateway, [], textScale: 2); + await _open(tester); - expect(tester.takeException(), isNull, reason: 'cupertino=$cupertino'); - expect( - cupertino - ? find.byType(CupertinoAlertDialog) - : find.byType(AlertDialog), - findsOneWidget, - ); - expect(find.text(runTitleFieldLabel), findsOneWidget); - expect(gateway.calls, isEmpty); + expect(tester.takeException(), isNull); + expect(find.byType(AlertDialog), findsOneWidget); + expect(find.text(runTitleFieldLabel), findsOneWidget); + expect(gateway.calls, isEmpty); - await tester.enterText( - find.byKey(runTitleFieldKey), - 'A deliberately long title that must scroll rather than overflow', - ); - await tester.tap(find.byKey(runTitleSaveKey)); - await tester.pumpAndSettle(); - expect(tester.takeException(), isNull, reason: 'cupertino=$cupertino'); - expect(find.text(refusal), findsOneWidget); - expect( - _fieldText(tester, cupertino: cupertino), - 'A deliberately long title that must scroll rather than overflow', - ); + await tester.enterText( + find.byKey(runTitleFieldKey), + 'A deliberately long title that must scroll rather than overflow', + ); + await tester.tap(find.byKey(runTitleSaveKey)); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + expect(find.text(refusal), findsOneWidget); + expect( + _fieldText(tester), + 'A deliberately long title that must scroll rather than overflow', + ); - await tester.tap(find.byKey(runTitleCancelKey)); - await tester.pumpAndSettle(); - expect(find.byType(AlertDialog), findsNothing); - expect(find.byType(CupertinoAlertDialog), findsNothing); - } + await tester.tap(find.byKey(runTitleCancelKey)); + await tester.pumpAndSettle(); + expect(find.byType(AlertDialog), findsNothing); }); } diff --git a/app/test/features/runs/actions/title_test_support.dart b/app/test/features/runs/actions/title_test_support.dart index b566a2d8..461c8823 100644 --- a/app/test/features/runs/actions/title_test_support.dart +++ b/app/test/features/runs/actions/title_test_support.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/features/runs/actions/title_action.dart'; @@ -89,22 +88,15 @@ class _TitleHostState extends State { const titleHostTitleKey = ValueKey('rename-host-title'); -Widget titleApp(Widget child, {required bool cupertino, double textScale = 1}) { +Widget titleApp(Widget child, {double textScale = 1}) { Widget media(BuildContext context, Widget? app) => MediaQuery( data: MediaQuery.of( context, ).copyWith(textScaler: TextScaler.linear(textScale)), child: app!, ); - final body = Center(child: child); - if (cupertino) { - return CupertinoApp( - builder: media, - home: CupertinoPageScaffold(child: body), - ); - } return MaterialApp( builder: media, - home: Scaffold(body: body), + home: Scaffold(body: Center(child: child)), ); } diff --git a/app/test/features/runs/ui/run_cancel_wiring_test.dart b/app/test/features/runs/ui/run_cancel_wiring_test.dart index e4870152..3c4ea0c3 100644 --- a/app/test/features/runs/ui/run_cancel_wiring_test.dart +++ b/app/test/features/runs/ui/run_cancel_wiring_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/ui/status/run_status_icon.dart'; @@ -39,57 +38,49 @@ class _Gateway implements ApiGateway { } void main() { - for (final cupertino in [false, true]) { - testWidgets( - 'actual detail confirms cancel and folds accepted state ($cupertino)', - (tester) async { - final gateway = _Gateway(); - addTearDown(gateway.events.close); - final screen = RunsScreen(gateway: gateway, initialRunId: 7); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: screen)) - : MaterialApp(home: Scaffold(body: screen)), - ); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(cancelActionKey)); - await tester.pumpAndSettle(); - expect(find.text('Cancel run 7?'), findsOneWidget); - expect(gateway.requests.where((r) => r.type == 'cancel_run'), isEmpty); - await tester.tap(find.byKey(cancelKeepKey)); - await tester.pumpAndSettle(); - expect(gateway.requests.where((r) => r.type == 'cancel_run'), isEmpty); + testWidgets('actual detail confirms cancel and folds accepted state', ( + tester, + ) async { + final gateway = _Gateway(); + addTearDown(gateway.events.close); + final screen = RunsScreen(gateway: gateway, initialRunId: 7); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen))); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(cancelActionKey)); + await tester.pumpAndSettle(); + expect(find.text('Cancel run 7?'), findsOneWidget); + expect(gateway.requests.where((r) => r.type == 'cancel_run'), isEmpty); + await tester.tap(find.byKey(cancelKeepKey)); + await tester.pumpAndSettle(); + expect(gateway.requests.where((r) => r.type == 'cancel_run'), isEmpty); - await tester.tap(find.byKey(cancelActionKey)); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(cancelConfirmKey)); - await tester.pump(); - expect( - gateway.requests.where((r) => r.type == 'cancel_run').single.fields, - {'run_id': 7}, - ); - expect(find.text('canceled'), findsNothing); - gateway.canceled.complete({ - 'run_detail': { - ...gateway.run, - 'status': 'canceled', - 'executing': false, - }, - }); - await tester.pumpAndSettle(); - expect(find.byKey(cancelActionKey), findsNothing); - expect(find.text('canceled'), findsOneWidget); - // The held list is already visible beside the detail. - expect( - find.byWidgetPredicate( - (widget) => widget is RunStatusIcon && widget.label == 'canceled', - ), - findsWidgets, - reason: - 'The accepted server state must also update the held list row', - ); - await tester.pumpWidget(const SizedBox.shrink()); - }, + await tester.tap(find.byKey(cancelActionKey)); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(cancelConfirmKey)); + await tester.pump(); + expect( + gateway.requests.where((r) => r.type == 'cancel_run').single.fields, + {'run_id': 7}, ); - } + expect(find.text('canceled'), findsNothing); + gateway.canceled.complete({ + 'run_detail': { + ...gateway.run, + 'status': 'canceled', + 'executing': false, + }, + }); + await tester.pumpAndSettle(); + expect(find.byKey(cancelActionKey), findsNothing); + expect(find.text('canceled'), findsOneWidget); + // The held list is already visible beside the detail. + expect( + find.byWidgetPredicate( + (widget) => widget is RunStatusIcon && widget.label == 'canceled', + ), + findsWidgets, + reason: 'The accepted server state must also update the held list row', + ); + await tester.pumpWidget(const SizedBox.shrink()); + }); } diff --git a/app/test/features/runs/ui/run_decide_deep_link_test.dart b/app/test/features/runs/ui/run_decide_deep_link_test.dart index 62c0d1b1..d05ce10b 100644 --- a/app/test/features/runs/ui/run_decide_deep_link_test.dart +++ b/app/test/features/runs/ui/run_decide_deep_link_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'run_detail_finders.dart'; @@ -90,41 +89,30 @@ Future _pump( } void main() { - for (final cupertino in [false, true]) { - testWidgets('a decide route opens the waiting prompt ($cupertino)', ( - tester, - ) async { - final gateway = _Gateway(_waitingRun()); - addTearDown(gateway.close); - tester.view.physicalSize = const Size(900, 1000); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.reset); - final screen = RunsScreen( - gateway: gateway, - initialRunId: 9, - initialDecide: true, - ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: screen)) - : MaterialApp(home: Scaffold(body: screen)), - ); - await tester.pumpAndSettle(); + testWidgets('a decide route opens the waiting prompt', (tester) async { + final gateway = _Gateway(_waitingRun()); + addTearDown(gateway.close); + tester.view.physicalSize = const Size(900, 1000); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final screen = RunsScreen( + gateway: gateway, + initialRunId: 9, + initialDecide: true, + ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen))); + await tester.pumpAndSettle(); - expect(find.byKey(decisionFeedbackKey), findsOneWidget); - expect( - find.text('Please review this recorded checkpoint.'), - findsOneWidget, - ); + expect(find.byKey(decisionFeedbackKey), findsOneWidget); + expect(find.text('Please review this recorded checkpoint.'), findsOneWidget); - // Closing the prompt leaves the loaded detail underneath. - await tester.tap(find.text(decisionCancelLabel)); - await tester.pumpAndSettle(); - expect(find.byKey(decisionFeedbackKey), findsNothing); - expect(runDetailText('Human checkpoint'), findsOneWidget); - expect(find.byKey(decisionActionKey), findsOneWidget); - }); - } + // Closing the prompt leaves the loaded detail underneath. + await tester.tap(find.text(decisionCancelLabel)); + await tester.pumpAndSettle(); + expect(find.byKey(decisionFeedbackKey), findsNothing); + expect(runDetailText('Human checkpoint'), findsOneWidget); + expect(find.byKey(decisionActionKey), findsOneWidget); + }); testWidgets('a decide route on a non-waiting run invents no prompt', ( tester, diff --git a/app/test/features/runs/ui/run_decision_wiring_test.dart b/app/test/features/runs/ui/run_decision_wiring_test.dart index d4e27fbf..6d1d8c0a 100644 --- a/app/test/features/runs/ui/run_decision_wiring_test.dart +++ b/app/test/features/runs/ui/run_decision_wiring_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -60,74 +59,63 @@ class _DecisionGateway implements ApiGateway { } void main() { - for (final cupertino in [false, true]) { - testWidgets( - 'actual detail exposes and confirms recorded decision ($cupertino)', - (tester) async { - final gateway = _DecisionGateway(); - addTearDown(gateway.events.close); - final screen = RunsScreen(gateway: gateway, initialRunId: 9); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: screen)) - : MaterialApp(home: Scaffold(body: screen)), - ); - await tester.pumpAndSettle(); - expect(find.text(decisionWaitingTitle), findsOneWidget); - // The web's decision banner spans the header's glass strip (under - // the top bar, 12 in from the pane) at the strip's 12px inset, with - // Decide trailing. - final banner = tester.getRect( - find.byKey(const Key('run-decision-banner')), - ); - final strip = tester.getRect( - find.descendant( - of: find.byKey(const Key('run-detail-header')), - matching: find.byType(GlassPill), - ), - ); - final pane = tester.getRect( - find.byKey(const ValueKey('list-detail-body')), - ); - expect(strip.left, pane.left + 12); - expect(strip.right, pane.right - 12); - expect(banner.left, strip.left + 12); - expect(banner.right, strip.right - 12); - expect( - tester.getCenter(find.byKey(decisionActionKey)).dx, - greaterThan(banner.center.dx), - ); - await tester.tap(find.byKey(decisionActionKey)); - await tester.pumpAndSettle(); - expect( - find.text('Please review this recorded checkpoint.'), - findsOneWidget, - ); - await tester.tap(find.text('approve')); - await tester.enterText(find.byKey(decisionFeedbackKey), ' checked '); - await tester.pump(); - expect(gateway.decisions, isEmpty); - await tester.tap(find.text(decisionConfirmLabel)); - await tester.pump(); - expect(gateway.decisions.single, { - 'run_id': 9, - 'stage': 'gate', - 'option': 'approve', - 'feedback': 'checked', - }); - gateway.reply.complete({ - 'run_detail': { - ...gateway.run, - 'status': 'succeeded', - 'executing': false, - }, - }); - await tester.pumpAndSettle(); - expect(find.byKey(decisionActionKey), findsNothing); - expect(find.text(decisionWaitingTitle), findsNothing); - expect(find.text('succeeded'), findsOneWidget); - await tester.pumpWidget(const SizedBox.shrink()); - }, + testWidgets('actual detail exposes and confirms recorded decision', ( + tester, + ) async { + final gateway = _DecisionGateway(); + addTearDown(gateway.events.close); + final screen = RunsScreen(gateway: gateway, initialRunId: 9); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen))); + await tester.pumpAndSettle(); + expect(find.text(decisionWaitingTitle), findsOneWidget); + // The web's decision banner spans the header's glass strip (under + // the top bar, 12 in from the pane) at the strip's 12px inset, with + // Decide trailing. + final banner = tester.getRect(find.byKey(const Key('run-decision-banner'))); + final strip = tester.getRect( + find.descendant( + of: find.byKey(const Key('run-detail-header')), + matching: find.byType(GlassPill), + ), ); - } + final pane = tester.getRect(find.byKey(const ValueKey('list-detail-body'))); + expect(strip.left, pane.left + 12); + expect(strip.right, pane.right - 12); + expect(banner.left, strip.left + 12); + expect(banner.right, strip.right - 12); + expect( + tester.getCenter(find.byKey(decisionActionKey)).dx, + greaterThan(banner.center.dx), + ); + await tester.tap(find.byKey(decisionActionKey)); + await tester.pumpAndSettle(); + expect( + find.text('Please review this recorded checkpoint.'), + findsOneWidget, + ); + await tester.tap(find.text('approve')); + await tester.enterText(find.byKey(decisionFeedbackKey), ' checked '); + await tester.pump(); + expect(gateway.decisions, isEmpty); + await tester.tap(find.text(decisionConfirmLabel)); + await tester.pump(); + expect(gateway.decisions.single, { + 'run_id': 9, + 'stage': 'gate', + 'option': 'approve', + 'feedback': 'checked', + }); + gateway.reply.complete({ + 'run_detail': { + ...gateway.run, + 'status': 'succeeded', + 'executing': false, + }, + }); + await tester.pumpAndSettle(); + expect(find.byKey(decisionActionKey), findsNothing); + expect(find.text(decisionWaitingTitle), findsNothing); + expect(find.text('succeeded'), findsOneWidget); + await tester.pumpWidget(const SizedBox.shrink()); + }); } diff --git a/app/test/features/runs/ui/run_retry_guard_test.dart b/app/test/features/runs/ui/run_retry_guard_test.dart index 96c767bc..e4cd1944 100644 --- a/app/test/features/runs/ui/run_retry_guard_test.dart +++ b/app/test/features/runs/ui/run_retry_guard_test.dart @@ -17,7 +17,6 @@ void main() { await mountRetryScreen( tester, gateway, - cupertino: false, onRunSelected: opened.add, ); @@ -40,7 +39,6 @@ void main() { await mountRetryScreen( tester, gateway, - cupertino: false, onRunSelected: opened.add, ); @@ -65,7 +63,6 @@ void main() { await mountRetryScreen( tester, gateway, - cupertino: false, onRunSelected: opened.add, ); @@ -87,7 +84,6 @@ void main() { await mountRetryScreen( tester, gateway, - cupertino: false, onRunSelected: opened.add, ); @@ -107,7 +103,7 @@ void main() { ) async { final gateway = RetryWiringGateway(executing: true); addTearDown(gateway.framesController.close); - await mountRetryScreen(tester, gateway, cupertino: false); + await mountRetryScreen(tester, gateway); expect(find.byKey(runMoreMenuKey), findsOneWidget); expect(await retryOffered(tester), isFalse); diff --git a/app/test/features/runs/ui/run_retry_layout_test.dart b/app/test/features/runs/ui/run_retry_layout_test.dart index 23fe1fa2..6ef10dd4 100644 --- a/app/test/features/runs/ui/run_retry_layout_test.dart +++ b/app/test/features/runs/ui/run_retry_layout_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/runs/actions/cancel_wording.dart'; @@ -36,57 +35,48 @@ void main() { expect(cancel.left, closeTo(16, 0.5)); }); - for (final cupertino in [false, true]) { - testWidgets('320 px at 2x keeps Retry reachable ($cupertino)', ( - tester, - ) async { - tester.view.physicalSize = const Size(320, 480); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); + testWidgets('320 px at 2x keeps Retry reachable', (tester) async { + tester.view.physicalSize = const Size(320, 480); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.resetDevicePixelRatio); - final gateway = RetryWiringGateway(); - addTearDown(gateway.framesController.close); - Widget scale(BuildContext context, Widget? app) => MediaQuery( - data: MediaQuery.of( - context, - ).copyWith(textScaler: const TextScaler.linear(2)), - child: app!, - ); - // The action row itself, in the detail's 16 px inset, so the narrow - // accessibility state is measured without unrelated header controls. - final row = Padding( - padding: const EdgeInsets.all(16), - child: RunDetailActions( - run: retryFailedDetail(), - gateway: gateway, - onRunChanged: (_) {}, - ), - ); - await tester.pumpWidget( - cupertino - ? CupertinoApp( - builder: scale, - home: CupertinoPageScaffold(child: SafeArea(child: row)), - ) - : MaterialApp( - builder: scale, - home: Scaffold(body: row), - ), - ); - await tester.pumpAndSettle(); + final gateway = RetryWiringGateway(); + addTearDown(gateway.framesController.close); + Widget scale(BuildContext context, Widget? app) => MediaQuery( + data: MediaQuery.of( + context, + ).copyWith(textScaler: const TextScaler.linear(2)), + child: app!, + ); + // The action row itself, in the detail's 16 px inset, so the narrow + // accessibility state is measured without unrelated header controls. + final row = Padding( + padding: const EdgeInsets.all(16), + child: RunDetailActions( + run: retryFailedDetail(), + gateway: gateway, + onRunChanged: (_) {}, + ), + ); + await tester.pumpWidget( + MaterialApp( + builder: scale, + home: Scaffold(body: row), + ), + ); + await tester.pumpAndSettle(); - expect(find.byKey(retryActionKey).hitTestable(), findsOneWidget); - final rect = tester.getRect(find.byKey(retryActionKey)); - expect(rect.left, greaterThanOrEqualTo(0)); - expect(rect.right, lessThanOrEqualTo(320)); + expect(find.byKey(retryActionKey).hitTestable(), findsOneWidget); + final rect = tester.getRect(find.byKey(retryActionKey)); + expect(rect.left, greaterThanOrEqualTo(0)); + expect(rect.right, lessThanOrEqualTo(320)); - await tester.tap(find.byKey(retryActionKey)); - await tester.pumpAndSettle(); - expect(find.text(retryDialogTitle(7)), findsOneWidget); - await tester.tap(find.byKey(retryKeepKey)); - await tester.pumpAndSettle(); - expect(gateway.retryCalls, isEmpty); - }); - } + await tester.tap(find.byKey(retryActionKey)); + await tester.pumpAndSettle(); + expect(find.text(retryDialogTitle(7)), findsOneWidget); + await tester.tap(find.byKey(retryKeepKey)); + await tester.pumpAndSettle(); + expect(gateway.retryCalls, isEmpty); + }); } diff --git a/app/test/features/runs/ui/run_retry_wiring_support.dart b/app/test/features/runs/ui/run_retry_wiring_support.dart index 688e6283..6def348f 100644 --- a/app/test/features/runs/ui/run_retry_wiring_support.dart +++ b/app/test/features/runs/ui/run_retry_wiring_support.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/runs/ui/run_more_menu.dart'; @@ -88,7 +87,6 @@ class RetryWiringGateway implements ApiGateway { Future mountRetryScreen( WidgetTester tester, RetryWiringGateway gateway, { - required bool cupertino, ValueChanged? onRunSelected, }) async { final screen = RunsScreen( @@ -96,13 +94,7 @@ Future mountRetryScreen( initialRunId: 7, onRunSelected: onRunSelected, ); - await tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold(child: SafeArea(child: screen)), - ) - : MaterialApp(home: Scaffold(body: screen)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen))); await tester.pumpAndSettle(); } diff --git a/app/test/features/runs/ui/run_retry_wiring_test.dart b/app/test/features/runs/ui/run_retry_wiring_test.dart index 6893b1d2..a88d843e 100644 --- a/app/test/features/runs/ui/run_retry_wiring_test.dart +++ b/app/test/features/runs/ui/run_retry_wiring_test.dart @@ -7,65 +7,55 @@ import 'run_retry_wiring_support.dart'; import 'run_detail_finders.dart'; void main() { - for (final cupertino in [false, true]) { - testWidgets( - 'accepted retry reply opens the server-identified run ($cupertino)', - (tester) async { - final gateway = RetryWiringGateway(); - addTearDown(gateway.framesController.close); - final opened = []; - await mountRetryScreen( - tester, - gateway, - cupertino: cupertino, - onRunSelected: opened.add, - ); + testWidgets( + 'accepted retry reply opens the server-identified run', + (tester) async { + final gateway = RetryWiringGateway(); + addTearDown(gateway.framesController.close); + final opened = []; + await mountRetryScreen(tester, gateway, onRunSelected: opened.add); - expect(runDetailText(retryFailedTitle), findsOneWidget); - expect(find.byKey(runMoreMenuKey), findsOneWidget); - expect(await retryOffered(tester), isTrue); - expect(find.byKey(cancelActionKey), findsNothing); - expect(gateway.retryCalls, isEmpty); + expect(runDetailText(retryFailedTitle), findsOneWidget); + expect(find.byKey(runMoreMenuKey), findsOneWidget); + expect(await retryOffered(tester), isTrue); + expect(find.byKey(cancelActionKey), findsNothing); + expect(gateway.retryCalls, isEmpty); - await openRetry(tester); - expect(find.text(retryDialogTitle(7)), findsOneWidget); - expect(find.text(retryDialogMessage), findsOneWidget); - expect(gateway.retryCalls, isEmpty); + await openRetry(tester); + expect(find.text(retryDialogTitle(7)), findsOneWidget); + expect(find.text(retryDialogMessage), findsOneWidget); + expect(gateway.retryCalls, isEmpty); - await tester.tap(find.byKey(retryKeepKey)); - await tester.pumpAndSettle(); - expect(gateway.retryCalls, isEmpty); - expect(opened, isEmpty); - expect(await retryOffered(tester), isTrue); + await tester.tap(find.byKey(retryKeepKey)); + await tester.pumpAndSettle(); + expect(gateway.retryCalls, isEmpty); + expect(opened, isEmpty); + expect(await retryOffered(tester), isTrue); - await confirmRetry(tester); - expect(gateway.retryCalls, hasLength(1)); - final fields = gateway.retryCalls.single.fields; - expect(fields.keys.toSet(), {'run_id', 'request_key'}); - expect(fields['run_id'], 7); - expect(fields['request_key'], startsWith('app-retry-7-')); - expect( - (fields['request_key'] as String).length, - lessThanOrEqualTo(128), - ); - // The prompt closes only from server truth; no navigation is guessed. - expect(opened, isEmpty); - expect(runDetailText(retryFailedTitle), findsOneWidget); + await confirmRetry(tester); + expect(gateway.retryCalls, hasLength(1)); + final fields = gateway.retryCalls.single.fields; + expect(fields.keys.toSet(), {'run_id', 'request_key'}); + expect(fields['run_id'], 7); + expect(fields['request_key'], startsWith('app-retry-7-')); + expect((fields['request_key'] as String).length, lessThanOrEqualTo(128)); + // The prompt closes only from server truth; no navigation is guessed. + expect(opened, isEmpty); + expect(runDetailText(retryFailedTitle), findsOneWidget); - gateway.acceptRetry(retryCreatedDetail()); - await tester.pumpAndSettle(); + gateway.acceptRetry(retryCreatedDetail()); + await tester.pumpAndSettle(); - expect(opened, [8]); - expect(runDetailText(retryCreatedTitle), findsOneWidget); - expect(runDetailText(retryFailedTitle), findsNothing); - expect(await retryOffered(tester), isFalse); - expect( - gateway.calls.where((call) => call.type == 'get_run').last.fields, - {'run_id': 8}, - ); - }, - ); - } + expect(opened, [8]); + expect(runDetailText(retryCreatedTitle), findsOneWidget); + expect(runDetailText(retryFailedTitle), findsNothing); + expect(await retryOffered(tester), isFalse); + expect( + gateway.calls.where((call) => call.type == 'get_run').last.fields, + {'run_id': 8}, + ); + }, + ); testWidgets('restart sends its explicit mode through the real detail row', ( tester, @@ -73,12 +63,7 @@ void main() { final gateway = RetryWiringGateway(); addTearDown(gateway.framesController.close); final opened = []; - await mountRetryScreen( - tester, - gateway, - cupertino: false, - onRunSelected: opened.add, - ); + await mountRetryScreen(tester, gateway, onRunSelected: opened.add); await openRetry(tester); await tester.tap(find.byKey(retryRestartKey)); diff --git a/app/test/features/runs/ui/run_session_repair_action_test.dart b/app/test/features/runs/ui/run_session_repair_action_test.dart index 3d05e399..671edef4 100644 --- a/app/test/features/runs/ui/run_session_repair_action_test.dart +++ b/app/test/features/runs/ui/run_session_repair_action_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -100,16 +99,9 @@ Future _pumpSession( WidgetTester tester, _RepairGateway gateway, { JsonMap? run, - bool cupertino = false, }) { final host = _SessionHost(run: run ?? partialRun(), gateway: gateway); - return tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold(child: SafeArea(child: host)), - ) - : MaterialApp(home: Scaffold(body: host)), - ); + return tester.pumpWidget(MaterialApp(home: Scaffold(body: host))); } TextButton _materialButton(WidgetTester tester) => tester.widget( @@ -254,18 +246,15 @@ void main() { expect(find.text('partial'), findsOneWidget); }); - testWidgets('the Cupertino host uses a native Cupertino button', ( - tester, - ) async { + testWidgets('the repair control is a Material text button', (tester) async { final gateway = _RepairGateway( (_, _) => Future.error(StateError('unexpected')), ); - await _pumpSession(tester, gateway, cupertino: true); + await _pumpSession(tester, gateway); expect( - find.widgetWithText(CupertinoButton, 'Retry export only'), + find.widgetWithText(TextButton, 'Retry export only'), findsOneWidget, ); - expect(find.widgetWithText(TextButton, 'Retry export only'), findsNothing); }); } diff --git a/app/test/features/runs/ui/run_title_wiring_test.dart b/app/test/features/runs/ui/run_title_wiring_test.dart index 7c641203..1f3118f2 100644 --- a/app/test/features/runs/ui/run_title_wiring_test.dart +++ b/app/test/features/runs/ui/run_title_wiring_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'run_detail_finders.dart'; @@ -65,28 +64,17 @@ class _Gateway implements ApiGateway { Future<_Gateway> _mount( WidgetTester tester, { - required bool cupertino, int initialRunId = 1, }) async { final gateway = _Gateway(); final screen = RunsScreen(gateway: gateway, initialRunId: initialRunId); - await tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold(child: SafeArea(child: screen)), - ) - : MaterialApp(home: Scaffold(body: screen)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen))); await tester.pumpAndSettle(); return gateway; } -String _fieldText(WidgetTester tester, {required bool cupertino}) => cupertino - ? tester - .widget(find.byKey(runTitleFieldKey)) - .controller! - .text - : tester.widget(find.byKey(runTitleFieldKey)).controller!.text; +String _fieldText(WidgetTester tester) => + tester.widget(find.byKey(runTitleFieldKey)).controller!.text; /// Rename lives in the run detail's more menu. Future _openRename(WidgetTester tester) async { @@ -99,7 +87,7 @@ Future _openRename(WidgetTester tester) async { void main() { testWidgets('material detail renames through the shared gateway and folds ' 'only the server reply into the detail and list', (tester) async { - final gateway = await _mount(tester, cupertino: false); + final gateway = await _mount(tester); expect(runDetailText('Nightly build'), findsOneWidget); expect(find.byKey(runMoreMenuKey), findsOneWidget); @@ -107,7 +95,7 @@ void main() { await _openRename(tester); expect(find.byType(AlertDialog), findsOneWidget); - expect(_fieldText(tester, cupertino: false), 'Nightly build'); + expect(_fieldText(tester), 'Nightly build'); await tester.enterText(find.byKey(runTitleFieldKey), 'Draft only'); await tester.pump(); @@ -146,35 +134,10 @@ void main() { ); }); - testWidgets('cupertino detail shows the native rename entry point', ( - tester, - ) async { - final gateway = await _mount(tester, cupertino: true); - - expect(find.byKey(runMoreMenuKey), findsOneWidget); - - await _openRename(tester); - expect(find.byType(CupertinoAlertDialog), findsOneWidget); - expect(find.byType(AlertDialog), findsNothing); - - await tester.enterText(find.byKey(runTitleFieldKey), 'Release build'); - await tester.tap(find.byKey(runTitleSaveKey)); - await tester.pump(); - expect(gateway.saves.single.fields, { - 'run_id': 1, - 'title': 'Release build', - }); - gateway.accept('Release build'); - await tester.pumpAndSettle(); - - expect(find.byType(CupertinoAlertDialog), findsNothing); - expect(runDetailText('Release build'), findsOneWidget); - }); - testWidgets('a refused rename keeps the typed title and the stored detail', ( tester, ) async { - final gateway = await _mount(tester, cupertino: false); + final gateway = await _mount(tester); await _openRename(tester); await tester.enterText(find.byKey(runTitleFieldKey), ' locked '); @@ -184,7 +147,7 @@ void main() { await tester.pumpAndSettle(); expect(find.text('rename refused by the server'), findsOneWidget); - expect(_fieldText(tester, cupertino: false), ' locked '); + expect(_fieldText(tester), ' locked '); expect(find.byType(AlertDialog), findsOneWidget); expect(runDetailText('Nightly build'), findsOneWidget); }); diff --git a/app/test/features/runs/ui/runs_delete_test.dart b/app/test/features/runs/ui/runs_delete_test.dart index 6082ac34..8e56bf0e 100644 --- a/app/test/features/runs/ui/runs_delete_test.dart +++ b/app/test/features/runs/ui/runs_delete_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -78,7 +77,6 @@ List _fixture() { Future _mount( WidgetTester tester, _Gateway gateway, { - bool cupertino = false, int? initialRunId, RunsSortStore? store, ValueChanged? onBack, @@ -92,11 +90,7 @@ Future _mount( onBack: onBack, sortStore: store ?? MemoryRunsSortStore(), ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: screen)) - : MaterialApp(home: Scaffold(body: screen)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: screen))); await tester.pumpAndSettle(); } @@ -200,14 +194,14 @@ void main() { testWidgets('Cancel in the prompt sends nothing', (tester) async { final gateway = _Gateway(_fixture()); - await _mount(tester, gateway, cupertino: true); + await _mount(tester, gateway); await tester.tap(find.byKey(runsSelectKey)); await tester.pumpAndSettle(); await tester.tap(find.text('Yesterday done')); await tester.pumpAndSettle(); await tester.tap(find.byKey(runsDeleteSelectedKey)); await tester.pumpAndSettle(); - expect(find.byType(CupertinoAlertDialog), findsOneWidget); + expect(find.byType(AlertDialog), findsOneWidget); expect(find.text('Delete 1 run?'), findsOneWidget); await tester.tap(find.byKey(deleteRunsKeepKey)); await tester.pumpAndSettle(); From 4647b9c43ecf28af4a05533317bcf9e87451ea61 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 04:26:05 +0000 Subject: [PATCH 2/2] Remove Cupertino schedules branches Keep the Material-only schedules implementation while preserving public Cupertino parameters for callers. Remove Cupertino-only test hosts and variants because the app runs every schedule screen under MaterialApp. --- app/lib/features/schedules/screen.dart | 8 +- .../ui/editor/schedule_editor_fields.dart | 69 +++-------- .../ui/editor/schedule_editor_form.dart | 26 +---- .../ui/editor/schedule_editor_form_body.dart | 7 +- .../ui/editor/schedule_editor_selectors.dart | 108 ++++-------------- .../schedules/ui/list/schedule_list_row.dart | 13 +-- .../ui/list/schedule_list_toolbar.dart | 34 ++---- .../schedules/ui/list/schedule_list_view.dart | 27 +---- .../ui/pipeline/schedule_delete_dialog.dart | 38 +----- .../ui/pipeline/schedule_pipeline_editor.dart | 26 ++--- .../pipeline/schedule_pipeline_list_body.dart | 26 +---- .../ui/pipeline/schedule_pipeline_row.dart | 6 +- .../ui/pipeline/schedule_pipeline_styles.dart | 34 +----- .../schedules/ui/run/schedule_run_action.dart | 20 +--- .../ui/editor/schedule_editor_harness.dart | 22 +--- .../schedule_editor_interaction_test.dart | 45 -------- .../editor/schedule_editor_layout_test.dart | 34 ------ .../ui/list/schedule_list_test_support.dart | 13 +-- .../ui/list/schedule_screen_harness.dart | 2 - .../ui/list/schedules_layout_test.dart | 12 +- .../ui/list/schedules_refresh_test.dart | 8 +- .../ui/list/schedules_screen_test.dart | 26 ++--- .../ui/list/schedules_wide_test.dart | 1 - .../schedule_pipeline_section_test.dart | 56 ++++----- .../schedule_pipeline_test_support.dart | 21 +--- .../ui/run/schedule_run_action_test.dart | 51 +-------- 26 files changed, 144 insertions(+), 589 deletions(-) diff --git a/app/lib/features/schedules/screen.dart b/app/lib/features/schedules/screen.dart index 5b78e853..5dfafd82 100644 --- a/app/lib/features/schedules/screen.dart +++ b/app/lib/features/schedules/screen.dart @@ -73,19 +73,13 @@ class _SchedulesScreenState extends State { @override Widget build(BuildContext context) { - final cupertino = - Localizations.of( - context, - MaterialLocalizations, - ) == - null; return AnimatedBuilder( animation: _controller, builder: (context, _) => SchedulesListView( controller: _controller, searchController: _searchController, scrollController: _scrollController, - cupertino: cupertino, + cupertino: false, onOpen: widget.onOpen, onRefresh: () => unawaited(_controller.refresh()), ), diff --git a/app/lib/features/schedules/ui/editor/schedule_editor_fields.dart b/app/lib/features/schedules/ui/editor/schedule_editor_fields.dart index f33476b7..66ac0938 100644 --- a/app/lib/features/schedules/ui/editor/schedule_editor_fields.dart +++ b/app/lib/features/schedules/ui/editor/schedule_editor_fields.dart @@ -1,29 +1,15 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../../ui/adaptive/host.dart'; - -/// Secondary text under a field, using the host's own colours and text theme. +/// Secondary text under a field, using the app's colours and text theme. TextStyle scheduleEditorSecondaryStyle(BuildContext context) { - if (usesCupertinoHost(context)) { - // The host's own secondary-label style; no invented point size. - return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - } final theme = Theme.of(context); return (theme.textTheme.bodySmall ?? const TextStyle()).copyWith( color: theme.colorScheme.onSurfaceVariant, ); } -/// The host's semantic error colour, never a form-specific palette. +/// The app's semantic error colour, never a form-specific palette. TextStyle scheduleEditorErrorStyle(BuildContext context) { - if (usesCupertinoHost(context)) { - return CupertinoTheme.of(context).textTheme.textStyle.copyWith( - color: CupertinoColors.systemRed.resolveFrom(context), - ); - } return TextStyle(color: Theme.of(context).colorScheme.error); } @@ -47,9 +33,7 @@ class ScheduleEditorField extends StatelessWidget { @override Widget build(BuildContext context) { - final labelStyle = usesCupertinoHost(context) - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.bodyMedium; + final labelStyle = Theme.of(context).textTheme.bodyMedium; return Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, @@ -103,27 +87,16 @@ class ScheduleEditorTextField extends StatelessWidget { @override Widget build(BuildContext context) { - final field = usesCupertinoHost(context) - ? CupertinoTextField( - key: fieldKey, - controller: controller, - enabled: enabled, - keyboardType: keyboardType, - minLines: minLines, - maxLines: maxLines, - textInputAction: textInputAction, - onChanged: onChanged, - ) - : TextField( - key: fieldKey, - controller: controller, - enabled: enabled, - keyboardType: keyboardType, - minLines: minLines, - maxLines: maxLines, - textInputAction: textInputAction, - onChanged: onChanged, - ); + final field = TextField( + key: fieldKey, + controller: controller, + enabled: enabled, + keyboardType: keyboardType, + minLines: minLines, + maxLines: maxLines, + textInputAction: textInputAction, + onChanged: onChanged, + ); return MergeSemantics( child: ScheduleEditorField( label: label, @@ -156,17 +129,11 @@ class ScheduleEditorSwitchField extends StatelessWidget { @override Widget build(BuildContext context) { - final control = usesCupertinoHost(context) - ? CupertinoSwitch( - key: switchKey, - value: value, - onChanged: enabled ? onChanged : null, - ) - : Switch( - key: switchKey, - value: value, - onChanged: enabled ? onChanged : null, - ); + final control = Switch( + key: switchKey, + value: value, + onChanged: enabled ? onChanged : null, + ); return MergeSemantics( child: Column( mainAxisSize: MainAxisSize.min, diff --git a/app/lib/features/schedules/ui/editor/schedule_editor_form.dart b/app/lib/features/schedules/ui/editor/schedule_editor_form.dart index 4180544b..047bef41 100644 --- a/app/lib/features/schedules/ui/editor/schedule_editor_form.dart +++ b/app/lib/features/schedules/ui/editor/schedule_editor_form.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../core/api_gateway.dart'; -import '../../../../ui/adaptive/host.dart'; import '../../domain/editor/schedule_draft.dart'; import '../../domain/schedule_rule.dart'; import 'schedule_editor_form_body.dart'; @@ -151,7 +149,6 @@ class _ScheduleEditorFormState extends State { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); return ScheduleEditorFormBody( heading: _heading, showHeading: widget.showHeading, @@ -193,25 +190,17 @@ class _ScheduleEditorFormState extends State { runSpacing: 8, children: [ if (widget.onCancel != null) - _cancelButton(cupertino) + _cancelButton() else const SizedBox.shrink(), - _saveButton(cupertino), + _saveButton(), ], ), ); } - Widget _cancelButton(bool cupertino) { + Widget _cancelButton() { final onPressed = _sending ? null : widget.onCancel; - if (cupertino) { - return CupertinoButton( - key: scheduleEditorCancelKey, - padding: EdgeInsets.zero, - onPressed: onPressed, - child: const Text(scheduleEditorCancelLabel), - ); - } return TextButton( key: scheduleEditorCancelKey, onPressed: onPressed, @@ -219,18 +208,11 @@ class _ScheduleEditorFormState extends State { ); } - Widget _saveButton(bool cupertino) { + Widget _saveButton() { final label = Text( _sending ? scheduleEditorSendingLabel : scheduleEditorSubmitLabel, ); final onPressed = _sending ? null : _submit; - if (cupertino) { - return CupertinoButton.filled( - key: scheduleEditorSubmitKey, - onPressed: onPressed, - child: label, - ); - } return FilledButton( key: scheduleEditorSubmitKey, onPressed: onPressed, diff --git a/app/lib/features/schedules/ui/editor/schedule_editor_form_body.dart b/app/lib/features/schedules/ui/editor/schedule_editor_form_body.dart index 23059c40..0c147029 100644 --- a/app/lib/features/schedules/ui/editor/schedule_editor_form_body.dart +++ b/app/lib/features/schedules/ui/editor/schedule_editor_form_body.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../../ui/adaptive/host.dart'; import '../../domain/editor/schedule_draft.dart'; import 'schedule_editor_fields.dart'; import 'schedule_editor_selectors.dart'; @@ -100,10 +98,7 @@ class ScheduleEditorFormBody extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); - final titleStyle = cupertino - ? CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle - : Theme.of(context).textTheme.titleLarge; + final titleStyle = Theme.of(context).textTheme.titleLarge; return Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, diff --git a/app/lib/features/schedules/ui/editor/schedule_editor_selectors.dart b/app/lib/features/schedules/ui/editor/schedule_editor_selectors.dart index 637689fb..25329613 100644 --- a/app/lib/features/schedules/ui/editor/schedule_editor_selectors.dart +++ b/app/lib/features/schedules/ui/editor/schedule_editor_selectors.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../../ui/adaptive/host.dart'; import '../../domain/schedule_rule.dart'; import 'schedule_editor_fields.dart'; @@ -17,7 +15,7 @@ class ScheduleEditorChoice { final String label; } -/// A native drop-down on Material and a native action sheet on Cupertino. +/// A native drop-down of the field's options. class ScheduleEditorChoiceField extends StatelessWidget { const ScheduleEditorChoiceField({ super.key, @@ -40,65 +38,22 @@ class ScheduleEditorChoiceField extends StatelessWidget { final String? error; final Key? fieldKey; - String get _selectedLabel { - for (final option in options) { - if (option.value == value) return option.label; - } - return ''; - } - - Future _choose(BuildContext context) async { - final chosen = await showCupertinoModalPopup( - context: context, - builder: (sheetContext) => CupertinoActionSheet( - title: Text(label), - actions: [ - for (final option in options) - CupertinoActionSheetAction( - onPressed: () => Navigator.pop(sheetContext, option.value), - child: Text(option.label), - ), - ], - cancelButton: CupertinoActionSheetAction( - onPressed: () => Navigator.pop(sheetContext), - child: const Text('Cancel'), - ), - ), - ); - if (chosen != null) onChanged(chosen); - } - @override Widget build(BuildContext context) { - final control = usesCupertinoHost(context) - ? CupertinoButton( - key: fieldKey, - padding: EdgeInsets.zero, - onPressed: enabled ? () => _choose(context) : null, - child: Row( - children: [ - Expanded(child: Text(_selectedLabel)), - const Icon(CupertinoIcons.chevron_down), - ], - ), - ) - : DropdownButtonFormField( - key: fieldKey, - initialValue: value, - isExpanded: true, - items: [ - for (final option in options) - DropdownMenuItem( - value: option.value, - child: Text(option.label), - ), - ], - onChanged: enabled - ? (chosen) { - if (chosen != null) onChanged(chosen); - } - : null, - ); + final control = DropdownButtonFormField( + key: fieldKey, + initialValue: value, + isExpanded: true, + items: [ + for (final option in options) + DropdownMenuItem(value: option.value, child: Text(option.label)), + ], + onChanged: enabled + ? (chosen) { + if (chosen != null) onChanged(chosen); + } + : null, + ); return MergeSemantics( child: ScheduleEditorField( label: label, @@ -164,18 +119,11 @@ class _DayToggle extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); - final checkbox = cupertino - ? CupertinoCheckbox( - key: scheduleEditorDayKey(day), - value: selected, - onChanged: enabled ? (_) => onTap() : null, - ) - : Checkbox( - key: scheduleEditorDayKey(day), - value: selected, - onChanged: enabled ? (_) => onTap() : null, - ); + final checkbox = Checkbox( + key: scheduleEditorDayKey(day), + value: selected, + onChanged: enabled ? (_) => onTap() : null, + ); final content = Padding( padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4), child: Row( @@ -184,17 +132,11 @@ class _DayToggle extends StatelessWidget { ), ); return MergeSemantics( - child: cupertino - ? GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: enabled ? onTap : null, - child: content, - ) - : InkWell( - borderRadius: BorderRadius.circular(8), - onTap: enabled ? onTap : null, - child: content, - ), + child: InkWell( + borderRadius: BorderRadius.circular(8), + onTap: enabled ? onTap : null, + child: content, + ), ); } } diff --git a/app/lib/features/schedules/ui/list/schedule_list_row.dart b/app/lib/features/schedules/ui/list/schedule_list_row.dart index 1ded49e5..11e9bb49 100644 --- a/app/lib/features/schedules/ui/list/schedule_list_row.dart +++ b/app/lib/features/schedules/ui/list/schedule_list_row.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../ui/layout/app_list_avatar.dart'; @@ -27,10 +26,10 @@ class ScheduleListRow extends StatelessWidget { @override Widget build(BuildContext context) { return AppListRow( - cupertino: cupertino, + cupertino: false, divider: divider, onTap: onOpen, - leading: ScheduleAvatar(schedule: schedule, cupertino: cupertino), + leading: ScheduleAvatar(schedule: schedule, cupertino: false), title: Text(scheduleDisplayName(schedule)), time: scheduleNextDueShort(schedule), subtitle: Text( @@ -56,17 +55,13 @@ class ScheduleAvatar extends StatelessWidget { @override Widget build(BuildContext context) { - final Color? enabled = schedule.enabled - ? (cupertino - ? CupertinoColors.systemGreen.resolveFrom(context) - : Colors.green.shade700) - : null; + final Color? enabled = schedule.enabled ? Colors.green.shade700 : null; return Semantics( label: scheduleStatusLabel(schedule), child: ExcludeSemantics( child: AppListAvatar( foreground: enabled, - child: Icon(cupertino ? CupertinoIcons.clock : Icons.schedule), + child: const Icon(Icons.schedule), ), ), ); diff --git a/app/lib/features/schedules/ui/list/schedule_list_toolbar.dart b/app/lib/features/schedules/ui/list/schedule_list_toolbar.dart index 78a52283..d22a6eb5 100644 --- a/app/lib/features/schedules/ui/list/schedule_list_toolbar.dart +++ b/app/lib/features/schedules/ui/list/schedule_list_toolbar.dart @@ -30,7 +30,7 @@ class ScheduleRefreshAction extends StatelessWidget { @override Widget build(BuildContext context) => BarIconButton( key: controller.isLoading ? null : scheduleRefreshKey, - cupertino: cupertino, + cupertino: false, icon: Icons.refresh, cupertinoIcon: CupertinoIcons.refresh, label: 'Refresh schedules', @@ -69,7 +69,7 @@ class ScheduleListToolbar extends StatelessWidget { final refresh = switch (onRefresh) { final refresh? => ScheduleRefreshAction( controller: controller, - cupertino: cupertino, + cupertino: false, onRefresh: refresh, ), null => null, @@ -119,29 +119,13 @@ class ScheduleListToolbar extends StatelessWidget { Widget _search(BuildContext context) => AppSearchField( fieldKey: scheduleSearchFieldKey, controller: searchController, - cupertino: cupertino, + cupertino: false, placeholder: 'Search schedules', onChanged: controller.setQuery, onCleared: controller.clearQuery, ); Widget _filter(BuildContext context) { - if (cupertino) { - return CupertinoSlidingSegmentedControl( - key: scheduleFilterKey, - groupValue: controller.filter, - onValueChanged: (value) { - if (value != null) controller.setFilter(value); - }, - children: { - for (final filter in ScheduleListFilter.values) - filter: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6), - child: Text(filter.label), - ), - }, - ); - } return SegmentedButton( key: scheduleFilterKey, segments: [ @@ -159,12 +143,8 @@ class ScheduleListToolbar extends StatelessWidget { ); } - TextStyle? _metaStyle(BuildContext context) => cupertino - ? CupertinoTheme.of(context).textTheme.textStyle.copyWith( - fontSize: 15, - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ) - : Theme.of(context).textTheme.bodyMedium?.copyWith( - color: Theme.of(context).colorScheme.onSurfaceVariant, - ); + TextStyle? _metaStyle(BuildContext context) => Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant); } diff --git a/app/lib/features/schedules/ui/list/schedule_list_view.dart b/app/lib/features/schedules/ui/list/schedule_list_view.dart index ff376840..fe30ffe3 100644 --- a/app/lib/features/schedules/ui/list/schedule_list_view.dart +++ b/app/lib/features/schedules/ui/list/schedule_list_view.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../ui/adaptive/floating_bar_layout.dart'; @@ -55,13 +54,13 @@ class SchedulesListView extends StatelessWidget { edge: FloatingBarEdge.top, bar: TopGlassStrip( key: scheduleToolbarKey, - cupertino: cupertino, + cupertino: false, maxWidth: kScheduleToolbarMaxWidth, padding: EdgeInsets.zero, child: ScheduleListToolbar( controller: controller, searchController: searchController, - cupertino: cupertino, + cupertino: false, onRefresh: refreshInToolbar ? onRefresh : null, ), ), @@ -118,7 +117,7 @@ class SchedulesListView extends StatelessWidget { 'schedule-row-$index-${schedule.id ?? 'unknown'}', ), schedule: schedule, - cupertino: cupertino, + cupertino: false, divider: index < schedules.length - 1, onOpen: () => onOpen(schedule), ), @@ -136,9 +135,7 @@ class SchedulesListView extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - cupertino - ? const CupertinoActivityIndicator() - : const CircularProgressIndicator(), + const CircularProgressIndicator(), const SizedBox(height: 12), const Text('Loading schedules…'), ], @@ -161,9 +158,7 @@ class SchedulesListView extends StatelessWidget { detail, textAlign: TextAlign.center, style: TextStyle( - color: cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ), @@ -204,9 +199,7 @@ class SchedulesListView extends StatelessWidget { } Widget _failureText(BuildContext context, ScheduleListFailure failure) { - final color = cupertino - ? CupertinoColors.systemRed.resolveFrom(context) - : Theme.of(context).colorScheme.error; + final color = Theme.of(context).colorScheme.error; return Semantics( liveRegion: true, child: Text( @@ -218,14 +211,6 @@ class SchedulesListView extends StatelessWidget { } Widget _retryButton() { - if (cupertino) { - return CupertinoButton( - key: scheduleRetryKey, - padding: EdgeInsets.zero, - onPressed: onRefresh, - child: const Text('Retry'), - ); - } return TextButton( key: scheduleRetryKey, onPressed: onRefresh, diff --git a/app/lib/features/schedules/ui/pipeline/schedule_delete_dialog.dart b/app/lib/features/schedules/ui/pipeline/schedule_delete_dialog.dart index 0a6f1caf..af0a98b8 100644 --- a/app/lib/features/schedules/ui/pipeline/schedule_delete_dialog.dart +++ b/app/lib/features/schedules/ui/pipeline/schedule_delete_dialog.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../../ui/adaptive/host.dart'; import 'schedule_pipeline_wording.dart'; /// Deletes the exact schedule revision. Returns null once the server accepted @@ -18,13 +16,6 @@ Future showScheduleDeleteDialog({ required ScheduleDeleteSubmit onSubmit, }) { final prompt = _ScheduleDeletePrompt(name: name, onSubmit: onSubmit); - if (usesCupertinoHost(context)) { - return showCupertinoDialog( - context: context, - barrierDismissible: false, - builder: (_) => prompt, - ); - } return showDialog( context: context, barrierDismissible: false, @@ -70,10 +61,7 @@ class _ScheduleDeletePromptState extends State<_ScheduleDeletePrompt> { @override Widget build(BuildContext context) { - final dialog = usesCupertinoHost(context) - ? _cupertino(context) - : _material(context); - return PopScope(canPop: !_sending, child: dialog); + return PopScope(canPop: !_sending, child: _material(context)); } Widget _material(BuildContext context) { @@ -98,30 +86,6 @@ class _ScheduleDeletePromptState extends State<_ScheduleDeletePrompt> { ); } - Widget _cupertino(BuildContext context) { - return CupertinoAlertDialog( - title: Text(scheduleDeleteTitle(widget.name)), - content: _body( - errorStyle: TextStyle( - color: CupertinoColors.systemRed.resolveFrom(context), - ), - ), - actions: [ - CupertinoDialogAction( - key: scheduleDeleteKeepKey, - onPressed: _sending ? null : _keep, - child: const Text(scheduleDeleteKeepLabel), - ), - CupertinoDialogAction( - key: scheduleDeleteConfirmKey, - isDestructiveAction: true, - onPressed: _sending ? null : _confirm, - child: const Text(scheduleDeleteConfirmLabel), - ), - ], - ); - } - Widget _body({required TextStyle errorStyle}) { return Column( mainAxisSize: MainAxisSize.min, diff --git a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_editor.dart b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_editor.dart index d89ada8e..babf467b 100644 --- a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_editor.dart +++ b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_editor.dart @@ -1,11 +1,9 @@ import '../../../../ui/adaptive/segmented_bar.dart'; import 'dart:math'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../core/api_gateway.dart'; -import '../../../../ui/adaptive/host.dart'; import '../../domain/editor/schedule_draft.dart'; import '../editor/schedule_editor_form.dart'; import '../editor/schedule_editor_wording.dart'; @@ -40,22 +38,14 @@ Future openSchedulePipelineEditor( final title = draft.source == null ? scheduleEditorAddTitle : scheduleEditorEditTitle; - final route = usesCupertinoHost(context) - ? CupertinoPageRoute( - settings: settings, - builder: (_) => CupertinoPageScaffold( - navigationBar: SegmentedBar(cupertino: true, title: title), - child: SafeArea(child: page), - ), - ) - : MaterialPageRoute( - settings: settings, - builder: (_) => Scaffold( - extendBodyBehindAppBar: true, - appBar: SegmentedBar(cupertino: false, title: title), - body: SafeArea(child: page), - ), - ); + final route = MaterialPageRoute( + settings: settings, + builder: (_) => Scaffold( + extendBodyBehindAppBar: true, + appBar: SegmentedBar(cupertino: false, title: title), + body: SafeArea(child: page), + ), + ); return Navigator.of(context).push(route); } diff --git a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_list_body.dart b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_list_body.dart index ceef4665..4dd08785 100644 --- a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_list_body.dart +++ b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_list_body.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../../ui/adaptive/host.dart'; import '../../../../ui/layout/section_heading.dart'; import '../../domain/saved_schedule.dart'; import '../list/schedule_list_controller.dart'; @@ -83,24 +81,12 @@ class SchedulePipelineListBody extends StatelessWidget { /// the section reloads after every accepted change and offers Retry when a /// load fails. Widget _header(BuildContext context) { - final cupertino = usesCupertinoHost(context); - final add = cupertino - ? CupertinoButton( - key: scheduleAddKey, - padding: EdgeInsets.zero, - minimumSize: const Size.square(44), - onPressed: onAdd, - child: const Icon( - CupertinoIcons.add, - semanticLabel: scheduleAddLabel, - ), - ) - : IconButton( - key: scheduleAddKey, - tooltip: scheduleAddLabel, - onPressed: onAdd, - icon: const Icon(Icons.add), - ); + final add = IconButton( + key: scheduleAddKey, + tooltip: scheduleAddLabel, + onPressed: onAdd, + icon: const Icon(Icons.add), + ); return SectionHeading( title: controller.hasLoaded && controller.failure == null ? '$scheduleSectionTitle (${controller.schedules.length})' diff --git a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_row.dart b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_row.dart index 5ba772f1..db7a78af 100644 --- a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_row.dart +++ b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_row.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; -import '../../../../ui/adaptive/host.dart'; import '../../../../ui/layout/app_list_row.dart'; import '../../../../ui/layout/app_overflow_menu.dart'; import '../../domain/saved_schedule.dart'; @@ -39,12 +38,11 @@ class SchedulePipelineRow extends StatelessWidget { @override Widget build(BuildContext context) { final id = schedule.id; - final cupertino = usesCupertinoHost(context); final row = AppListRow( - cupertino: cupertino, + cupertino: false, divider: divider && error == null, onTap: busy ? null : onEdit, - leading: ScheduleAvatar(schedule: schedule, cupertino: cupertino), + leading: ScheduleAvatar(schedule: schedule, cupertino: false), title: Text(scheduleDisplayName(schedule)), time: scheduleNextDueShort(schedule), subtitle: Text( diff --git a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_styles.dart b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_styles.dart index c0b4a12a..6dd26fcd 100644 --- a/app/lib/features/schedules/ui/pipeline/schedule_pipeline_styles.dart +++ b/app/lib/features/schedules/ui/pipeline/schedule_pipeline_styles.dart @@ -1,21 +1,11 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../../ui/adaptive/host.dart'; - -/// Host text roles and standard buttons for the pipeline schedule section. +/// Material text roles and standard buttons for the pipeline schedule section. /// No palette, font family or explicit point size is introduced. TextStyle? schedulePipelineHeadingStyle(BuildContext context) => - usesCupertinoHost(context) - ? CupertinoTheme.of(context).textTheme.navTitleTextStyle - : Theme.of(context).textTheme.titleMedium; + Theme.of(context).textTheme.titleMedium; TextStyle? schedulePipelineMutedStyle(BuildContext context) { - if (usesCupertinoHost(context)) { - return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - } final theme = Theme.of(context); return theme.textTheme.bodySmall?.copyWith( color: theme.colorScheme.onSurfaceVariant, @@ -25,32 +15,18 @@ TextStyle? schedulePipelineMutedStyle(BuildContext context) { TextStyle? schedulePipelineStatusStyle(BuildContext context, bool enabled) { final base = schedulePipelineMutedStyle(context); if (!enabled) return base; - return usesCupertinoHost(context) - ? base?.copyWith(color: CupertinoTheme.of(context).primaryColor) - : base?.copyWith(color: Theme.of(context).colorScheme.primary); + return base?.copyWith(color: Theme.of(context).colorScheme.primary); } TextStyle? schedulePipelineErrorStyle(BuildContext context) => - usesCupertinoHost(context) - ? CupertinoTheme.of(context).textTheme.textStyle.copyWith( - color: CupertinoColors.systemRed.resolveFrom(context), - ) - : TextStyle(color: Theme.of(context).colorScheme.error); + TextStyle(color: Theme.of(context).colorScheme.error); -/// A standard platform text action. +/// A standard text action. Widget schedulePipelineTextButton( BuildContext context, { required String label, required VoidCallback? onPressed, Key? key, }) { - if (usesCupertinoHost(context)) { - return CupertinoButton( - key: key, - padding: EdgeInsets.zero, - onPressed: onPressed, - child: Text(label), - ); - } return TextButton(key: key, onPressed: onPressed, child: Text(label)); } diff --git a/app/lib/features/schedules/ui/run/schedule_run_action.dart b/app/lib/features/schedules/ui/run/schedule_run_action.dart index 3fa6030a..6c68eb83 100644 --- a/app/lib/features/schedules/ui/run/schedule_run_action.dart +++ b/app/lib/features/schedules/ui/run/schedule_run_action.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../core/api_gateway.dart'; -import '../../../../ui/adaptive/host.dart'; import '../../data/schedules_repository.dart'; import '../../domain/editor/schedule_draft.dart'; import '../../domain/schedule_json.dart'; @@ -84,19 +82,11 @@ class _ScheduleRunActionState extends State { @override Widget build(BuildContext context) { if (!canScheduleRun(widget.run)) return const SizedBox.shrink(); - final cupertino = usesCupertinoHost(context); - final action = cupertino - ? CupertinoButton.tinted( - sizeStyle: CupertinoButtonSize.small, - key: scheduleRunActionKey, - onPressed: _open, - child: const Text(scheduleRunActionLabel), - ) - : OutlinedButton( - key: scheduleRunActionKey, - onPressed: _open, - child: const Text(scheduleRunActionLabel), - ); + final action = OutlinedButton( + key: scheduleRunActionKey, + onPressed: _open, + child: const Text(scheduleRunActionLabel), + ); return Tooltip(message: scheduleRunActionHint, child: action); } } diff --git a/app/test/features/schedules/ui/editor/schedule_editor_harness.dart b/app/test/features/schedules/ui/editor/schedule_editor_harness.dart index 71052bc0..f298149b 100644 --- a/app/test/features/schedules/ui/editor/schedule_editor_harness.dart +++ b/app/test/features/schedules/ui/editor/schedule_editor_harness.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -31,7 +30,6 @@ Future pumpScheduleEditor( WidgetTester tester, { required ScheduleDraft draft, required Future Function(JsonMap record) onSubmit, - bool cupertino = false, bool dark = false, double width = 390, double height = 1600, @@ -57,21 +55,11 @@ Future pumpScheduleEditor( child: app!, ); await tester.pumpWidget( - cupertino - ? CupertinoApp( - theme: CupertinoThemeData( - brightness: dark ? Brightness.dark : Brightness.light, - ), - builder: scaled, - home: CupertinoPageScaffold(child: SafeArea(child: form)), - ) - : MaterialApp( - theme: ThemeData( - brightness: dark ? Brightness.dark : Brightness.light, - ), - builder: scaled, - home: Scaffold(body: SafeArea(child: form)), - ), + MaterialApp( + theme: ThemeData(brightness: dark ? Brightness.dark : Brightness.light), + builder: scaled, + home: Scaffold(body: SafeArea(child: form)), + ), ); await tester.pumpAndSettle(); } diff --git a/app/test/features/schedules/ui/editor/schedule_editor_interaction_test.dart b/app/test/features/schedules/ui/editor/schedule_editor_interaction_test.dart index e56e65f5..b9271aed 100644 --- a/app/test/features/schedules/ui/editor/schedule_editor_interaction_test.dart +++ b/app/test/features/schedules/ui/editor/schedule_editor_interaction_test.dart @@ -1,10 +1,8 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; -import 'package:pipelines_app/features/schedules/ui/editor/schedule_editor_selectors.dart'; import 'package:pipelines_app/features/schedules/ui/editor/schedule_editor_wording.dart'; import 'schedule_editor_harness.dart'; @@ -101,49 +99,6 @@ void main() { ); }); - testWidgets('Cupertino form uses native fields and action sheets', ( - tester, - ) async { - final calls = []; - await pumpScheduleEditor( - tester, - cupertino: true, - draft: createDraft(name: 'Cupertino schedule', prompt: 'Native fields'), - onSubmit: (record) async => calls.add(record), - ); - expect(find.byType(CupertinoTextField), findsNWidgets(6)); - expect(find.byType(TextField), findsNothing); - expect(find.byType(CupertinoSwitch), findsOneWidget); - expect(find.byType(Switch), findsNothing); - expect(find.byType(CupertinoCheckbox), findsNWidgets(7)); - expect(find.byType(Checkbox), findsNothing); - - await tester.tap(find.byKey(scheduleEditorTimerKey)); - await tester.pumpAndSettle(); - await tester.tap(find.text('Clock times').last); - await tester.pumpAndSettle(); - await enterField(tester, scheduleEditorTimesKey, '06:30'); - await tester.tap(find.byKey(scheduleEditorDayKey('mon'))); - await tester.pump(); - expect( - tester - .widget(find.byKey(scheduleEditorDayKey('mon'))) - .value, - isTrue, - ); - await tester.tap(find.byKey(scheduleEditorEnabledKey)); - await tester.pump(); - await tester.tap(find.byKey(scheduleEditorSubmitKey)); - await tester.pumpAndSettle(); - - expect(calls.single['enabled'], isFalse); - expect(calls.single['rule'], { - 'times': ['06:30'], - 'days': ['mon'], - 'timezone': 'Europe/London', - }); - }); - testWidgets('Cancel calls the injected callback and sends nothing', ( tester, ) async { diff --git a/app/test/features/schedules/ui/editor/schedule_editor_layout_test.dart b/app/test/features/schedules/ui/editor/schedule_editor_layout_test.dart index 55613296..9debcdbc 100644 --- a/app/test/features/schedules/ui/editor/schedule_editor_layout_test.dart +++ b/app/test/features/schedules/ui/editor/schedule_editor_layout_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -44,37 +43,4 @@ void main() { ); expect(note.size.width, lessThanOrEqualTo(320 - 32)); }); - - testWidgets('Cupertino dark uses native controls and the native palette', ( - tester, - ) async { - await pumpScheduleEditor( - tester, - cupertino: true, - dark: true, - width: 320, - height: 1800, - textScale: 2, - draft: createDraft(), - onSubmit: (JsonMap record) async {}, - ); - expect(tester.takeException(), isNull); - for (final label in _labels) { - expect(find.text(label), findsOneWidget, reason: label); - } - expect(find.byType(CupertinoTextField), findsNWidgets(6)); - expect(find.byType(CupertinoSwitch), findsOneWidget); - expect(find.byType(CupertinoCheckbox), findsNWidgets(7)); - expect(find.byType(Material), findsNothing); - expect(find.byType(TextField), findsNothing); - expect(find.byType(Switch), findsNothing); - expect(find.byType(Checkbox), findsNothing); - - final context = tester.element(find.byKey(scheduleEditorNameKey)); - expect(CupertinoTheme.of(context).brightness, Brightness.dark); - expect( - CupertinoColors.label.resolveFrom(context).toARGB32(), - CupertinoColors.label.darkColor.toARGB32(), - ); - }); } diff --git a/app/test/features/schedules/ui/list/schedule_list_test_support.dart b/app/test/features/schedules/ui/list/schedule_list_test_support.dart index 394f5d53..78cd7aaa 100644 --- a/app/test/features/schedules/ui/list/schedule_list_test_support.dart +++ b/app/test/features/schedules/ui/list/schedule_list_test_support.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -119,23 +118,13 @@ List longScheduleList(int count) => [ ), ]; -Widget schedulesApp( - Widget child, { - required bool cupertino, - double textScale = 1, -}) { +Widget schedulesApp(Widget child, {double textScale = 1}) { Widget media(BuildContext context, Widget? app) => MediaQuery( data: MediaQuery.of( context, ).copyWith(textScaler: TextScaler.linear(textScale)), child: app!, ); - if (cupertino) { - return CupertinoApp( - builder: media, - home: CupertinoPageScaffold(child: SafeArea(child: child)), - ); - } return MaterialApp( builder: media, home: Scaffold(body: child), diff --git a/app/test/features/schedules/ui/list/schedule_screen_harness.dart b/app/test/features/schedules/ui/list/schedule_screen_harness.dart index 963078f3..dd22f32f 100644 --- a/app/test/features/schedules/ui/list/schedule_screen_harness.dart +++ b/app/test/features/schedules/ui/list/schedule_screen_harness.dart @@ -8,7 +8,6 @@ import 'schedule_list_test_support.dart'; Future pumpSchedules( WidgetTester tester, { - required bool cupertino, required ApiGateway gateway, ValueChanged? onOpen, double textScale = 1, @@ -22,7 +21,6 @@ Future pumpSchedules( await tester.pumpWidget( schedulesApp( SchedulesScreen(gateway: gateway, onOpen: onOpen ?? (_) {}), - cupertino: cupertino, textScale: textScale, ), ); diff --git a/app/test/features/schedules/ui/list/schedules_layout_test.dart b/app/test/features/schedules/ui/list/schedules_layout_test.dart index c4ebbe2b..34813bc0 100644 --- a/app/test/features/schedules/ui/list/schedules_layout_test.dart +++ b/app/test/features/schedules/ui/list/schedules_layout_test.dart @@ -17,12 +17,7 @@ void main() { pausedRecord(), ]), ); - await pumpSchedules( - tester, - cupertino: false, - gateway: gateway, - textScale: textScale, - ); + await pumpSchedules(tester, gateway: gateway, textScale: textScale); expect(find.text('2 schedules'), findsOneWidget); // The strip carries the count only; the helper line lives in the @@ -51,10 +46,7 @@ void main() { expect(find.text('Paused'), findsOneWidget); expect(find.byKey(scheduleSearchFieldKey), findsOneWidget); - expect( - find.byType(SegmentedButton), - findsOneWidget, - ); + expect(find.byType(SegmentedButton), findsOneWidget); expect(find.byType(TextField), findsOneWidget); expect(tester.takeException(), isNull); }); diff --git a/app/test/features/schedules/ui/list/schedules_refresh_test.dart b/app/test/features/schedules/ui/list/schedules_refresh_test.dart index ffaea372..b0402c7b 100644 --- a/app/test/features/schedules/ui/list/schedules_refresh_test.dart +++ b/app/test/features/schedules/ui/list/schedules_refresh_test.dart @@ -14,7 +14,7 @@ void main() { (type, fields) async => schedulesReply([scheduleRecord(), pausedRecord()]), ); - await pumpSchedules(tester, cupertino: false, gateway: gateway); + await pumpSchedules(tester, gateway: gateway); await tester.enterText( find.byKey(scheduleSearchFieldKey), @@ -42,7 +42,7 @@ void main() { final gateway = FakeSchedulesGateway( (type, fields) async => schedulesReply(longScheduleList(30)), ); - await pumpSchedules(tester, cupertino: false, gateway: gateway); + await pumpSchedules(tester, gateway: gateway); final list = find.byKey(scheduleListKey); await tester.drag(list, const Offset(0, -700)); @@ -66,7 +66,7 @@ void main() { if (fail) throw StateError('refresh failed'); return schedulesReply(longScheduleList(30)); }); - await pumpSchedules(tester, cupertino: false, gateway: gateway); + await pumpSchedules(tester, gateway: gateway); final list = find.byKey(scheduleListKey); await tester.drag(list, const Offset(0, -700)); @@ -104,7 +104,7 @@ void main() { if (fail) throw StateError('refresh failed'); return schedulesReply([scheduleRecord(), pausedRecord()]); }); - await pumpSchedules(tester, cupertino: false, gateway: gateway); + await pumpSchedules(tester, gateway: gateway); fail = true; await tester.tap(find.byKey(scheduleRefreshKey)); diff --git a/app/test/features/schedules/ui/list/schedules_screen_test.dart b/app/test/features/schedules/ui/list/schedules_screen_test.dart index 96333462..dad741b1 100644 --- a/app/test/features/schedules/ui/list/schedules_screen_test.dart +++ b/app/test/features/schedules/ui/list/schedules_screen_test.dart @@ -14,7 +14,7 @@ void main() { (type, fields) async => schedulesReply([scheduleRecord(), pausedRecord()]), ); - await pumpSchedules(tester, cupertino: false, gateway: gateway); + await pumpSchedules(tester, gateway: gateway); await tester.enterText(find.byKey(scheduleSearchFieldKey), 'pipeline 7'); await tester.pump(); @@ -41,7 +41,7 @@ void main() { (type, fields) async => schedulesReply([scheduleRecord(), pausedRecord()]), ); - await pumpSchedules(tester, cupertino: false, gateway: gateway); + await pumpSchedules(tester, gateway: gateway); await tester.tap( find.descendant( @@ -65,12 +65,7 @@ void main() { (type, fields) async => schedulesReply([record]), ); final opened = []; - await pumpSchedules( - tester, - cupertino: false, - gateway: gateway, - onOpen: opened.add, - ); + await pumpSchedules(tester, gateway: gateway, onOpen: opened.add); expect(opened, isEmpty); expect(find.text('Add schedule'), findsNothing); @@ -92,14 +87,14 @@ void main() { final empty = FakeSchedulesGateway( (type, fields) async => {'type': 'schedules'}, ); - await pumpSchedules(tester, cupertino: false, gateway: empty); + await pumpSchedules(tester, gateway: empty); expect(find.text('No schedules yet.'), findsOneWidget); expect(find.byKey(scheduleRetryKey), findsNothing); final unsupported = FakeSchedulesGateway( (type, fields) async => {'type': 'runs'}, ); - await pumpSchedules(tester, cupertino: false, gateway: unsupported); + await pumpSchedules(tester, gateway: unsupported); expect( find.textContaining('does not support saved schedules'), findsOneWidget, @@ -110,7 +105,7 @@ void main() { final failed = FakeSchedulesGateway( (type, fields) async => throw StateError('socket closed'), ); - await pumpSchedules(tester, cupertino: false, gateway: failed); + await pumpSchedules(tester, gateway: failed); expect(find.textContaining('socket closed'), findsOneWidget); expect(find.byKey(scheduleRetryKey), findsOneWidget); expect(tester.takeException(), isNull); @@ -122,7 +117,7 @@ void main() { final gateway = FakeSchedulesGateway( (type, fields) async => schedulesReply([pausedRecord()]), ); - await pumpSchedules(tester, cupertino: false, gateway: gateway); + await pumpSchedules(tester, gateway: gateway); await tester.tap( find.descendant( @@ -147,12 +142,7 @@ void main() { tester, ) async { final gateway = ControlledSchedulesGateway(); - await pumpSchedules( - tester, - cupertino: false, - gateway: gateway, - settle: false, - ); + await pumpSchedules(tester, gateway: gateway, settle: false); expect(find.byKey(scheduleRefreshKey), findsNothing); await tester.pumpWidget(const SizedBox.shrink()); diff --git a/app/test/features/schedules/ui/list/schedules_wide_test.dart b/app/test/features/schedules/ui/list/schedules_wide_test.dart index b88b83cd..14cd2e21 100644 --- a/app/test/features/schedules/ui/list/schedules_wide_test.dart +++ b/app/test/features/schedules/ui/list/schedules_wide_test.dart @@ -14,7 +14,6 @@ void main() { 'row', (tester) async { await pumpSchedules( tester, - cupertino: false, size: const Size(1200, 800), gateway: FakeSchedulesGateway( (type, fields) async => schedulesReply([ diff --git a/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart b/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart index adb8fdf6..4f6bb725 100644 --- a/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart +++ b/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart @@ -378,37 +378,31 @@ void main() { expect(find.text('socket closed'), findsNothing); }); - testWidgets('320px at 2x text stays usable on both native hosts', ( - tester, - ) async { - for (final cupertino in [false, true]) { - final gateway = SectionGateway( - (type, fields) async => schedulesReply([ - sectionRecord( - name: 'A very long schedule name that must wrap without overflow', - prompt: - 'A long prompt that also wraps instead of forcing a fixed row ' - 'height or a horizontal scroll.', - ), - ]), - ); - await pumpScheduleSection( - tester, - gateway: gateway, - cupertino: cupertino, - dark: cupertino, - width: 320, - height: 844, - textScale: 2, - ); + testWidgets('320px at 2x text stays usable', (tester) async { + final gateway = SectionGateway( + (type, fields) async => schedulesReply([ + sectionRecord( + name: 'A very long schedule name that must wrap without overflow', + prompt: + 'A long prompt that also wraps instead of forcing a fixed row ' + 'height or a horizontal scroll.', + ), + ]), + ); + await pumpScheduleSection( + tester, + gateway: gateway, + width: 320, + height: 844, + textScale: 2, + ); - expect(tester.takeException(), isNull); - expect(find.byKey(scheduleAddKey), findsOneWidget); - await _openMenu(tester, 8); - expect(find.byKey(scheduleRowEditKey(8)), findsOneWidget); - expect(find.byKey(scheduleRowToggleKey(8)), findsOneWidget); - expect(find.byKey(scheduleRowDeleteKey(8)), findsOneWidget); - expect(tester.takeException(), isNull); - } + expect(tester.takeException(), isNull); + expect(find.byKey(scheduleAddKey), findsOneWidget); + await _openMenu(tester, 8); + expect(find.byKey(scheduleRowEditKey(8)), findsOneWidget); + expect(find.byKey(scheduleRowToggleKey(8)), findsOneWidget); + expect(find.byKey(scheduleRowDeleteKey(8)), findsOneWidget); + expect(tester.takeException(), isNull); }); } diff --git a/app/test/features/schedules/ui/pipeline/schedule_pipeline_test_support.dart b/app/test/features/schedules/ui/pipeline/schedule_pipeline_test_support.dart index 57ab7ffb..bf1ce0e9 100644 --- a/app/test/features/schedules/ui/pipeline/schedule_pipeline_test_support.dart +++ b/app/test/features/schedules/ui/pipeline/schedule_pipeline_test_support.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -83,12 +82,7 @@ JsonMap sectionRecord({ }, }; -Widget sectionApp( - Widget section, { - required bool cupertino, - bool dark = false, - double textScale = 1, -}) { +Widget sectionApp(Widget section, {bool dark = false, double textScale = 1}) { Widget media(BuildContext context, Widget? app) => MediaQuery( data: MediaQuery.of( context, @@ -98,16 +92,6 @@ Widget sectionApp( final body = SafeArea( child: ListView(children: [section, const SizedBox(height: 24)]), ); - if (cupertino) { - return CupertinoApp( - debugShowCheckedModeBanner: false, - theme: CupertinoThemeData( - brightness: dark ? Brightness.dark : Brightness.light, - ), - builder: media, - home: CupertinoPageScaffold(child: body), - ); - } return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData(brightness: dark ? Brightness.dark : Brightness.light), @@ -119,7 +103,6 @@ Widget sectionApp( Future pumpScheduleSection( WidgetTester tester, { required SectionGateway gateway, - bool cupertino = false, bool dark = false, double width = 390, double height = 844, @@ -137,7 +120,7 @@ Future pumpScheduleSection( settingsStore: MemorySettingsStore(workspace: '/srv/research'), ); await tester.pumpWidget( - sectionApp(section, cupertino: cupertino, dark: dark, textScale: textScale), + sectionApp(section, dark: dark, textScale: textScale), ); await tester.pumpAndSettle(); } diff --git a/app/test/features/schedules/ui/run/schedule_run_action_test.dart b/app/test/features/schedules/ui/run/schedule_run_action_test.dart index e99f7211..ae105832 100644 --- a/app/test/features/schedules/ui/run/schedule_run_action_test.dart +++ b/app/test/features/schedules/ui/run/schedule_run_action_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -68,23 +67,15 @@ JsonMap restrictedRunFixture() => { 'output_format': 'json', }; -Future pumpAction( - WidgetTester tester, - Widget child, { - bool cupertino = false, -}) async { +Future pumpAction(WidgetTester tester, Widget child) async { tester.view.physicalSize = const Size(390, 1600); tester.view.devicePixelRatio = 1; addTearDown(tester.view.resetPhysicalSize); addTearDown(tester.view.resetDevicePixelRatio); await tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold(child: SafeArea(child: child)), - ) - : MaterialApp( - home: Scaffold(body: SafeArea(child: child)), - ), + MaterialApp( + home: Scaffold(body: SafeArea(child: child)), + ), ); await tester.pumpAndSettle(); } @@ -225,38 +216,4 @@ void main() { await openMenu(runFixture(pipelineId: null)); expect(find.text(scheduleRunActionLabel), findsNothing); }); - - testWidgets('Cupertino uses the native action and fields', (tester) async { - final gateway = SaveGateway(); - await pumpAction( - tester, - ScheduleRunAction(run: runFixture(), gateway: gateway), - cupertino: true, - ); - - final action = find.byKey(scheduleRunActionKey); - expect( - find.widgetWithText(CupertinoButton, scheduleRunActionLabel), - findsOne, - ); - await tester.tap(action); - await tester.pumpAndSettle(); - - expect(gateway.calls, isEmpty); - expect(find.byKey(scheduleEditorSubmitKey), findsOneWidget); - expect( - tester - .widget(find.byKey(scheduleEditorVersionKey)) - .controller - ?.text, - '5', - ); - expect( - tester - .widget(find.byKey(scheduleEditorWorkspaceKey)) - .controller - ?.text, - '/srv/run-workspace', - ); - }); }