From 4b4628f35cb0e3d6cf6a11dbd315ff2fccc3a4ce Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 11 Nov 2026 16:06:54 +0000 Subject: [PATCH] Remove Cupertino branches from runs UI Keep the public cupertino parameters for compatibility while retaining only the Material rendering paths. Remove Cupertino-only widgets, routes, styling, and tests because the application runs under Material hosts. --- .../runs/ui/run_detail_visit_sections.dart | 48 ++----- .../runs/ui/run_detail_visit_session.dart | 20 +-- .../runs/ui/run_detail_wide_chrome.dart | 2 +- app/lib/features/runs/ui/run_field_body.dart | 15 +- .../features/runs/ui/run_graph_preview.dart | 47 ++---- app/lib/features/runs/ui/run_list_row.dart | 19 ++- app/lib/features/runs/ui/run_more_menu.dart | 2 +- .../features/runs/ui/run_pipeline_link.dart | 25 ++-- .../features/runs/ui/runs_filter_sheet.dart | 50 ++----- app/lib/features/runs/ui/runs_filters.dart | 72 ++-------- app/lib/features/runs/ui/runs_list.dart | 40 +----- .../features/runs/ui/runs_selection_bar.dart | 134 +++++------------- app/lib/features/runs/ui/runs_stats_page.dart | 44 ++---- .../application/runs_destination_test.dart | 27 ---- 14 files changed, 118 insertions(+), 427 deletions(-) diff --git a/app/lib/features/runs/ui/run_detail_visit_sections.dart b/app/lib/features/runs/ui/run_detail_visit_sections.dart index ce0ea888..20ba06cc 100644 --- a/app/lib/features/runs/ui/run_detail_visit_sections.dart +++ b/app/lib/features/runs/ui/run_detail_visit_sections.dart @@ -4,7 +4,6 @@ import 'package:flutter/services.dart'; import '../../../core/api_gateway.dart'; import '../../../ui/adaptive/floating_destination_bar.dart'; -import '../../../ui/adaptive/host.dart'; import '../../changes/changes.dart'; import 'run_detail_tab_bodies.dart'; import 'run_field_body.dart'; @@ -61,19 +60,18 @@ class RunVisitSectionStrip extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final index = shownVisitSections.indexOf(visitTabFor(selected)); return KeyedSubtree( key: const Key('run-visit-tabs'), child: FloatingDestinationBar( - cupertino: cupertino, + cupertino: false, currentIndex: index < 0 ? 0 : index, onTap: (value) => onSelected(shownVisitSections[value]), items: [ for (final section in shownVisitSections) FloatingDestinationItem( key: ValueKey('run-visit-tab-${section.name}'), - icon: Icon(cupertino ? section.cupertinoIcon : section.icon), + icon: Icon(section.icon), label: section.label, ), ], @@ -132,7 +130,6 @@ Widget runVisitSectionBody({ key: ValueKey('run-visit-summary-$visitIndex'), input: step['input'], output: step['output'], - cupertino: cupertino, facts: facts, ); case RunVisitSection.more: @@ -167,14 +164,7 @@ Widget runVisitSectionBody({ showSummary: false, ); // The viewer's own header leads it, so it starts below the bar. - return BelowTopBar( - child: cupertino - ? Builder( - builder: (context) => - Theme(data: hostTextTheme(context), child: viewer), - ) - : viewer, - ); + return BelowTopBar(child: viewer); case RunVisitSection.session: return RunVisitSession( run: run, @@ -193,13 +183,11 @@ class _VisitSummary extends StatefulWidget { super.key, required this.input, required this.output, - required this.cupertino, this.facts, }); final dynamic input; final dynamic output; - final bool cupertino; /// The visit's facts, leading the scroll below the top bar. final Widget? facts; @@ -218,24 +206,12 @@ class _VisitSummaryState extends State<_VisitSummary> { } Widget _section(String name, dynamic value, String empty) { - final copy = widget.cupertino - ? CupertinoButton( - key: ValueKey('run-visit-copy-$name'), - padding: const EdgeInsets.symmetric(horizontal: 8), - onPressed: () => _copy(name, value), - child: Icon( - _copied == name - ? CupertinoIcons.checkmark_alt - : CupertinoIcons.doc_on_doc, - semanticLabel: 'Copy $name', - ), - ) - : IconButton( - key: ValueKey('run-visit-copy-$name'), - tooltip: 'Copy $name', - onPressed: () => _copy(name, value), - icon: Icon(_copied == name ? Icons.check : Icons.copy), - ); + final copy = IconButton( + key: ValueKey('run-visit-copy-$name'), + tooltip: 'Copy $name', + onPressed: () => _copy(name, value), + icon: Icon(_copied == name ? Icons.check : Icons.copy), + ); final open = !_closed.contains(name); return StickySection( key: ValueKey('run-visit-section-$name'), @@ -247,11 +223,7 @@ class _VisitSummaryState extends State<_VisitSummary> { trailing: [copy], body: Padding( padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: RunFieldBody( - value: value, - empty: empty, - cupertino: widget.cupertino, - ), + child: RunFieldBody(value: value, empty: empty, cupertino: false), ), ); } diff --git a/app/lib/features/runs/ui/run_detail_visit_session.dart b/app/lib/features/runs/ui/run_detail_visit_session.dart index 632666e1..b70e9c8d 100644 --- a/app/lib/features/runs/ui/run_detail_visit_session.dart +++ b/app/lib/features/runs/ui/run_detail_visit_session.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 '../../artifacts/domain/artifact_record.dart'; import '../../artifacts/domain/artifact_url.dart'; import '../../artifacts/ui/artifact_external_open.dart'; @@ -123,13 +121,6 @@ class _RunVisitSessionState extends State { Widget _openButton(ArtifactRecord export, ResolvedArtifactUrl resolved) { final label = 'Open ${export.name.isEmpty ? 'session.html' : export.name}'; - if (usesCupertinoHost(context)) { - return CupertinoButton( - padding: EdgeInsets.zero, - onPressed: () => _open(resolved), - child: Text(label), - ); - } return Align( alignment: AlignmentDirectional.centerStart, child: TextButton(onPressed: () => _open(resolved), child: Text(label)), @@ -211,19 +202,14 @@ class _SessionFact extends StatelessWidget { @override Widget build(BuildContext context) { final theme = Theme.of(context); - final cupertino = CupertinoTheme.of(context); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( label, - style: usesCupertinoHost(context) - ? cupertino.textTheme.tabLabelTextStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ) - : (theme.textTheme.labelMedium ?? const TextStyle()).copyWith( - color: theme.colorScheme.onSurfaceVariant, - ), + style: (theme.textTheme.labelMedium ?? const TextStyle()).copyWith( + color: theme.colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 2), Text(value), diff --git a/app/lib/features/runs/ui/run_detail_wide_chrome.dart b/app/lib/features/runs/ui/run_detail_wide_chrome.dart index abc1c5da..4b66d2ff 100644 --- a/app/lib/features/runs/ui/run_detail_wide_chrome.dart +++ b/app/lib/features/runs/ui/run_detail_wide_chrome.dart @@ -66,7 +66,7 @@ class RunDetailWideChrome extends StatelessWidget { heightFactor: 1, child: GlassPill( key: const Key('run-detail-header'), - cupertino: cupertino, + cupertino: false, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(kTopGlassStripRadius), ), diff --git a/app/lib/features/runs/ui/run_field_body.dart b/app/lib/features/runs/ui/run_field_body.dart index a948bae9..897c7b6d 100644 --- a/app/lib/features/runs/ui/run_field_body.dart +++ b/app/lib/features/runs/ui/run_field_body.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../chat/ui/transcript/chat_markdown_view.dart'; @@ -63,16 +62,10 @@ class RunFieldBody extends StatelessWidget { if (map.length == 1 && map.keys.single.toLowerCase() == 'markdown') { return _value(runFieldText(map.values.single)); } - final caption = - (cupertino - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.labelMedium) - ?.copyWith( - fontWeight: FontWeight.w600, - color: cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, - ); + final caption = Theme.of(context).textTheme.labelMedium?.copyWith( + fontWeight: FontWeight.w600, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/app/lib/features/runs/ui/run_graph_preview.dart b/app/lib/features/runs/ui/run_graph_preview.dart index ac271f6d..7fc92cea 100644 --- a/app/lib/features/runs/ui/run_graph_preview.dart +++ b/app/lib/features/runs/ui/run_graph_preview.dart @@ -1,9 +1,7 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/segmented_bar.dart'; import '../../../core/api_gateway.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; import '../../graph/domain/graph_definition.dart'; import '../../graph/widgets/run_graph_view.dart'; @@ -34,7 +32,6 @@ class RunGraphPreview extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); // No graph to draw: one muted line, with no frame and nothing to open. if (graphNodes(graph).isEmpty) { return Padding( @@ -42,30 +39,24 @@ class RunGraphPreview extends StatelessWidget { padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), child: Text( runGraphMissing, - style: cupertino - ? CupertinoTheme.of(context).textTheme.textStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ) - : Theme.of(context).textTheme.bodyMedium?.copyWith( - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ); } - final border = cupertino - ? CupertinoColors.separator.resolveFrom(context) - : Theme.of(context).colorScheme.outlineVariant; + final border = Theme.of(context).colorScheme.outlineVariant; return Padding( padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), child: Semantics( button: true, label: 'Run graph, open full screen', excludeSemantics: true, - onTap: () => _open(context, cupertino), + onTap: () => _open(context), child: GestureDetector( key: runGraphPreviewKey, behavior: HitTestBehavior.opaque, - onTap: () => _open(context, cupertino), + onTap: () => _open(context), child: DecoratedBox( decoration: BoxDecoration( border: Border.all(color: border), @@ -100,7 +91,7 @@ class RunGraphPreview extends StatelessWidget { ); } - Future _open(BuildContext context, bool cupertino) { + Future _open(BuildContext context) { Widget graphView(BuildContext pageContext) => RunGraphView( key: const Key('run-detail-graph'), // Already full screen: no maximise button to open it again. @@ -114,23 +105,13 @@ class RunGraphPreview extends StatelessWidget { }, ); return Navigator.of(context).push( - cupertino - ? CupertinoPageRoute( - builder: (page) => CupertinoPageScaffold( - navigationBar: const SegmentedBar( - cupertino: true, - title: 'Graph', - ), - child: BelowTopBar(child: graphView(page)), - ), - ) - : MaterialPageRoute( - builder: (page) => Scaffold( - extendBodyBehindAppBar: true, - appBar: const SegmentedBar(cupertino: false, title: 'Graph'), - body: BelowTopBar(child: graphView(page)), - ), - ), + MaterialPageRoute( + builder: (page) => Scaffold( + extendBodyBehindAppBar: true, + appBar: const SegmentedBar(cupertino: false, title: 'Graph'), + body: BelowTopBar(child: graphView(page)), + ), + ), ); } } diff --git a/app/lib/features/runs/ui/run_list_row.dart b/app/lib/features/runs/ui/run_list_row.dart index 0afe556e..8420209e 100644 --- a/app/lib/features/runs/ui/run_list_row.dart +++ b/app/lib/features/runs/ui/run_list_row.dart @@ -1,9 +1,7 @@ import '../../../core/servers/server_context.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/layout/app_list_avatar.dart'; import '../../../ui/layout/app_list_row.dart'; import '../../../ui/status/run_status_icon.dart'; @@ -61,7 +59,6 @@ class RunListRow extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final identity = runIdentity(run['title'], run['name']); final id = run['id']; final title = identity.label.isEmpty ? 'Run $id' : identity.label; @@ -122,12 +119,12 @@ class RunListRow extends StatelessWidget { final state = runStateOf(run['status']); return AppListRow( key: ValueKey('run-row-$id'), - cupertino: cupertino, + cupertino: false, selected: selected, divider: divider, onTap: selecting ? (runIsDeletable(run) ? onToggle : null) : onTap, onLongPress: selecting ? null : onLongPress, - selectionControl: selecting ? _checkbox(context, cupertino) : null, + selectionControl: selecting ? _checkbox(context) : null, leading: AppListAvatar( foreground: runStatusColor(state).resolveFrom(context), child: RunStatusIcon(state: state, label: runStatusLabel(run)), @@ -151,25 +148,25 @@ class RunListRow extends StatelessWidget { onRunChanged: onRunChanged!, onRunOpened: onRunOpened, onDeleted: onDeleted, - cupertino: cupertino, + cupertino: false, menuKey: ValueKey('run-list-more-menu-$id'), ) : null, ); } - Widget _checkbox(BuildContext context, bool cupertino) { + Widget _checkbox(BuildContext context) { final id = run['id']; final enabled = runIsDeletable(run); final title = runIdentity(run['title'], run['name']).label; final name = title.isEmpty ? 'run $id' : title; final changed = enabled ? (_) => onToggle?.call() : null; - final box = cupertino - ? CupertinoCheckbox(value: checked, onChanged: changed) - : Checkbox(value: checked, onChanged: changed); return Semantics( label: enabled ? 'Select $name' : 'Select $name. $runDeleteBlockedReason', - child: KeyedSubtree(key: ValueKey('run-select-$id'), child: box), + child: KeyedSubtree( + key: ValueKey('run-select-$id'), + child: Checkbox(value: checked, onChanged: changed), + ), ); } } diff --git a/app/lib/features/runs/ui/run_more_menu.dart b/app/lib/features/runs/ui/run_more_menu.dart index a9b23a44..81788d35 100644 --- a/app/lib/features/runs/ui/run_more_menu.dart +++ b/app/lib/features/runs/ui/run_more_menu.dart @@ -118,7 +118,7 @@ class _RunMoreMenuState extends State { runs: [run], gateway: widget.gateway, onDeleted: widget.onDeleted!, - cupertino: widget.cupertino, + cupertino: false, ); } } diff --git a/app/lib/features/runs/ui/run_pipeline_link.dart b/app/lib/features/runs/ui/run_pipeline_link.dart index 2dd8539b..fde5befd 100644 --- a/app/lib/features/runs/ui/run_pipeline_link.dart +++ b/app/lib/features/runs/ui/run_pipeline_link.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; @@ -45,22 +44,14 @@ class RunPipelineLink extends StatelessWidget { link: true, label: 'Open pipeline $name', excludeSemantics: true, - child: cupertino - ? CupertinoButton( - key: runPipelineLinkKey, - padding: EdgeInsets.zero, - minimumSize: Size.zero, - onPressed: go, - child: label, - ) - : InkWell( - key: runPipelineLinkKey, - onTap: go, - child: DefaultTextStyle.merge( - style: TextStyle(color: Theme.of(context).colorScheme.primary), - child: label, - ), - ), + child: InkWell( + key: runPipelineLinkKey, + onTap: go, + child: DefaultTextStyle.merge( + style: TextStyle(color: Theme.of(context).colorScheme.primary), + child: label, + ), + ), ); } } diff --git a/app/lib/features/runs/ui/runs_filter_sheet.dart b/app/lib/features/runs/ui/runs_filter_sheet.dart index 89cfb075..e1d517cd 100644 --- a/app/lib/features/runs/ui/runs_filter_sheet.dart +++ b/app/lib/features/runs/ui/runs_filter_sheet.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/input/app_search_field.dart'; import '../../../ui/layout/app_sheet_header.dart'; import '../../pipelines/pipeline_format.dart' show runStateLabel; @@ -20,28 +18,19 @@ Future showRunsFilterSheet( BuildContext context, RunsController controller, ) { - final cupertino = usesCupertinoHost(context); - final sheet = _RunsFilterSheet(controller: controller, cupertino: cupertino); - if (cupertino) { - return showCupertinoModalPopup( - context: context, - builder: (_) => CupertinoPopupSurface(child: SafeArea(child: sheet)), - ); - } return showModalBottomSheet( context: context, isScrollControlled: true, showDragHandle: true, useSafeArea: true, - builder: (_) => sheet, + builder: (_) => _RunsFilterSheet(controller: controller), ); } class _RunsFilterSheet extends StatefulWidget { - const _RunsFilterSheet({required this.controller, required this.cupertino}); + const _RunsFilterSheet({required this.controller}); final RunsController controller; - final bool cupertino; @override State<_RunsFilterSheet> createState() => _RunsFilterSheetState(); @@ -65,11 +54,7 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> { } Widget _section(BuildContext context, String title) { - final style = widget.cupertino - ? CupertinoTheme.of( - context, - ).textTheme.textStyle.copyWith(fontWeight: FontWeight.w600) - : Theme.of(context).textTheme.titleSmall; + final style = Theme.of(context).textTheme.titleSmall; return Padding( padding: const EdgeInsets.fromLTRB(16, 16, 16, 4), child: Semantics(header: true, child: Text(title, style: style)), @@ -78,7 +63,6 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> { /// One status: several may be on at once, so Material uses a checkbox. Widget _multiChoice(String label, bool checked, VoidCallback onTap) { - if (widget.cupertino) return _checkRow(label, checked, onTap); return CheckboxListTile( dense: true, title: Text(label), @@ -95,13 +79,6 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> { ); Widget _checkRow(String label, bool checked, VoidCallback onTap) { - if (widget.cupertino) { - return CupertinoListTile( - title: Text(label), - trailing: checked ? const Icon(CupertinoIcons.check_mark) : null, - onTap: onTap, - ); - } return ListTile( dense: true, selected: checked, @@ -117,7 +94,7 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> { final field = AppSearchField( fieldKey: const ValueKey('runs.filter.query'), controller: _text, - cupertino: widget.cupertino, + cupertino: false, placeholder: 'Filter runs', onChanged: controller.setQuery, ); @@ -136,7 +113,7 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> { children: [ AppSheetHeader( title: runsFilterTitle, - cupertino: widget.cupertino, + cupertino: false, doneKey: runsFilterDoneKey, actions: [if (active) _clearButton()], ), @@ -148,18 +125,11 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> { ); } - Widget _clearButton() => widget.cupertino - ? CupertinoButton( - key: runsFilterClearKey, - padding: const EdgeInsets.symmetric(horizontal: 8), - onPressed: _clear, - child: const Text('Clear'), - ) - : TextButton( - key: runsFilterClearKey, - onPressed: _clear, - child: const Text('Clear'), - ); + Widget _clearButton() => TextButton( + key: runsFilterClearKey, + onPressed: _clear, + child: const Text('Clear'), + ); Widget _list(BuildContext context, RunsController controller, Widget field) { return ListView( diff --git a/app/lib/features/runs/ui/runs_filters.dart b/app/lib/features/runs/ui/runs_filters.dart index 640cf479..ab43bacf 100644 --- a/app/lib/features/runs/ui/runs_filters.dart +++ b/app/lib/features/runs/ui/runs_filters.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/app_popups.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/segmented_bar_overflow.dart'; import '../../pipelines/pipeline_format.dart' show runStateLabel; import 'runs_controller.dart'; @@ -107,29 +105,6 @@ class RunsFilters extends StatelessWidget { ({String label, VoidCallback clear}) entry, ) { final clearLabel = 'Clear filter: ${entry.label}'; - if (usesCupertinoHost(context)) { - return Semantics( - button: true, - label: clearLabel, - excludeSemantics: true, - onTap: entry.clear, - child: CupertinoButton( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), - minimumSize: Size.zero, - onPressed: entry.clear, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Flexible( - child: Text(entry.label, overflow: TextOverflow.ellipsis), - ), - const SizedBox(width: 4), - const Icon(CupertinoIcons.xmark_circle_fill, size: 16), - ], - ), - ), - ); - } return InputChip( label: Text(entry.label), onDeleted: entry.clear, @@ -147,7 +122,6 @@ class RunsBarActions { final RunsController controller; List build(BuildContext context, {required VoidCallback onStats}) { - final cupertino = usesCupertinoHost(context); final count = controller.activeFilterCount + (controller.query.isEmpty ? 0 : 1); final filterLabel = count > 0 @@ -156,46 +130,25 @@ class RunsBarActions { Widget icon( Key key, IconData material, - IconData ios, String label, VoidCallback onPressed, { bool active = false, bool anchorPopup = false, }) { - final Widget button; - if (cupertino) { - button = Semantics( - button: true, - label: label, - excludeSemantics: true, - child: CupertinoButton( - key: key, - // The whole 44pt target and no extra padding, like every bar - // action, so the icons are evenly spaced inside the pill. - padding: EdgeInsets.zero, - minimumSize: const Size.square(kMinInteractiveDimensionCupertino), - onPressed: onPressed, - child: Icon(ios), - ), - ); - } else { - button = Builder( - builder: (buttonContext) => IconButton( - key: key, - tooltip: label, - isSelected: active, - onPressed: anchorPopup - ? () => _chooseSort(buttonContext) - : onPressed, - icon: Icon(material), - ), - ); - } + final button = Builder( + builder: (buttonContext) => IconButton( + key: key, + tooltip: label, + isSelected: active, + onPressed: anchorPopup ? () => _chooseSort(buttonContext) : onPressed, + icon: Icon(material), + ), + ); // A narrow bar moves it into its More menu. return SegmentedOverflowAction( overflowEntry: SegmentedOverflowEntry( label: label, - icon: cupertino ? ios : material, + icon: material, onPressed: onPressed, ), child: button, @@ -206,16 +159,12 @@ class RunsBarActions { icon( const ValueKey('runs.stats'), Icons.insert_chart_outlined, - CupertinoIcons.chart_pie, 'Usage and charts', onStats, ), icon( const ValueKey('runs.filter'), count > 0 ? Icons.filter_alt : Icons.filter_alt_outlined, - count > 0 - ? CupertinoIcons.line_horizontal_3_decrease_circle_fill - : CupertinoIcons.line_horizontal_3_decrease_circle, filterLabel, () => showRunsFilterSheet(context, controller), active: count > 0, @@ -223,7 +172,6 @@ class RunsBarActions { icon( const ValueKey('runs.sort'), Icons.sort, - CupertinoIcons.arrow_up_arrow_down, 'Sort runs: ${runSortLabel(controller.sort)}', () => _chooseSort(context), anchorPopup: true, diff --git a/app/lib/features/runs/ui/runs_list.dart b/app/lib/features/runs/ui/runs_list.dart index 7c22d8df..702dbd7a 100644 --- a/app/lib/features/runs/ui/runs_list.dart +++ b/app/lib/features/runs/ui/runs_list.dart @@ -1,10 +1,8 @@ import '../../../ui/motion/motion.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/layout/memo_subtree.dart'; import '../../attention/notify/notification_controller.dart'; import '../../attention/runtime/attention_controller.dart'; @@ -146,9 +144,7 @@ class RunsList extends StatelessWidget { if (controller.loading && controller.runs.isEmpty) { return _state( context, - icon: usesCupertinoHost(context) - ? const CupertinoActivityIndicator() - : const CircularProgressIndicator(), + icon: const CircularProgressIndicator(), title: 'Loading runs…', ); } @@ -174,11 +170,7 @@ class RunsList extends StatelessWidget { Expanded( child: _state( context, - icon: Icon( - usesCupertinoHost(context) - ? CupertinoIcons.tray - : Icons.inbox_outlined, - ), + icon: const Icon(Icons.inbox_outlined), title: 'No runs found.', subtitle: 'Try changing or clearing the filters.', ), @@ -244,23 +236,11 @@ class RunsList extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Icon( - usesCupertinoHost(context) - ? CupertinoIcons.exclamationmark_triangle - : Icons.error_outline, - ), + const Icon(Icons.error_outline), const SizedBox(height: 8), Text(controller.error!), const SizedBox(height: 8), - usesCupertinoHost(context) - ? CupertinoButton( - onPressed: controller.load, - child: const Text('Retry'), - ) - : FilledButton( - onPressed: controller.load, - child: const Text('Retry'), - ), + FilledButton(onPressed: controller.load, child: const Text('Retry')), ], ), ), @@ -288,9 +268,7 @@ class RunsList extends StatelessWidget { subtitle, textAlign: TextAlign.center, style: TextStyle( - color: usesCupertinoHost(context) - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], @@ -304,13 +282,7 @@ class RunsList extends StatelessWidget { child: Row( children: [ Expanded(child: Text(controller.error!)), - if (usesCupertinoHost(context)) - CupertinoButton( - onPressed: controller.load, - child: const Text('Retry'), - ) - else - TextButton(onPressed: controller.load, child: const Text('Retry')), + TextButton(onPressed: controller.load, child: const Text('Retry')), ], ), ); diff --git a/app/lib/features/runs/ui/runs_selection_bar.dart b/app/lib/features/runs/ui/runs_selection_bar.dart index 38aa7c8c..4b78f926 100644 --- a/app/lib/features/runs/ui/runs_selection_bar.dart +++ b/app/lib/features/runs/ui/runs_selection_bar.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 '../../../ui/adaptive/segmented_bar_overflow.dart'; import '../../../ui/layout/section_heading.dart'; import '../actions/delete_runs_action.dart'; @@ -25,39 +23,22 @@ ValueKey runsDaySelectKey(String day) => /// The Runs bar's `Select` action, entering multi-select. Widget runsSelectAction(BuildContext context, RunsController controller) { void enter() => controller.selection.enter(); - final cupertino = usesCupertinoHost(context); // A narrow bar moves it into its More menu. return SegmentedOverflowAction( overflowEntry: SegmentedOverflowEntry( label: 'Select', - icon: cupertino ? CupertinoIcons.checkmark_circle : Icons.checklist, + icon: Icons.checklist, onPressed: enter, ), - child: cupertino - ? _selectButtonCupertino(enter) - : IconButton( - key: runsSelectKey, - tooltip: 'Select', - onPressed: enter, - icon: const Icon(Icons.checklist), - ), + child: IconButton( + key: runsSelectKey, + tooltip: 'Select', + onPressed: enter, + icon: const Icon(Icons.checklist), + ), ); } -Widget _selectButtonCupertino(VoidCallback enter) => Semantics( - button: true, - label: 'Select', - excludeSemantics: true, - onTap: enter, - child: CupertinoButton( - key: runsSelectKey, - padding: EdgeInsets.zero, - minimumSize: const Size.square(kMinInteractiveDimensionCupertino), - onPressed: enter, - child: const Icon(CupertinoIcons.checkmark_circle), - ), -); - /// What the bar shows in select mode: `N selected` over the selection's size, /// then Delete and Done. ({String title, String? subtitle, List actions}) runsSelectionBar( @@ -71,7 +52,6 @@ Widget _selectButtonCupertino(VoidCallback enter) => Semantics( ]; final count = selected.length; final size = count == 0 ? null : runsSizeLabel(selected); - final cupertino = usesCupertinoHost(context); final delete = count == 0 ? null : () => confirmDeleteRuns( @@ -79,62 +59,32 @@ Widget _selectButtonCupertino(VoidCallback enter) => Semantics( runs: selected, gateway: controller.repository.gateway, onDeleted: controller.applyDeletion, - cupertino: cupertino, + cupertino: false, ); final deleteLabel = count == 0 ? 'Delete selected runs' : 'Delete $count selected ${count == 1 ? 'run' : 'runs'}'; - final List actions; - if (cupertino) { - actions = [ - Semantics( - button: true, - enabled: delete != null, - label: deleteLabel, - excludeSemantics: true, - onTap: delete, - child: CupertinoButton( - key: runsDeleteSelectedKey, - onPressed: delete, - child: Text( - 'Delete', - style: TextStyle( - color: delete == null - ? null - : CupertinoColors.systemRed.resolveFrom(context), - ), - ), - ), + final scheme = Theme.of(context).colorScheme; + final actions = [ + Semantics( + label: deleteLabel, + excludeSemantics: true, + onTap: delete, + button: true, + enabled: delete != null, + child: TextButton( + key: runsDeleteSelectedKey, + style: TextButton.styleFrom(foregroundColor: scheme.error), + onPressed: delete, + child: const Text('Delete'), ), - CupertinoButton( - key: runsSelectDoneKey, - onPressed: selection.exit, - child: const Text('Done'), - ), - ]; - } else { - final scheme = Theme.of(context).colorScheme; - actions = [ - Semantics( - label: deleteLabel, - excludeSemantics: true, - onTap: delete, - button: true, - enabled: delete != null, - child: TextButton( - key: runsDeleteSelectedKey, - style: TextButton.styleFrom(foregroundColor: scheme.error), - onPressed: delete, - child: const Text('Delete'), - ), - ), - TextButton( - key: runsSelectDoneKey, - onPressed: selection.exit, - child: const Text('Done'), - ), - ]; - } + ), + TextButton( + key: runsSelectDoneKey, + onPressed: selection.exit, + child: const Text('Done'), + ), + ]; return (title: '$count selected', subtitle: size, actions: actions); } @@ -171,15 +121,7 @@ class RunsDayHeading extends StatelessWidget { : '$text $label. No finished runs to select.', excludeSemantics: true, onTap: toggle, - child: usesCupertinoHost(context) - ? CupertinoButton( - key: key, - padding: const EdgeInsets.symmetric(horizontal: 8), - minimumSize: const Size(0, kMinInteractiveDimensionCupertino), - onPressed: toggle, - child: Text(text), - ) - : TextButton(key: key, onPressed: toggle, child: Text(text)), + child: TextButton(key: key, onPressed: toggle, child: Text(text)), ), ); } @@ -205,7 +147,6 @@ class RunsDeleteReport extends StatelessWidget { Widget build(BuildContext context) { final report = controller.selection.report; if (report == null) return const SizedBox.shrink(); - final cupertino = usesCupertinoHost(context); final dismiss = controller.selection.dismissReport; return Padding( padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 8, 4), @@ -218,18 +159,11 @@ class RunsDeleteReport extends StatelessWidget { child: Text(report, key: runsDeleteReportKey), ), ), - cupertino - ? CupertinoButton( - key: runsDeleteReportDismissKey, - padding: const EdgeInsets.symmetric(horizontal: 8), - onPressed: dismiss, - child: const Text('Dismiss'), - ) - : TextButton( - key: runsDeleteReportDismissKey, - onPressed: dismiss, - child: const Text('Dismiss'), - ), + TextButton( + key: runsDeleteReportDismissKey, + onPressed: dismiss, + child: const Text('Dismiss'), + ), ], ), ); diff --git a/app/lib/features/runs/ui/runs_stats_page.dart b/app/lib/features/runs/ui/runs_stats_page.dart index 495b14ed..cdd66c86 100644 --- a/app/lib/features/runs/ui/runs_stats_page.dart +++ b/app/lib/features/runs/ui/runs_stats_page.dart @@ -1,12 +1,10 @@ import '../../../ui/adaptive/segmented_bar.dart'; import 'dart:math' as math; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/status/run_status_icon.dart'; import '../domain/run_models.dart'; import '../../pipelines/pipeline_format.dart' show parseInstant, runStateLabel; @@ -17,9 +15,7 @@ import 'runs_controller.dart'; Future openRunsStats(BuildContext context, RunsController controller) { final page = RunsStatsPage(controller: controller); return Navigator.of(context).push( - usesCupertinoHost(context) - ? CupertinoPageRoute(builder: (_) => page) - : MaterialPageRoute(builder: (_) => page), + MaterialPageRoute(builder: (_) => page), ); } @@ -32,17 +28,10 @@ class RunsStatsPage extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final body = ListenableBuilder( listenable: controller, - builder: (context, _) => _body(context, cupertino), + builder: (context, _) => _body(context), ); - if (cupertino) { - return CupertinoPageScaffold( - navigationBar: const SegmentedBar(cupertino: true, title: 'Usage'), - child: SafeArea(top: false, bottom: false, child: body), - ); - } return Scaffold( extendBodyBehindAppBar: true, appBar: const SegmentedBar(cupertino: false, title: 'Usage'), @@ -50,7 +39,7 @@ class RunsStatsPage extends StatelessWidget { ); } - Widget _body(BuildContext context, bool cupertino) { + Widget _body(BuildContext context) { final runs = controller.runs; final metrics = detailUsageMetrics(controller.usage); final byState = {}; @@ -60,14 +49,8 @@ class RunsStatsPage extends StatelessWidget { } final today = now?.call() ?? DateTime.now(); final days = runsPerDay(runs, today); - final heading = TextStyle( - fontWeight: FontWeight.w600, - fontSize: 17, - color: cupertino ? CupertinoColors.label.resolveFrom(context) : null, - ); - final secondary = cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant; + const heading = TextStyle(fontWeight: FontWeight.w600, fontSize: 17); + final secondary = Theme.of(context).colorScheme.onSurfaceVariant; return ListView( key: const ValueKey('runs.stats.page'), padding: withBarClearance(context, const EdgeInsets.all(16)), @@ -151,7 +134,7 @@ class RunsStatsPage extends StatelessWidget { style: TextStyle(color: secondary), ) else - _DaysChart(days: days, cupertino: cupertino, secondary: secondary), + _DaysChart(days: days, secondary: secondary), ], ); } @@ -203,25 +186,16 @@ class _PiePainter extends CustomPainter { /// Runs per day as bars over a baseline axis, each bar labelled with its /// count and its weekday underneath. Only drawn when some day has a run. class _DaysChart extends StatelessWidget { - const _DaysChart({ - required this.days, - required this.cupertino, - required this.secondary, - }); + const _DaysChart({required this.days, required this.secondary}); final List<({String label, int count})> days; - final bool cupertino; final Color secondary; @override Widget build(BuildContext context) { final most = days.map((d) => d.count).reduce(math.max); - final bar = cupertino - ? CupertinoTheme.of(context).primaryColor - : Theme.of(context).colorScheme.primary; - final axis = cupertino - ? CupertinoColors.separator.resolveFrom(context) - : Theme.of(context).colorScheme.outlineVariant; + final bar = Theme.of(context).colorScheme.primary; + final axis = Theme.of(context).colorScheme.outlineVariant; return Column( key: const ValueKey('runs.stats.days'), crossAxisAlignment: CrossAxisAlignment.stretch, diff --git a/app/test/application/runs_destination_test.dart b/app/test/application/runs_destination_test.dart index e2798b58..acc97a3c 100644 --- a/app/test/application/runs_destination_test.dart +++ b/app/test/application/runs_destination_test.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/application/app_session.dart'; @@ -280,30 +279,4 @@ void main() { }, ); - testWidgets('gate uses Cupertino progress without a Material ancestor', ( - tester, - ) async { - final channel = FakeChannel(); - final client = PipelinesClient(channelFactory: (_) => channel); - final server = webServer(); - final session = AppSession(endpoint: server.uri, client: client); - addTearDown(session.dispose); - - final starting = session.start(); - await tester.pumpWidget( - CupertinoApp( - home: CupertinoPageScaffold( - child: RunsDestination(session: session, server: server), - ), - ), - ); - await tester.pump(); - expect(find.text('Connecting to Pipelines…'), findsOneWidget); - expect(find.byType(CupertinoActivityIndicator), findsOneWidget); - expect(find.byType(CircularProgressIndicator), findsNothing); - expect(find.byType(Material), findsNothing); - session.dispose(); - await starting; - await tester.pump(); - }); }