Remove Cupertino branches from artifact features
Keep the Material implementation while preserving public parameters needed by callers. Remove Cupertino-only tests and variants because the app runs exclusively under MaterialApp.
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
|
||||
/// Open, Copy and the file actions float over the top of the content: shown
|
||||
/// when the page opens and whenever the content is touched, hidden again after
|
||||
/// a few seconds without use, so nothing needs scrolling to reach them.
|
||||
@@ -55,14 +52,9 @@ class _ArtifactControlsOverlayState extends State<ArtifactControlsOverlay> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final surface = cupertino
|
||||
? CupertinoColors.systemBackground
|
||||
.resolveFrom(context)
|
||||
.withValues(alpha: 0.92)
|
||||
: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94);
|
||||
final surface = Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94);
|
||||
return Stack(
|
||||
children: [
|
||||
// Any touch on the content brings the controls back.
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import '../../../ui/layout/section_heading.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_document.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import 'artifact_record_row.dart';
|
||||
@@ -50,23 +47,14 @@ class ArtifactDocumentSection extends StatelessWidget {
|
||||
children: rows,
|
||||
);
|
||||
}
|
||||
// Flat rows under a quiet label on both hosts: the section sits inside
|
||||
// the visit's Session page, which is itself flat, so a Cupertino inset
|
||||
// group here would be a group nested in a group.
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
// Flat rows under a quiet label: the section sits inside the visit's
|
||||
// Session page, which is itself flat.
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
header: true,
|
||||
child: Text(
|
||||
title,
|
||||
style: cupertino ? SectionHeadingStyle.of(context).title : null,
|
||||
),
|
||||
),
|
||||
child: Semantics(container: true, header: true, child: Text(title)),
|
||||
),
|
||||
...rows,
|
||||
],
|
||||
@@ -98,42 +86,15 @@ class _AbsentDocumentRow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!usesCupertinoHost(context)) {
|
||||
// The absence line is informational product content, so it keeps the
|
||||
// theme's normal secondary label colour. A disabled tile would paint both
|
||||
// lines at the disabled colour (about 2.7:1 in light mode); no `onTap`
|
||||
// keeps the row non-actionable without dimming it.
|
||||
return ListTile(
|
||||
title: Text(document.name),
|
||||
subtitle: Text(
|
||||
document.absence,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final textTheme = CupertinoTheme.of(context).textTheme;
|
||||
final absenceStyle = textTheme.textStyle.copyWith(
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
);
|
||||
return Semantics(
|
||||
container: true,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!,
|
||||
child: DefaultTextStyle.merge(
|
||||
style: textTheme.textStyle,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(document.name),
|
||||
Text(document.absence, style: absenceStyle),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// The absence line is informational product content, so it keeps the
|
||||
// theme's normal secondary label colour. A disabled tile would paint both
|
||||
// lines at the disabled colour (about 2.7:1 in light mode); no `onTap`
|
||||
// keeps the row non-actionable without dimming it.
|
||||
return ListTile(
|
||||
title: Text(document.name),
|
||||
subtitle: Text(
|
||||
document.absence,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,12 +30,13 @@ class ArtifactFullscreenScope extends InheritedWidget {
|
||||
/// The full-screen view's route, pushed on the root navigator so it covers
|
||||
/// the shell's bars and list pane. A full-screen dialog route: its bar shows
|
||||
/// the platform's Close, and the system back gesture leaves it.
|
||||
///
|
||||
/// [cupertino] is retained for callers that still pass it; the route is always
|
||||
/// the Material one.
|
||||
Route<void> artifactFullscreenRoute({
|
||||
required bool cupertino,
|
||||
required WidgetBuilder builder,
|
||||
}) => cupertino
|
||||
? CupertinoPageRoute<void>(fullscreenDialog: true, builder: builder)
|
||||
: MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
||||
}) => MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
||||
|
||||
/// The zoom factors Zoom in and Zoom out step through.
|
||||
const List<double> artifactHtmlZoomSteps = [
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import 'artifact_fullscreen.dart';
|
||||
|
||||
/// Lets a viewer page open its own content as the full-screen view.
|
||||
@@ -42,7 +41,7 @@ mixin ArtifactFullscreenHost<T extends StatefulWidget> on State<T> {
|
||||
if (_fullscreen != null) return;
|
||||
htmlZoom.value = 1;
|
||||
final route = artifactFullscreenRoute(
|
||||
cupertino: usesCupertinoHost(context),
|
||||
cupertino: false,
|
||||
builder: (_) => ArtifactFullscreenScope(
|
||||
htmlZoom: htmlZoom,
|
||||
child: ListenableBuilder(
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../core/transport/pipelines_client.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import 'artifact_external_open.dart';
|
||||
import 'artifact_gallery_page.dart';
|
||||
|
||||
@@ -58,14 +56,6 @@ class RunArtifactsButton extends StatelessWidget {
|
||||
executing: _runExecuting(run),
|
||||
configuredEndpoint: configuredGatewayEndpoint(gateway),
|
||||
);
|
||||
if (usesCupertinoHost(context)) {
|
||||
return CupertinoButton.tinted(
|
||||
sizeStyle: CupertinoButtonSize.small,
|
||||
key: runArtifactsButtonKey,
|
||||
onPressed: open,
|
||||
child: const Text(artifactGalleryTitle),
|
||||
);
|
||||
}
|
||||
return OutlinedButton.icon(
|
||||
key: runArtifactsButtonKey,
|
||||
onPressed: open,
|
||||
@@ -92,9 +82,7 @@ Future<void> showArtifactGallery(
|
||||
configuredEndpoint: configuredEndpoint,
|
||||
openExternal: openExternal,
|
||||
);
|
||||
return Navigator.of(context).push<void>(
|
||||
usesCupertinoHost(context)
|
||||
? CupertinoPageRoute<void>(builder: (_) => page)
|
||||
: MaterialPageRoute<void>(builder: (_) => page),
|
||||
);
|
||||
return Navigator.of(
|
||||
context,
|
||||
).push<void>(MaterialPageRoute<void>(builder: (_) => page));
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
||||
import '../../graph/domain/stage_visits.dart';
|
||||
import '../actions/artifact_file_actions.dart';
|
||||
@@ -289,29 +287,17 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
];
|
||||
final previousFocus = FocusManager.instance.primaryFocus;
|
||||
await Navigator.of(context).push<void>(
|
||||
usesCupertinoHost(context)
|
||||
? CupertinoPageRoute<void>(
|
||||
builder: (_) => ArtifactViewerPage(
|
||||
groups: viewerGroups,
|
||||
selectedIdentity: identity,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
openExternal: widget.openExternal,
|
||||
fetch: widget.fetch,
|
||||
markdownBuilder: widget.markdownBuilder,
|
||||
fileBridge: widget.fileBridge,
|
||||
),
|
||||
)
|
||||
: MaterialPageRoute<void>(
|
||||
builder: (_) => ArtifactViewerPage(
|
||||
groups: viewerGroups,
|
||||
selectedIdentity: identity,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
openExternal: widget.openExternal,
|
||||
fetch: widget.fetch,
|
||||
markdownBuilder: widget.markdownBuilder,
|
||||
fileBridge: widget.fileBridge,
|
||||
),
|
||||
),
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => ArtifactViewerPage(
|
||||
groups: viewerGroups,
|
||||
selectedIdentity: identity,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
openExternal: widget.openExternal,
|
||||
fetch: widget.fetch,
|
||||
markdownBuilder: widget.markdownBuilder,
|
||||
fileBridge: widget.fileBridge,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (!mounted) return;
|
||||
if (previousFocus != null && previousFocus.canRequestFocus) {
|
||||
@@ -350,32 +336,6 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
],
|
||||
],
|
||||
);
|
||||
if (usesCupertinoHost(context)) {
|
||||
return showCupertinoDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) => CupertinoAlertDialog(
|
||||
title: Text(artifactDisplayName(artifact)),
|
||||
content: content,
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('Close'),
|
||||
),
|
||||
if (resolved != null)
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => _copyLink(resolved, dialogContext),
|
||||
child: const Text('Copy link'),
|
||||
),
|
||||
if (resolved != null)
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () => _open(resolved, dialogContext),
|
||||
child: const Text('Open in browser'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
@@ -509,17 +469,11 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
/// one line per recorded fact, never clamped or shortened.
|
||||
Widget _header(BuildContext context, String summary, {Widget? action}) {
|
||||
final notes = _captureNotes();
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final textStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final headingStyle = cupertino
|
||||
? textStyle.copyWith(fontWeight: FontWeight.w600)
|
||||
: Theme.of(context).textTheme.titleSmall;
|
||||
final textStyle =
|
||||
Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final headingStyle = Theme.of(context).textTheme.titleSmall;
|
||||
final noteStyle = textStyle.copyWith(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||
@@ -557,33 +511,21 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
Widget _debugToggle(BuildContext context) {
|
||||
final showing = _showTurnDocuments;
|
||||
final label = showing ? 'Hide debugging files' : 'Show debugging files';
|
||||
// Cupertino's bundled icon font has no bug glyph; retain the universally
|
||||
// recognisable Material bug icon inside its native Cupertino button.
|
||||
final icon = showing ? Icons.bug_report : Icons.bug_report_outlined;
|
||||
void onPressed() => setState(() => _showTurnDocuments = !showing);
|
||||
final button = usesCupertinoHost(context)
|
||||
? CupertinoButton(
|
||||
key: const Key('artifact-debug-toggle'),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed,
|
||||
child: Icon(icon),
|
||||
)
|
||||
: IconButton(
|
||||
key: const Key('artifact-debug-toggle'),
|
||||
isSelected: showing,
|
||||
tooltip: label,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(icon),
|
||||
);
|
||||
final semanticButton = Semantics(
|
||||
final button = IconButton(
|
||||
key: const Key('artifact-debug-toggle'),
|
||||
isSelected: showing,
|
||||
tooltip: label,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(icon),
|
||||
);
|
||||
return Semantics(
|
||||
label: label,
|
||||
button: true,
|
||||
toggled: showing,
|
||||
child: button,
|
||||
);
|
||||
return usesCupertinoHost(context)
|
||||
? Tooltip(message: label, child: semanticButton)
|
||||
: semanticButton;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -617,18 +559,6 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
onRevealed: _revealed,
|
||||
);
|
||||
if (widget.embedded) return body;
|
||||
if (usesCupertinoHost(context)) {
|
||||
// Flat sections on the page colour, as in the run and stage details;
|
||||
// their pinned headings take the same colour.
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
title: artifactGalleryTitle,
|
||||
actions: [_debugToggle(context)],
|
||||
),
|
||||
child: SafeArea(top: false, bottom: false, child: body),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
import 'artifact_row_labels.dart';
|
||||
|
||||
/// One recorded artifact row in a gallery section.
|
||||
///
|
||||
/// Material draws a standard [ListTile]; Cupertino draws the same content in a
|
||||
/// grouped-row button. The row only reports the selection; it never resolves a
|
||||
/// url, opens a preview, downloads, shares or filters.
|
||||
/// Material draws a standard [ListTile]. The row only reports the selection; it
|
||||
/// never resolves a url, opens a preview, downloads, shares or filters.
|
||||
class ArtifactRecordRow extends StatelessWidget {
|
||||
const ArtifactRecordRow({
|
||||
super.key,
|
||||
@@ -31,58 +28,13 @@ class ArtifactRecordRow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!usesCupertinoHost(context)) {
|
||||
return ListTile(
|
||||
selected: selected,
|
||||
leading: leading,
|
||||
title: Text(artifactDisplayName(artifact)),
|
||||
subtitle: Text(artifactFactsLabel(artifact)),
|
||||
trailing: selected ? const Icon(Icons.check) : null,
|
||||
onTap: onSelected == null ? null : () => onSelected!(group, artifact),
|
||||
);
|
||||
}
|
||||
final textTheme = CupertinoTheme.of(context).textTheme;
|
||||
final factsStyle = textTheme.textStyle.copyWith(
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
);
|
||||
final content = DefaultTextStyle.merge(
|
||||
style: textTheme.textStyle,
|
||||
child: Row(
|
||||
children: [
|
||||
if (leading != null) ...[leading!, const SizedBox(width: 12)],
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(artifactDisplayName(artifact)),
|
||||
Text(artifactFactsLabel(artifact), style: factsStyle),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (selected) const Icon(CupertinoIcons.check_mark),
|
||||
],
|
||||
),
|
||||
);
|
||||
// `container` makes this row its own semantics node, so the section
|
||||
// heading stays a separate header node and never covers the row.
|
||||
return Semantics(
|
||||
container: true,
|
||||
return ListTile(
|
||||
selected: selected,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
// A read-only row is not a button: a disabled CupertinoButton would
|
||||
// still expose a button role to assistive technology.
|
||||
child: onSelected == null
|
||||
? Padding(
|
||||
padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!,
|
||||
child: content,
|
||||
)
|
||||
: CupertinoButton(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
onPressed: () => onSelected!(group, artifact),
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
leading: leading,
|
||||
title: Text(artifactDisplayName(artifact)),
|
||||
subtitle: Text(artifactFactsLabel(artifact)),
|
||||
trailing: selected ? const Icon(Icons.check) : null,
|
||||
onTap: onSelected == null ? null : () => onSelected!(group, artifact),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 '../../graph/domain/stage_visits.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
@@ -53,14 +51,10 @@ class ArtifactSelectionFacts extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final recordedStep = step;
|
||||
final url = resolved;
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final primaryStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final primaryStyle =
|
||||
Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final secondaryStyle = primaryStyle.copyWith(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_table.dart';
|
||||
|
||||
/// The truncation note for a capped table preview.
|
||||
@@ -31,13 +29,8 @@ class ArtifactTableView extends StatelessWidget {
|
||||
child: Text('The table is empty.'),
|
||||
);
|
||||
}
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final border = cupertino
|
||||
? CupertinoColors.separator.resolveFrom(context)
|
||||
: Theme.of(context).dividerColor;
|
||||
final header = cupertino
|
||||
? CupertinoColors.secondarySystemFill.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||
final border = Theme.of(context).dividerColor;
|
||||
final header = Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||
final columns = table.columnCount;
|
||||
Widget cell(String value, {bool head = false}) => Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../domain/artifact_kind.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
@@ -37,21 +35,12 @@ class ArtifactTile extends StatefulWidget {
|
||||
class _ArtifactTileState extends State<ArtifactTile> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final artifact = widget.artifact;
|
||||
final secondary = cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final surface = cupertino
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final surface = Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||
final border = widget.selected
|
||||
? (cupertino
|
||||
? CupertinoTheme.of(context).primaryColor
|
||||
: Theme.of(context).colorScheme.primary)
|
||||
: (cupertino
|
||||
? CupertinoColors.separator.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.outlineVariant);
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.outlineVariant;
|
||||
final preview = ArtifactThumbnail(
|
||||
artifact: artifact,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
@@ -102,20 +91,14 @@ class _ArtifactTileState extends State<ArtifactTile> {
|
||||
label: '$name, $facts',
|
||||
excludeSemantics: true,
|
||||
onTap: onSelected == null ? null : tap,
|
||||
child: cupertino
|
||||
? GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onSelected == null ? null : tap,
|
||||
child: decorated,
|
||||
)
|
||||
: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
onTap: onSelected == null ? null : tap,
|
||||
child: decorated,
|
||||
),
|
||||
),
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
onTap: onSelected == null ? null : tap,
|
||||
child: decorated,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -168,13 +151,10 @@ class _ArtifactThumbnailState extends State<ArtifactThumbnail>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final icon = Icon(
|
||||
artifactKindIcon(widget.artifact, cupertino: cupertino),
|
||||
artifactKindIcon(widget.artifact, cupertino: false),
|
||||
size: widget.iconSize,
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
if (_image == null) return Center(child: icon);
|
||||
return FutureBuilder<ArtifactFetchResult>(
|
||||
@@ -210,30 +190,26 @@ class _ArtifactThumbnailState extends State<ArtifactThumbnail>
|
||||
}
|
||||
|
||||
/// The icon for an artifact's kind of file, when it has no thumbnail.
|
||||
///
|
||||
/// [cupertino] is retained for callers that still pass it; the icon is always
|
||||
/// the Material glyph the app draws.
|
||||
IconData artifactKindIcon(ArtifactRecord artifact, {required bool cupertino}) {
|
||||
final name = artifact.name.toLowerCase();
|
||||
final format = artifactPreviewFormat(artifact.contentType, artifact.name);
|
||||
if (name.endsWith('.zip') || name.endsWith('.tar') || name.endsWith('.gz')) {
|
||||
return cupertino ? CupertinoIcons.archivebox : Icons.folder_zip_outlined;
|
||||
return Icons.folder_zip_outlined;
|
||||
}
|
||||
if (name.endsWith('.pdf')) {
|
||||
return cupertino ? CupertinoIcons.doc_richtext : Icons.picture_as_pdf;
|
||||
return Icons.picture_as_pdf;
|
||||
}
|
||||
return switch (format) {
|
||||
ArtifactPreviewFormat.image =>
|
||||
cupertino ? CupertinoIcons.photo : Icons.image_outlined,
|
||||
ArtifactPreviewFormat.video =>
|
||||
cupertino ? CupertinoIcons.film : Icons.movie_outlined,
|
||||
ArtifactPreviewFormat.audio =>
|
||||
cupertino ? CupertinoIcons.music_note : Icons.audio_file_outlined,
|
||||
ArtifactPreviewFormat.markdown =>
|
||||
cupertino ? CupertinoIcons.doc_text : Icons.article_outlined,
|
||||
ArtifactPreviewFormat.text =>
|
||||
cupertino ? CupertinoIcons.doc_plaintext : Icons.description_outlined,
|
||||
ArtifactPreviewFormat.table =>
|
||||
cupertino ? CupertinoIcons.table : Icons.table_chart_outlined,
|
||||
ArtifactPreviewFormat.html => cupertino ? CupertinoIcons.globe : Icons.html,
|
||||
ArtifactPreviewFormat.none =>
|
||||
cupertino ? CupertinoIcons.doc : Icons.insert_drive_file_outlined,
|
||||
ArtifactPreviewFormat.image => Icons.image_outlined,
|
||||
ArtifactPreviewFormat.video => Icons.movie_outlined,
|
||||
ArtifactPreviewFormat.audio => Icons.audio_file_outlined,
|
||||
ArtifactPreviewFormat.markdown => Icons.article_outlined,
|
||||
ArtifactPreviewFormat.text => Icons.description_outlined,
|
||||
ArtifactPreviewFormat.table => Icons.table_chart_outlined,
|
||||
ArtifactPreviewFormat.html => Icons.html,
|
||||
ArtifactPreviewFormat.none => Icons.insert_drive_file_outlined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
|
||||
/// Creates the player for one media url; tests inject a fake controller.
|
||||
typedef ArtifactVideoControllerFactory =
|
||||
VideoPlayerController Function(Uri uri);
|
||||
@@ -84,7 +81,6 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_failed) return const Center(child: Text(artifactVideoError));
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return ValueListenableBuilder<VideoPlayerValue>(
|
||||
valueListenable: _controller,
|
||||
builder: (context, value, _) {
|
||||
@@ -92,20 +88,12 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
||||
return const Center(child: Text(artifactVideoError));
|
||||
}
|
||||
if (!value.isInitialized) {
|
||||
return Center(
|
||||
child: cupertino
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(),
|
||||
);
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
final label = value.isPlaying
|
||||
? (widget.audio ? artifactAudioPauseLabel : artifactVideoPauseLabel)
|
||||
: (widget.audio ? artifactAudioPlayLabel : artifactVideoPlayLabel);
|
||||
final icon = cupertino
|
||||
? (value.isPlaying
|
||||
? CupertinoIcons.pause_fill
|
||||
: CupertinoIcons.play_fill)
|
||||
: (value.isPlaying ? Icons.pause : Icons.play_arrow);
|
||||
final icon = value.isPlaying ? Icons.pause : Icons.play_arrow;
|
||||
return Column(
|
||||
key: Key(widget.audio ? 'artifact-audio' : 'artifact-video'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -126,18 +114,12 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
cupertino
|
||||
? CupertinoButton(
|
||||
key: const Key('artifact-video-toggle'),
|
||||
onPressed: _toggle,
|
||||
child: Icon(icon, semanticLabel: label),
|
||||
)
|
||||
: IconButton(
|
||||
key: const Key('artifact-video-toggle'),
|
||||
tooltip: label,
|
||||
onPressed: _toggle,
|
||||
icon: Icon(icon),
|
||||
),
|
||||
IconButton(
|
||||
key: const Key('artifact-video-toggle'),
|
||||
tooltip: label,
|
||||
onPressed: _toggle,
|
||||
icon: Icon(icon),
|
||||
),
|
||||
Expanded(
|
||||
child: VideoProgressIndicator(
|
||||
_controller,
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/glass_bar.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/navigation/chevron_pager.dart';
|
||||
import '../actions/artifact_file_actions.dart';
|
||||
import '../actions/artifact_file_bridge.dart';
|
||||
@@ -60,11 +59,8 @@ class ArtifactViewerBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final actions = _actions(resolved, onFullscreen);
|
||||
final pagerMin = count > 1
|
||||
? 2 * GlassBarMetrics.controlExtent(cupertino)
|
||||
: 0.0;
|
||||
final pagerMin = count > 1 ? 2 * GlassBarMetrics.controlExtent(false) : 0.0;
|
||||
final pager = ChevronPager(
|
||||
index: index,
|
||||
count: count,
|
||||
@@ -87,7 +83,7 @@ class ArtifactViewerBar extends StatelessWidget {
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
heightFactor: 1,
|
||||
child: GlassControlBar(
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => Row(
|
||||
key: const Key('artifact-viewer-actions'),
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:typed_data';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../actions/artifact_file_actions.dart';
|
||||
import '../actions/artifact_file_bridge.dart';
|
||||
@@ -170,20 +169,6 @@ class ArtifactViewerInfoAction extends StatelessWidget {
|
||||
final Widget facts;
|
||||
|
||||
void _show(BuildContext context) {
|
||||
if (usesCupertinoHost(context)) {
|
||||
showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (context) => CupertinoPopupSurface(
|
||||
child: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: facts,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
showDragHandle: true,
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
|
||||
import '../domain/artifact_preview.dart';
|
||||
import 'artifact_html_view.dart';
|
||||
import 'artifact_table_view.dart';
|
||||
@@ -219,24 +216,12 @@ class _ZoomableImageState extends State<_ZoomableImage> {
|
||||
PositionedDirectional(
|
||||
top: 8,
|
||||
end: 8,
|
||||
child: usesCupertinoHost(context)
|
||||
? Tooltip(
|
||||
message: 'Reset image zoom',
|
||||
child: CupertinoButton(
|
||||
key: const Key('artifact-image-reset-zoom'),
|
||||
sizeStyle: CupertinoButtonSize.small,
|
||||
onPressed: _reset,
|
||||
child: const Icon(
|
||||
CupertinoIcons.arrow_down_right_arrow_up_left,
|
||||
),
|
||||
),
|
||||
)
|
||||
: IconButton(
|
||||
key: const Key('artifact-image-reset-zoom'),
|
||||
tooltip: 'Reset image zoom',
|
||||
onPressed: _reset,
|
||||
icon: const Icon(Icons.zoom_out_map),
|
||||
),
|
||||
child: IconButton(
|
||||
key: const Key('artifact-image-reset-zoom'),
|
||||
tooltip: 'Reset image zoom',
|
||||
onPressed: _reset,
|
||||
icon: const Icon(Icons.zoom_out_map),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -272,7 +257,6 @@ class _Message extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final retry = onRetry;
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -282,18 +266,11 @@ class _Message extends StatelessWidget {
|
||||
Text(message, textAlign: TextAlign.center),
|
||||
if (retry != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
cupertino
|
||||
? CupertinoButton.tinted(
|
||||
key: artifactPreviewRetryKey,
|
||||
sizeStyle: CupertinoButtonSize.small,
|
||||
onPressed: retry,
|
||||
child: const Text('Retry'),
|
||||
)
|
||||
: FilledButton.tonal(
|
||||
key: artifactPreviewRetryKey,
|
||||
onPressed: retry,
|
||||
child: const Text('Retry'),
|
||||
),
|
||||
FilledButton.tonal(
|
||||
key: artifactPreviewRetryKey,
|
||||
onPressed: retry,
|
||||
child: const Text('Retry'),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../../../ui/theme/app_theme.dart';
|
||||
|
||||
/// The viewer's page structure on either host: its [SegmentedBar] (the
|
||||
/// platform's Back, or Close on the full-screen route) over [body].
|
||||
/// The viewer's page structure: its [SegmentedBar] (the platform's Back, or
|
||||
/// Close on the full-screen route) over [body].
|
||||
class ArtifactViewerScaffold extends StatelessWidget {
|
||||
const ArtifactViewerScaffold({
|
||||
super.key,
|
||||
@@ -23,20 +20,12 @@ class ArtifactViewerScaffold extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final bar = SegmentedBar(
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
actions: actions,
|
||||
);
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
backgroundColor: AppColors.groupedBackground,
|
||||
navigationBar: bar,
|
||||
child: body,
|
||||
);
|
||||
}
|
||||
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../../../ui/layout/section_heading.dart';
|
||||
import '../../../ui/layout/sticky_section.dart';
|
||||
@@ -29,11 +27,10 @@ export 'artifact_row_labels.dart'
|
||||
/// artifacts. When [showTurnDocuments] is on, its debugging documents follow
|
||||
/// those artifacts in the same visit. Every recorded row shows its recorded
|
||||
/// filename, content type and size; a turn document the visit did not record
|
||||
/// stays a non-actionable row with the exact absence wording. Rendering uses the host's
|
||||
/// own controls: Material list tiles under [MaterialApp] and grouped Cupertino
|
||||
/// list sections under [CupertinoApp]. An optional [header] leads the same
|
||||
/// scroll view. It never resolves a url, opens a preview, downloads, shares or
|
||||
/// filters.
|
||||
/// stays a non-actionable row with the exact absence wording. Rendering uses
|
||||
/// the host's own controls: Material list tiles under [MaterialApp]. An
|
||||
/// optional [header] leads the same scroll view. It never resolves a url,
|
||||
/// opens a preview, downloads, shares or filters.
|
||||
/// How the gallery lays out each visit's artifacts.
|
||||
enum ArtifactGalleryMode { grid, list }
|
||||
|
||||
@@ -257,43 +254,24 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
||||
);
|
||||
|
||||
Widget _modeSwitch(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final control = cupertino
|
||||
? CupertinoSlidingSegmentedControl<ArtifactGalleryMode>(
|
||||
key: const Key('artifact-gallery-mode'),
|
||||
groupValue: _mode,
|
||||
onValueChanged: (mode) {
|
||||
if (mode != null) _setMode(mode);
|
||||
},
|
||||
children: const {
|
||||
ArtifactGalleryMode.grid: Icon(
|
||||
CupertinoIcons.square_grid_2x2,
|
||||
semanticLabel: 'Grid',
|
||||
),
|
||||
ArtifactGalleryMode.list: Icon(
|
||||
CupertinoIcons.list_bullet,
|
||||
semanticLabel: 'List',
|
||||
),
|
||||
},
|
||||
)
|
||||
: SegmentedButton<ArtifactGalleryMode>(
|
||||
key: const Key('artifact-gallery-mode'),
|
||||
showSelectedIcon: false,
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: ArtifactGalleryMode.grid,
|
||||
icon: Icon(Icons.grid_view),
|
||||
tooltip: 'Grid',
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ArtifactGalleryMode.list,
|
||||
icon: Icon(Icons.view_list),
|
||||
tooltip: 'List',
|
||||
),
|
||||
],
|
||||
selected: {_mode},
|
||||
onSelectionChanged: (mode) => _setMode(mode.single),
|
||||
);
|
||||
final control = SegmentedButton<ArtifactGalleryMode>(
|
||||
key: const Key('artifact-gallery-mode'),
|
||||
showSelectedIcon: false,
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: ArtifactGalleryMode.grid,
|
||||
icon: Icon(Icons.grid_view),
|
||||
tooltip: 'Grid',
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ArtifactGalleryMode.list,
|
||||
icon: Icon(Icons.view_list),
|
||||
tooltip: 'List',
|
||||
),
|
||||
],
|
||||
selected: {_mode},
|
||||
onSelectionChanged: (mode) => _setMode(mode.single),
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 4),
|
||||
child: Align(alignment: AlignmentDirectional.centerEnd, child: control),
|
||||
@@ -303,9 +281,7 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
||||
/// Rows keep a Material surface for their ink, as the section body's own
|
||||
/// surface was when it was one box around every row.
|
||||
Widget _inkSurface(BuildContext context, Widget child) =>
|
||||
usesCupertinoHost(context)
|
||||
? child
|
||||
: Material(type: MaterialType.transparency, child: child);
|
||||
Material(type: MaterialType.transparency, child: child);
|
||||
|
||||
/// The list view: one row per artifact with a small thumbnail beside it.
|
||||
Widget _list(ArtifactGroup group) => SliverList.builder(
|
||||
|
||||
Reference in New Issue
Block a user