Sheets, decision options, usage, settings and artifact errors: review r2 batches H and L
Shared AppSheetHeader (title + Done) for the Runs filter/sort and Needs you sheets; Runs filter single-choice groups as check rows and statuses in sentence case; Cupertino decision options as a check list; run action sheet titled with the run; usage page without the duplicate title and with honest empty states; Settings Reconnect wording, compact notifications row and a tinted Cupertino Save workspace; friendly artifact preview failures with Retry.
This commit is contained in:
@@ -41,8 +41,12 @@ class ArtifactViewerBody extends StatelessWidget {
|
||||
this.bytes,
|
||||
this.error,
|
||||
this.status,
|
||||
this.onRetry,
|
||||
});
|
||||
|
||||
/// Loads the current page's preview again after a failure.
|
||||
final VoidCallback? onRetry;
|
||||
|
||||
final PagedArtifact page;
|
||||
final ArtifactPreviewPlan plan;
|
||||
final int index;
|
||||
@@ -76,6 +80,7 @@ class ArtifactViewerBody extends StatelessWidget {
|
||||
text: text,
|
||||
bytes: bytes,
|
||||
error: error,
|
||||
onRetry: onRetry,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
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';
|
||||
@@ -35,8 +38,12 @@ class ArtifactPreviewBody extends StatelessWidget {
|
||||
this.error,
|
||||
this.videoControllerFactory = defaultArtifactVideoController,
|
||||
this.htmlBuilder = defaultArtifactHtml,
|
||||
this.onRetry,
|
||||
});
|
||||
|
||||
/// Offered under a fetch failure; absent, the message stands alone.
|
||||
final VoidCallback? onRetry;
|
||||
|
||||
final ArtifactPreviewPlan plan;
|
||||
final bool loading;
|
||||
final ArtifactMarkdownBuilder markdownBuilder;
|
||||
@@ -60,7 +67,7 @@ class ArtifactPreviewBody extends StatelessWidget {
|
||||
return const _Loading();
|
||||
}
|
||||
if (error != null) {
|
||||
return _Message(error!);
|
||||
return _Message(error!, onRetry: onRetry);
|
||||
}
|
||||
switch (plan.kind) {
|
||||
case ArtifactPreviewKind.image:
|
||||
@@ -201,17 +208,42 @@ class _PreviewPadding extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
const artifactPreviewRetryKey = Key('artifact-preview-retry');
|
||||
|
||||
class _Message extends StatelessWidget {
|
||||
const _Message(this.message);
|
||||
const _Message(this.message, {this.onRetry});
|
||||
|
||||
final String message;
|
||||
final VoidCallback? onRetry;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final retry = onRetry;
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(message, textAlign: TextAlign.center),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
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'),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'artifact_selection_facts.dart';
|
||||
import '../actions/artifact_file_bridge.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../domain/artifact_preview.dart';
|
||||
import '../domain/artifact_preview_failure.dart';
|
||||
import '../domain/artifact_url.dart';
|
||||
import '../domain/gallery_navigation.dart';
|
||||
import 'artifact_external_open.dart';
|
||||
@@ -157,7 +158,7 @@ class _ArtifactViewerPageState extends State<ArtifactViewerPage> {
|
||||
if (!result.ok) {
|
||||
setState(() {
|
||||
_loading = false;
|
||||
_error = 'The server answered ${result.status}.';
|
||||
_error = artifactPreviewFailureMessage(status: result.status);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -168,11 +169,11 @@ class _ArtifactViewerPageState extends State<ArtifactViewerPage> {
|
||||
_fetched = fetched;
|
||||
});
|
||||
},
|
||||
onError: (Object error) {
|
||||
onError: (Object _) {
|
||||
if (!mounted || generation != _generation) return;
|
||||
setState(() {
|
||||
_loading = false;
|
||||
_error = 'Could not load preview: $error';
|
||||
_error = artifactPreviewFailureMessage();
|
||||
});
|
||||
},
|
||||
);
|
||||
@@ -259,6 +260,8 @@ class _ArtifactViewerPageState extends State<ArtifactViewerPage> {
|
||||
fileBridge: widget.fileBridge,
|
||||
onPrevious: () => _step(-1),
|
||||
onNext: () => _step(1),
|
||||
// A failure is never cached, so loading again fetches afresh.
|
||||
onRetry: _beginLoad,
|
||||
onOpen: plan.resolved == null ? () {} : () => _open(plan.resolved!),
|
||||
onCopy: plan.resolved == null ? () {} : () => _copy(plan.resolved!),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user