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.
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:flutter/services.dart';
|
|||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/floating_destination_bar.dart';
|
import '../../../ui/adaptive/floating_destination_bar.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../changes/changes.dart';
|
import '../../changes/changes.dart';
|
||||||
import 'run_detail_tab_bodies.dart';
|
import 'run_detail_tab_bodies.dart';
|
||||||
import 'run_field_body.dart';
|
import 'run_field_body.dart';
|
||||||
@@ -61,19 +60,18 @@ class RunVisitSectionStrip extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final index = shownVisitSections.indexOf(visitTabFor(selected));
|
final index = shownVisitSections.indexOf(visitTabFor(selected));
|
||||||
return KeyedSubtree(
|
return KeyedSubtree(
|
||||||
key: const Key('run-visit-tabs'),
|
key: const Key('run-visit-tabs'),
|
||||||
child: FloatingDestinationBar(
|
child: FloatingDestinationBar(
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
currentIndex: index < 0 ? 0 : index,
|
currentIndex: index < 0 ? 0 : index,
|
||||||
onTap: (value) => onSelected(shownVisitSections[value]),
|
onTap: (value) => onSelected(shownVisitSections[value]),
|
||||||
items: [
|
items: [
|
||||||
for (final section in shownVisitSections)
|
for (final section in shownVisitSections)
|
||||||
FloatingDestinationItem(
|
FloatingDestinationItem(
|
||||||
key: ValueKey('run-visit-tab-${section.name}'),
|
key: ValueKey('run-visit-tab-${section.name}'),
|
||||||
icon: Icon(cupertino ? section.cupertinoIcon : section.icon),
|
icon: Icon(section.icon),
|
||||||
label: section.label,
|
label: section.label,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -132,7 +130,6 @@ Widget runVisitSectionBody({
|
|||||||
key: ValueKey('run-visit-summary-$visitIndex'),
|
key: ValueKey('run-visit-summary-$visitIndex'),
|
||||||
input: step['input'],
|
input: step['input'],
|
||||||
output: step['output'],
|
output: step['output'],
|
||||||
cupertino: cupertino,
|
|
||||||
facts: facts,
|
facts: facts,
|
||||||
);
|
);
|
||||||
case RunVisitSection.more:
|
case RunVisitSection.more:
|
||||||
@@ -167,14 +164,7 @@ Widget runVisitSectionBody({
|
|||||||
showSummary: false,
|
showSummary: false,
|
||||||
);
|
);
|
||||||
// The viewer's own header leads it, so it starts below the bar.
|
// The viewer's own header leads it, so it starts below the bar.
|
||||||
return BelowTopBar(
|
return BelowTopBar(child: viewer);
|
||||||
child: cupertino
|
|
||||||
? Builder(
|
|
||||||
builder: (context) =>
|
|
||||||
Theme(data: hostTextTheme(context), child: viewer),
|
|
||||||
)
|
|
||||||
: viewer,
|
|
||||||
);
|
|
||||||
case RunVisitSection.session:
|
case RunVisitSection.session:
|
||||||
return RunVisitSession(
|
return RunVisitSession(
|
||||||
run: run,
|
run: run,
|
||||||
@@ -193,13 +183,11 @@ class _VisitSummary extends StatefulWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.input,
|
required this.input,
|
||||||
required this.output,
|
required this.output,
|
||||||
required this.cupertino,
|
|
||||||
this.facts,
|
this.facts,
|
||||||
});
|
});
|
||||||
|
|
||||||
final dynamic input;
|
final dynamic input;
|
||||||
final dynamic output;
|
final dynamic output;
|
||||||
final bool cupertino;
|
|
||||||
|
|
||||||
/// The visit's facts, leading the scroll below the top bar.
|
/// The visit's facts, leading the scroll below the top bar.
|
||||||
final Widget? facts;
|
final Widget? facts;
|
||||||
@@ -218,24 +206,12 @@ class _VisitSummaryState extends State<_VisitSummary> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _section(String name, dynamic value, String empty) {
|
Widget _section(String name, dynamic value, String empty) {
|
||||||
final copy = widget.cupertino
|
final copy = IconButton(
|
||||||
? CupertinoButton(
|
key: ValueKey('run-visit-copy-$name'),
|
||||||
key: ValueKey('run-visit-copy-$name'),
|
tooltip: 'Copy $name',
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
onPressed: () => _copy(name, value),
|
||||||
onPressed: () => _copy(name, value),
|
icon: Icon(_copied == name ? Icons.check : Icons.copy),
|
||||||
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 open = !_closed.contains(name);
|
final open = !_closed.contains(name);
|
||||||
return StickySection(
|
return StickySection(
|
||||||
key: ValueKey('run-visit-section-$name'),
|
key: ValueKey('run-visit-section-$name'),
|
||||||
@@ -247,11 +223,7 @@ class _VisitSummaryState extends State<_VisitSummary> {
|
|||||||
trailing: [copy],
|
trailing: [copy],
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||||
child: RunFieldBody(
|
child: RunFieldBody(value: value, empty: empty, cupertino: false),
|
||||||
value: value,
|
|
||||||
empty: empty,
|
|
||||||
cupertino: widget.cupertino,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../artifacts/domain/artifact_record.dart';
|
import '../../artifacts/domain/artifact_record.dart';
|
||||||
import '../../artifacts/domain/artifact_url.dart';
|
import '../../artifacts/domain/artifact_url.dart';
|
||||||
import '../../artifacts/ui/artifact_external_open.dart';
|
import '../../artifacts/ui/artifact_external_open.dart';
|
||||||
@@ -123,13 +121,6 @@ class _RunVisitSessionState extends State<RunVisitSession> {
|
|||||||
|
|
||||||
Widget _openButton(ArtifactRecord export, ResolvedArtifactUrl resolved) {
|
Widget _openButton(ArtifactRecord export, ResolvedArtifactUrl resolved) {
|
||||||
final label = 'Open ${export.name.isEmpty ? 'session.html' : export.name}';
|
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(
|
return Align(
|
||||||
alignment: AlignmentDirectional.centerStart,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
child: TextButton(onPressed: () => _open(resolved), child: Text(label)),
|
child: TextButton(onPressed: () => _open(resolved), child: Text(label)),
|
||||||
@@ -211,19 +202,14 @@ class _SessionFact extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final cupertino = CupertinoTheme.of(context);
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
style: usesCupertinoHost(context)
|
style: (theme.textTheme.labelMedium ?? const TextStyle()).copyWith(
|
||||||
? cupertino.textTheme.tabLabelTextStyle.copyWith(
|
color: theme.colorScheme.onSurfaceVariant,
|
||||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
),
|
||||||
)
|
|
||||||
: (theme.textTheme.labelMedium ?? const TextStyle()).copyWith(
|
|
||||||
color: theme.colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
Text(value),
|
Text(value),
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class RunDetailWideChrome extends StatelessWidget {
|
|||||||
heightFactor: 1,
|
heightFactor: 1,
|
||||||
child: GlassPill(
|
child: GlassPill(
|
||||||
key: const Key('run-detail-header'),
|
key: const Key('run-detail-header'),
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(kTopGlassStripRadius),
|
borderRadius: BorderRadius.circular(kTopGlassStripRadius),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../chat/ui/transcript/chat_markdown_view.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') {
|
if (map.length == 1 && map.keys.single.toLowerCase() == 'markdown') {
|
||||||
return _value(runFieldText(map.values.single));
|
return _value(runFieldText(map.values.single));
|
||||||
}
|
}
|
||||||
final caption =
|
final caption = Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||||
(cupertino
|
fontWeight: FontWeight.w600,
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
: Theme.of(context).textTheme.labelMedium)
|
);
|
||||||
?.copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: cupertino
|
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
);
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/segmented_bar.dart';
|
import '../../../ui/adaptive/segmented_bar.dart';
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||||
import '../../graph/domain/graph_definition.dart';
|
import '../../graph/domain/graph_definition.dart';
|
||||||
import '../../graph/widgets/run_graph_view.dart';
|
import '../../graph/widgets/run_graph_view.dart';
|
||||||
@@ -34,7 +32,6 @@ class RunGraphPreview extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
// No graph to draw: one muted line, with no frame and nothing to open.
|
// No graph to draw: one muted line, with no frame and nothing to open.
|
||||||
if (graphNodes(graph).isEmpty) {
|
if (graphNodes(graph).isEmpty) {
|
||||||
return Padding(
|
return Padding(
|
||||||
@@ -42,30 +39,24 @@ class RunGraphPreview extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
runGraphMissing,
|
runGraphMissing,
|
||||||
style: cupertino
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle.copyWith(
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
),
|
||||||
)
|
|
||||||
: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final border = cupertino
|
final border = Theme.of(context).colorScheme.outlineVariant;
|
||||||
? CupertinoColors.separator.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.outlineVariant;
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
button: true,
|
button: true,
|
||||||
label: 'Run graph, open full screen',
|
label: 'Run graph, open full screen',
|
||||||
excludeSemantics: true,
|
excludeSemantics: true,
|
||||||
onTap: () => _open(context, cupertino),
|
onTap: () => _open(context),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
key: runGraphPreviewKey,
|
key: runGraphPreviewKey,
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: () => _open(context, cupertino),
|
onTap: () => _open(context),
|
||||||
child: DecoratedBox(
|
child: DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: border),
|
border: Border.all(color: border),
|
||||||
@@ -100,7 +91,7 @@ class RunGraphPreview extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _open(BuildContext context, bool cupertino) {
|
Future<void> _open(BuildContext context) {
|
||||||
Widget graphView(BuildContext pageContext) => RunGraphView(
|
Widget graphView(BuildContext pageContext) => RunGraphView(
|
||||||
key: const Key('run-detail-graph'),
|
key: const Key('run-detail-graph'),
|
||||||
// Already full screen: no maximise button to open it again.
|
// Already full screen: no maximise button to open it again.
|
||||||
@@ -114,23 +105,13 @@ class RunGraphPreview extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
return Navigator.of(context).push<void>(
|
return Navigator.of(context).push<void>(
|
||||||
cupertino
|
MaterialPageRoute<void>(
|
||||||
? CupertinoPageRoute<void>(
|
builder: (page) => Scaffold(
|
||||||
builder: (page) => CupertinoPageScaffold(
|
extendBodyBehindAppBar: true,
|
||||||
navigationBar: const SegmentedBar(
|
appBar: const SegmentedBar(cupertino: false, title: 'Graph'),
|
||||||
cupertino: true,
|
body: BelowTopBar(child: graphView(page)),
|
||||||
title: 'Graph',
|
),
|
||||||
),
|
),
|
||||||
child: BelowTopBar(child: graphView(page)),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: MaterialPageRoute<void>(
|
|
||||||
builder: (page) => Scaffold(
|
|
||||||
extendBodyBehindAppBar: true,
|
|
||||||
appBar: const SegmentedBar(cupertino: false, title: 'Graph'),
|
|
||||||
body: BelowTopBar(child: graphView(page)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import '../../../core/servers/server_context.dart';
|
import '../../../core/servers/server_context.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/layout/app_list_avatar.dart';
|
import '../../../ui/layout/app_list_avatar.dart';
|
||||||
import '../../../ui/layout/app_list_row.dart';
|
import '../../../ui/layout/app_list_row.dart';
|
||||||
import '../../../ui/status/run_status_icon.dart';
|
import '../../../ui/status/run_status_icon.dart';
|
||||||
@@ -61,7 +59,6 @@ class RunListRow extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final identity = runIdentity(run['title'], run['name']);
|
final identity = runIdentity(run['title'], run['name']);
|
||||||
final id = run['id'];
|
final id = run['id'];
|
||||||
final title = identity.label.isEmpty ? 'Run $id' : identity.label;
|
final title = identity.label.isEmpty ? 'Run $id' : identity.label;
|
||||||
@@ -122,12 +119,12 @@ class RunListRow extends StatelessWidget {
|
|||||||
final state = runStateOf(run['status']);
|
final state = runStateOf(run['status']);
|
||||||
return AppListRow(
|
return AppListRow(
|
||||||
key: ValueKey('run-row-$id'),
|
key: ValueKey('run-row-$id'),
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
selected: selected,
|
selected: selected,
|
||||||
divider: divider,
|
divider: divider,
|
||||||
onTap: selecting ? (runIsDeletable(run) ? onToggle : null) : onTap,
|
onTap: selecting ? (runIsDeletable(run) ? onToggle : null) : onTap,
|
||||||
onLongPress: selecting ? null : onLongPress,
|
onLongPress: selecting ? null : onLongPress,
|
||||||
selectionControl: selecting ? _checkbox(context, cupertino) : null,
|
selectionControl: selecting ? _checkbox(context) : null,
|
||||||
leading: AppListAvatar(
|
leading: AppListAvatar(
|
||||||
foreground: runStatusColor(state).resolveFrom(context),
|
foreground: runStatusColor(state).resolveFrom(context),
|
||||||
child: RunStatusIcon(state: state, label: runStatusLabel(run)),
|
child: RunStatusIcon(state: state, label: runStatusLabel(run)),
|
||||||
@@ -151,25 +148,25 @@ class RunListRow extends StatelessWidget {
|
|||||||
onRunChanged: onRunChanged!,
|
onRunChanged: onRunChanged!,
|
||||||
onRunOpened: onRunOpened,
|
onRunOpened: onRunOpened,
|
||||||
onDeleted: onDeleted,
|
onDeleted: onDeleted,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
menuKey: ValueKey('run-list-more-menu-$id'),
|
menuKey: ValueKey('run-list-more-menu-$id'),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _checkbox(BuildContext context, bool cupertino) {
|
Widget _checkbox(BuildContext context) {
|
||||||
final id = run['id'];
|
final id = run['id'];
|
||||||
final enabled = runIsDeletable(run);
|
final enabled = runIsDeletable(run);
|
||||||
final title = runIdentity(run['title'], run['name']).label;
|
final title = runIdentity(run['title'], run['name']).label;
|
||||||
final name = title.isEmpty ? 'run $id' : title;
|
final name = title.isEmpty ? 'run $id' : title;
|
||||||
final changed = enabled ? (_) => onToggle?.call() : null;
|
final changed = enabled ? (_) => onToggle?.call() : null;
|
||||||
final box = cupertino
|
|
||||||
? CupertinoCheckbox(value: checked, onChanged: changed)
|
|
||||||
: Checkbox(value: checked, onChanged: changed);
|
|
||||||
return Semantics(
|
return Semantics(
|
||||||
label: enabled ? 'Select $name' : 'Select $name. $runDeleteBlockedReason',
|
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),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class _RunMoreMenuState extends State<RunMoreMenu> {
|
|||||||
runs: [run],
|
runs: [run],
|
||||||
gateway: widget.gateway,
|
gateway: widget.gateway,
|
||||||
onDeleted: widget.onDeleted!,
|
onDeleted: widget.onDeleted!,
|
||||||
cupertino: widget.cupertino,
|
cupertino: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
@@ -45,22 +44,14 @@ class RunPipelineLink extends StatelessWidget {
|
|||||||
link: true,
|
link: true,
|
||||||
label: 'Open pipeline $name',
|
label: 'Open pipeline $name',
|
||||||
excludeSemantics: true,
|
excludeSemantics: true,
|
||||||
child: cupertino
|
child: InkWell(
|
||||||
? CupertinoButton(
|
key: runPipelineLinkKey,
|
||||||
key: runPipelineLinkKey,
|
onTap: go,
|
||||||
padding: EdgeInsets.zero,
|
child: DefaultTextStyle.merge(
|
||||||
minimumSize: Size.zero,
|
style: TextStyle(color: Theme.of(context).colorScheme.primary),
|
||||||
onPressed: go,
|
child: label,
|
||||||
child: label,
|
),
|
||||||
)
|
),
|
||||||
: InkWell(
|
|
||||||
key: runPipelineLinkKey,
|
|
||||||
onTap: go,
|
|
||||||
child: DefaultTextStyle.merge(
|
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.primary),
|
|
||||||
child: label,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/input/app_search_field.dart';
|
import '../../../ui/input/app_search_field.dart';
|
||||||
import '../../../ui/layout/app_sheet_header.dart';
|
import '../../../ui/layout/app_sheet_header.dart';
|
||||||
import '../../pipelines/pipeline_format.dart' show runStateLabel;
|
import '../../pipelines/pipeline_format.dart' show runStateLabel;
|
||||||
@@ -20,28 +18,19 @@ Future<void> showRunsFilterSheet(
|
|||||||
BuildContext context,
|
BuildContext context,
|
||||||
RunsController controller,
|
RunsController controller,
|
||||||
) {
|
) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final sheet = _RunsFilterSheet(controller: controller, cupertino: cupertino);
|
|
||||||
if (cupertino) {
|
|
||||||
return showCupertinoModalPopup<void>(
|
|
||||||
context: context,
|
|
||||||
builder: (_) => CupertinoPopupSurface(child: SafeArea(child: sheet)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return showModalBottomSheet<void>(
|
return showModalBottomSheet<void>(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
showDragHandle: true,
|
showDragHandle: true,
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
builder: (_) => sheet,
|
builder: (_) => _RunsFilterSheet(controller: controller),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RunsFilterSheet extends StatefulWidget {
|
class _RunsFilterSheet extends StatefulWidget {
|
||||||
const _RunsFilterSheet({required this.controller, required this.cupertino});
|
const _RunsFilterSheet({required this.controller});
|
||||||
|
|
||||||
final RunsController controller;
|
final RunsController controller;
|
||||||
final bool cupertino;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_RunsFilterSheet> createState() => _RunsFilterSheetState();
|
State<_RunsFilterSheet> createState() => _RunsFilterSheetState();
|
||||||
@@ -65,11 +54,7 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _section(BuildContext context, String title) {
|
Widget _section(BuildContext context, String title) {
|
||||||
final style = widget.cupertino
|
final style = Theme.of(context).textTheme.titleSmall;
|
||||||
? CupertinoTheme.of(
|
|
||||||
context,
|
|
||||||
).textTheme.textStyle.copyWith(fontWeight: FontWeight.w600)
|
|
||||||
: Theme.of(context).textTheme.titleSmall;
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 4),
|
padding: const EdgeInsets.fromLTRB(16, 16, 16, 4),
|
||||||
child: Semantics(header: true, child: Text(title, style: style)),
|
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.
|
/// One status: several may be on at once, so Material uses a checkbox.
|
||||||
Widget _multiChoice(String label, bool checked, VoidCallback onTap) {
|
Widget _multiChoice(String label, bool checked, VoidCallback onTap) {
|
||||||
if (widget.cupertino) return _checkRow(label, checked, onTap);
|
|
||||||
return CheckboxListTile(
|
return CheckboxListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
title: Text(label),
|
title: Text(label),
|
||||||
@@ -95,13 +79,6 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Widget _checkRow(String label, bool checked, VoidCallback onTap) {
|
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(
|
return ListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
selected: checked,
|
selected: checked,
|
||||||
@@ -117,7 +94,7 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
|
|||||||
final field = AppSearchField(
|
final field = AppSearchField(
|
||||||
fieldKey: const ValueKey('runs.filter.query'),
|
fieldKey: const ValueKey('runs.filter.query'),
|
||||||
controller: _text,
|
controller: _text,
|
||||||
cupertino: widget.cupertino,
|
cupertino: false,
|
||||||
placeholder: 'Filter runs',
|
placeholder: 'Filter runs',
|
||||||
onChanged: controller.setQuery,
|
onChanged: controller.setQuery,
|
||||||
);
|
);
|
||||||
@@ -136,7 +113,7 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
|
|||||||
children: [
|
children: [
|
||||||
AppSheetHeader(
|
AppSheetHeader(
|
||||||
title: runsFilterTitle,
|
title: runsFilterTitle,
|
||||||
cupertino: widget.cupertino,
|
cupertino: false,
|
||||||
doneKey: runsFilterDoneKey,
|
doneKey: runsFilterDoneKey,
|
||||||
actions: [if (active) _clearButton()],
|
actions: [if (active) _clearButton()],
|
||||||
),
|
),
|
||||||
@@ -148,18 +125,11 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _clearButton() => widget.cupertino
|
Widget _clearButton() => TextButton(
|
||||||
? CupertinoButton(
|
key: runsFilterClearKey,
|
||||||
key: runsFilterClearKey,
|
onPressed: _clear,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
child: const Text('Clear'),
|
||||||
onPressed: _clear,
|
);
|
||||||
child: const Text('Clear'),
|
|
||||||
)
|
|
||||||
: TextButton(
|
|
||||||
key: runsFilterClearKey,
|
|
||||||
onPressed: _clear,
|
|
||||||
child: const Text('Clear'),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget _list(BuildContext context, RunsController controller, Widget field) {
|
Widget _list(BuildContext context, RunsController controller, Widget field) {
|
||||||
return ListView(
|
return ListView(
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/app_popups.dart';
|
import '../../../ui/adaptive/app_popups.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||||
import '../../pipelines/pipeline_format.dart' show runStateLabel;
|
import '../../pipelines/pipeline_format.dart' show runStateLabel;
|
||||||
import 'runs_controller.dart';
|
import 'runs_controller.dart';
|
||||||
@@ -107,29 +105,6 @@ class RunsFilters extends StatelessWidget {
|
|||||||
({String label, VoidCallback clear}) entry,
|
({String label, VoidCallback clear}) entry,
|
||||||
) {
|
) {
|
||||||
final clearLabel = 'Clear filter: ${entry.label}';
|
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(
|
return InputChip(
|
||||||
label: Text(entry.label),
|
label: Text(entry.label),
|
||||||
onDeleted: entry.clear,
|
onDeleted: entry.clear,
|
||||||
@@ -147,7 +122,6 @@ class RunsBarActions {
|
|||||||
final RunsController controller;
|
final RunsController controller;
|
||||||
|
|
||||||
List<Widget> build(BuildContext context, {required VoidCallback onStats}) {
|
List<Widget> build(BuildContext context, {required VoidCallback onStats}) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final count =
|
final count =
|
||||||
controller.activeFilterCount + (controller.query.isEmpty ? 0 : 1);
|
controller.activeFilterCount + (controller.query.isEmpty ? 0 : 1);
|
||||||
final filterLabel = count > 0
|
final filterLabel = count > 0
|
||||||
@@ -156,46 +130,25 @@ class RunsBarActions {
|
|||||||
Widget icon(
|
Widget icon(
|
||||||
Key key,
|
Key key,
|
||||||
IconData material,
|
IconData material,
|
||||||
IconData ios,
|
|
||||||
String label,
|
String label,
|
||||||
VoidCallback onPressed, {
|
VoidCallback onPressed, {
|
||||||
bool active = false,
|
bool active = false,
|
||||||
bool anchorPopup = false,
|
bool anchorPopup = false,
|
||||||
}) {
|
}) {
|
||||||
final Widget button;
|
final button = Builder(
|
||||||
if (cupertino) {
|
builder: (buttonContext) => IconButton(
|
||||||
button = Semantics(
|
key: key,
|
||||||
button: true,
|
tooltip: label,
|
||||||
label: label,
|
isSelected: active,
|
||||||
excludeSemantics: true,
|
onPressed: anchorPopup ? () => _chooseSort(buttonContext) : onPressed,
|
||||||
child: CupertinoButton(
|
icon: Icon(material),
|
||||||
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),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// A narrow bar moves it into its More menu.
|
// A narrow bar moves it into its More menu.
|
||||||
return SegmentedOverflowAction(
|
return SegmentedOverflowAction(
|
||||||
overflowEntry: SegmentedOverflowEntry(
|
overflowEntry: SegmentedOverflowEntry(
|
||||||
label: label,
|
label: label,
|
||||||
icon: cupertino ? ios : material,
|
icon: material,
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
),
|
),
|
||||||
child: button,
|
child: button,
|
||||||
@@ -206,16 +159,12 @@ class RunsBarActions {
|
|||||||
icon(
|
icon(
|
||||||
const ValueKey('runs.stats'),
|
const ValueKey('runs.stats'),
|
||||||
Icons.insert_chart_outlined,
|
Icons.insert_chart_outlined,
|
||||||
CupertinoIcons.chart_pie,
|
|
||||||
'Usage and charts',
|
'Usage and charts',
|
||||||
onStats,
|
onStats,
|
||||||
),
|
),
|
||||||
icon(
|
icon(
|
||||||
const ValueKey('runs.filter'),
|
const ValueKey('runs.filter'),
|
||||||
count > 0 ? Icons.filter_alt : Icons.filter_alt_outlined,
|
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,
|
filterLabel,
|
||||||
() => showRunsFilterSheet(context, controller),
|
() => showRunsFilterSheet(context, controller),
|
||||||
active: count > 0,
|
active: count > 0,
|
||||||
@@ -223,7 +172,6 @@ class RunsBarActions {
|
|||||||
icon(
|
icon(
|
||||||
const ValueKey('runs.sort'),
|
const ValueKey('runs.sort'),
|
||||||
Icons.sort,
|
Icons.sort,
|
||||||
CupertinoIcons.arrow_up_arrow_down,
|
|
||||||
'Sort runs: ${runSortLabel(controller.sort)}',
|
'Sort runs: ${runSortLabel(controller.sort)}',
|
||||||
() => _chooseSort(context),
|
() => _chooseSort(context),
|
||||||
anchorPopup: true,
|
anchorPopup: true,
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import '../../../ui/motion/motion.dart';
|
import '../../../ui/motion/motion.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/layout/memo_subtree.dart';
|
import '../../../ui/layout/memo_subtree.dart';
|
||||||
import '../../attention/notify/notification_controller.dart';
|
import '../../attention/notify/notification_controller.dart';
|
||||||
import '../../attention/runtime/attention_controller.dart';
|
import '../../attention/runtime/attention_controller.dart';
|
||||||
@@ -146,9 +144,7 @@ class RunsList extends StatelessWidget {
|
|||||||
if (controller.loading && controller.runs.isEmpty) {
|
if (controller.loading && controller.runs.isEmpty) {
|
||||||
return _state(
|
return _state(
|
||||||
context,
|
context,
|
||||||
icon: usesCupertinoHost(context)
|
icon: const CircularProgressIndicator(),
|
||||||
? const CupertinoActivityIndicator()
|
|
||||||
: const CircularProgressIndicator(),
|
|
||||||
title: 'Loading runs…',
|
title: 'Loading runs…',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -174,11 +170,7 @@ class RunsList extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: _state(
|
child: _state(
|
||||||
context,
|
context,
|
||||||
icon: Icon(
|
icon: const Icon(Icons.inbox_outlined),
|
||||||
usesCupertinoHost(context)
|
|
||||||
? CupertinoIcons.tray
|
|
||||||
: Icons.inbox_outlined,
|
|
||||||
),
|
|
||||||
title: 'No runs found.',
|
title: 'No runs found.',
|
||||||
subtitle: 'Try changing or clearing the filters.',
|
subtitle: 'Try changing or clearing the filters.',
|
||||||
),
|
),
|
||||||
@@ -244,23 +236,11 @@ class RunsList extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
const Icon(Icons.error_outline),
|
||||||
usesCupertinoHost(context)
|
|
||||||
? CupertinoIcons.exclamationmark_triangle
|
|
||||||
: Icons.error_outline,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(controller.error!),
|
Text(controller.error!),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
usesCupertinoHost(context)
|
FilledButton(onPressed: controller.load, child: const Text('Retry')),
|
||||||
? CupertinoButton(
|
|
||||||
onPressed: controller.load,
|
|
||||||
child: const Text('Retry'),
|
|
||||||
)
|
|
||||||
: FilledButton(
|
|
||||||
onPressed: controller.load,
|
|
||||||
child: const Text('Retry'),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -288,9 +268,7 @@ class RunsList extends StatelessWidget {
|
|||||||
subtitle,
|
subtitle,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: usesCupertinoHost(context)
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -304,13 +282,7 @@ class RunsList extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: Text(controller.error!)),
|
Expanded(child: Text(controller.error!)),
|
||||||
if (usesCupertinoHost(context))
|
TextButton(onPressed: controller.load, child: const Text('Retry')),
|
||||||
CupertinoButton(
|
|
||||||
onPressed: controller.load,
|
|
||||||
child: const Text('Retry'),
|
|
||||||
)
|
|
||||||
else
|
|
||||||
TextButton(onPressed: controller.load, child: const Text('Retry')),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||||
import '../../../ui/layout/section_heading.dart';
|
import '../../../ui/layout/section_heading.dart';
|
||||||
import '../actions/delete_runs_action.dart';
|
import '../actions/delete_runs_action.dart';
|
||||||
@@ -25,39 +23,22 @@ ValueKey<String> runsDaySelectKey(String day) =>
|
|||||||
/// The Runs bar's `Select` action, entering multi-select.
|
/// The Runs bar's `Select` action, entering multi-select.
|
||||||
Widget runsSelectAction(BuildContext context, RunsController controller) {
|
Widget runsSelectAction(BuildContext context, RunsController controller) {
|
||||||
void enter() => controller.selection.enter();
|
void enter() => controller.selection.enter();
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
// A narrow bar moves it into its More menu.
|
// A narrow bar moves it into its More menu.
|
||||||
return SegmentedOverflowAction(
|
return SegmentedOverflowAction(
|
||||||
overflowEntry: SegmentedOverflowEntry(
|
overflowEntry: SegmentedOverflowEntry(
|
||||||
label: 'Select',
|
label: 'Select',
|
||||||
icon: cupertino ? CupertinoIcons.checkmark_circle : Icons.checklist,
|
icon: Icons.checklist,
|
||||||
onPressed: enter,
|
onPressed: enter,
|
||||||
),
|
),
|
||||||
child: cupertino
|
child: IconButton(
|
||||||
? _selectButtonCupertino(enter)
|
key: runsSelectKey,
|
||||||
: IconButton(
|
tooltip: 'Select',
|
||||||
key: runsSelectKey,
|
onPressed: enter,
|
||||||
tooltip: 'Select',
|
icon: const Icon(Icons.checklist),
|
||||||
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,
|
/// What the bar shows in select mode: `N selected` over the selection's size,
|
||||||
/// then Delete and Done.
|
/// then Delete and Done.
|
||||||
({String title, String? subtitle, List<Widget> actions}) runsSelectionBar(
|
({String title, String? subtitle, List<Widget> actions}) runsSelectionBar(
|
||||||
@@ -71,7 +52,6 @@ Widget _selectButtonCupertino(VoidCallback enter) => Semantics(
|
|||||||
];
|
];
|
||||||
final count = selected.length;
|
final count = selected.length;
|
||||||
final size = count == 0 ? null : runsSizeLabel(selected);
|
final size = count == 0 ? null : runsSizeLabel(selected);
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final delete = count == 0
|
final delete = count == 0
|
||||||
? null
|
? null
|
||||||
: () => confirmDeleteRuns(
|
: () => confirmDeleteRuns(
|
||||||
@@ -79,62 +59,32 @@ Widget _selectButtonCupertino(VoidCallback enter) => Semantics(
|
|||||||
runs: selected,
|
runs: selected,
|
||||||
gateway: controller.repository.gateway,
|
gateway: controller.repository.gateway,
|
||||||
onDeleted: controller.applyDeletion,
|
onDeleted: controller.applyDeletion,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
);
|
);
|
||||||
final deleteLabel = count == 0
|
final deleteLabel = count == 0
|
||||||
? 'Delete selected runs'
|
? 'Delete selected runs'
|
||||||
: 'Delete $count selected ${count == 1 ? 'run' : 'runs'}';
|
: 'Delete $count selected ${count == 1 ? 'run' : 'runs'}';
|
||||||
final List<Widget> actions;
|
final scheme = Theme.of(context).colorScheme;
|
||||||
if (cupertino) {
|
final actions = <Widget>[
|
||||||
actions = [
|
Semantics(
|
||||||
Semantics(
|
label: deleteLabel,
|
||||||
button: true,
|
excludeSemantics: true,
|
||||||
enabled: delete != null,
|
onTap: delete,
|
||||||
label: deleteLabel,
|
button: true,
|
||||||
excludeSemantics: true,
|
enabled: delete != null,
|
||||||
onTap: delete,
|
child: TextButton(
|
||||||
child: CupertinoButton(
|
key: runsDeleteSelectedKey,
|
||||||
key: runsDeleteSelectedKey,
|
style: TextButton.styleFrom(foregroundColor: scheme.error),
|
||||||
onPressed: delete,
|
onPressed: delete,
|
||||||
child: Text(
|
child: const Text('Delete'),
|
||||||
'Delete',
|
|
||||||
style: TextStyle(
|
|
||||||
color: delete == null
|
|
||||||
? null
|
|
||||||
: CupertinoColors.systemRed.resolveFrom(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
CupertinoButton(
|
),
|
||||||
key: runsSelectDoneKey,
|
TextButton(
|
||||||
onPressed: selection.exit,
|
key: runsSelectDoneKey,
|
||||||
child: const Text('Done'),
|
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'),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return (title: '$count selected', subtitle: size, actions: actions);
|
return (title: '$count selected', subtitle: size, actions: actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,15 +121,7 @@ class RunsDayHeading extends StatelessWidget {
|
|||||||
: '$text $label. No finished runs to select.',
|
: '$text $label. No finished runs to select.',
|
||||||
excludeSemantics: true,
|
excludeSemantics: true,
|
||||||
onTap: toggle,
|
onTap: toggle,
|
||||||
child: usesCupertinoHost(context)
|
child: TextButton(key: key, onPressed: toggle, child: Text(text)),
|
||||||
? 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)),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -205,7 +147,6 @@ class RunsDeleteReport extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final report = controller.selection.report;
|
final report = controller.selection.report;
|
||||||
if (report == null) return const SizedBox.shrink();
|
if (report == null) return const SizedBox.shrink();
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final dismiss = controller.selection.dismissReport;
|
final dismiss = controller.selection.dismissReport;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 8, 4),
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 8, 4),
|
||||||
@@ -218,18 +159,11 @@ class RunsDeleteReport extends StatelessWidget {
|
|||||||
child: Text(report, key: runsDeleteReportKey),
|
child: Text(report, key: runsDeleteReportKey),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
cupertino
|
TextButton(
|
||||||
? CupertinoButton(
|
key: runsDeleteReportDismissKey,
|
||||||
key: runsDeleteReportDismissKey,
|
onPressed: dismiss,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
child: const Text('Dismiss'),
|
||||||
onPressed: dismiss,
|
),
|
||||||
child: const Text('Dismiss'),
|
|
||||||
)
|
|
||||||
: TextButton(
|
|
||||||
key: runsDeleteReportDismissKey,
|
|
||||||
onPressed: dismiss,
|
|
||||||
child: const Text('Dismiss'),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import '../../../ui/adaptive/segmented_bar.dart';
|
import '../../../ui/adaptive/segmented_bar.dart';
|
||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/status/run_status_icon.dart';
|
import '../../../ui/status/run_status_icon.dart';
|
||||||
import '../domain/run_models.dart';
|
import '../domain/run_models.dart';
|
||||||
import '../../pipelines/pipeline_format.dart' show parseInstant, runStateLabel;
|
import '../../pipelines/pipeline_format.dart' show parseInstant, runStateLabel;
|
||||||
@@ -17,9 +15,7 @@ import 'runs_controller.dart';
|
|||||||
Future<void> openRunsStats(BuildContext context, RunsController controller) {
|
Future<void> openRunsStats(BuildContext context, RunsController controller) {
|
||||||
final page = RunsStatsPage(controller: controller);
|
final page = RunsStatsPage(controller: controller);
|
||||||
return Navigator.of(context).push<void>(
|
return Navigator.of(context).push<void>(
|
||||||
usesCupertinoHost(context)
|
MaterialPageRoute<void>(builder: (_) => page),
|
||||||
? CupertinoPageRoute<void>(builder: (_) => page)
|
|
||||||
: MaterialPageRoute<void>(builder: (_) => page),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,17 +28,10 @@ class RunsStatsPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final body = ListenableBuilder(
|
final body = ListenableBuilder(
|
||||||
listenable: controller,
|
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(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
appBar: const SegmentedBar(cupertino: false, title: 'Usage'),
|
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 runs = controller.runs;
|
||||||
final metrics = detailUsageMetrics(controller.usage);
|
final metrics = detailUsageMetrics(controller.usage);
|
||||||
final byState = <String, int>{};
|
final byState = <String, int>{};
|
||||||
@@ -60,14 +49,8 @@ class RunsStatsPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
final today = now?.call() ?? DateTime.now();
|
final today = now?.call() ?? DateTime.now();
|
||||||
final days = runsPerDay(runs, today);
|
final days = runsPerDay(runs, today);
|
||||||
final heading = TextStyle(
|
const heading = TextStyle(fontWeight: FontWeight.w600, fontSize: 17);
|
||||||
fontWeight: FontWeight.w600,
|
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||||
fontSize: 17,
|
|
||||||
color: cupertino ? CupertinoColors.label.resolveFrom(context) : null,
|
|
||||||
);
|
|
||||||
final secondary = cupertino
|
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
|
||||||
return ListView(
|
return ListView(
|
||||||
key: const ValueKey('runs.stats.page'),
|
key: const ValueKey('runs.stats.page'),
|
||||||
padding: withBarClearance(context, const EdgeInsets.all(16)),
|
padding: withBarClearance(context, const EdgeInsets.all(16)),
|
||||||
@@ -151,7 +134,7 @@ class RunsStatsPage extends StatelessWidget {
|
|||||||
style: TextStyle(color: secondary),
|
style: TextStyle(color: secondary),
|
||||||
)
|
)
|
||||||
else
|
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
|
/// 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.
|
/// count and its weekday underneath. Only drawn when some day has a run.
|
||||||
class _DaysChart extends StatelessWidget {
|
class _DaysChart extends StatelessWidget {
|
||||||
const _DaysChart({
|
const _DaysChart({required this.days, required this.secondary});
|
||||||
required this.days,
|
|
||||||
required this.cupertino,
|
|
||||||
required this.secondary,
|
|
||||||
});
|
|
||||||
|
|
||||||
final List<({String label, int count})> days;
|
final List<({String label, int count})> days;
|
||||||
final bool cupertino;
|
|
||||||
final Color secondary;
|
final Color secondary;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final most = days.map((d) => d.count).reduce(math.max);
|
final most = days.map((d) => d.count).reduce(math.max);
|
||||||
final bar = cupertino
|
final bar = Theme.of(context).colorScheme.primary;
|
||||||
? CupertinoTheme.of(context).primaryColor
|
final axis = Theme.of(context).colorScheme.outlineVariant;
|
||||||
: Theme.of(context).colorScheme.primary;
|
|
||||||
final axis = cupertino
|
|
||||||
? CupertinoColors.separator.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.outlineVariant;
|
|
||||||
return Column(
|
return Column(
|
||||||
key: const ValueKey('runs.stats.days'),
|
key: const ValueKey('runs.stats.days'),
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/application/app_session.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();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user