feat(app): artifact viewer actions are bottom icons; swipe pages; native download, share and open in browser
This commit is contained in:
@@ -56,5 +56,14 @@
|
|||||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||||
<data android:mimeType="text/plain"/>
|
<data android:mimeType="text/plain"/>
|
||||||
</intent>
|
</intent>
|
||||||
|
<!-- Artifact links open in the browser. -->
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<data android:scheme="https"/>
|
||||||
|
</intent>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<data android:scheme="http"/>
|
||||||
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -23,8 +23,12 @@ class ArtifactFileActions extends StatefulWidget {
|
|||||||
required this.resolved,
|
required this.resolved,
|
||||||
this.fetch = fetchArtifact,
|
this.fetch = fetchArtifact,
|
||||||
this.bridge = const ArtifactFileBridge(),
|
this.bridge = const ArtifactFileBridge(),
|
||||||
|
this.compact = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// Icon buttons only (a viewer's bottom bar): no labels and no notices.
|
||||||
|
final bool compact;
|
||||||
|
|
||||||
final ArtifactRecord artifact;
|
final ArtifactRecord artifact;
|
||||||
final ResolvedArtifactUrl resolved;
|
final ResolvedArtifactUrl resolved;
|
||||||
final ArtifactFetch fetch;
|
final ArtifactFetch fetch;
|
||||||
@@ -74,10 +78,12 @@ class _ArtifactFileActionsState extends State<ArtifactFileActions> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListenableBuilder(
|
return ListenableBuilder(
|
||||||
listenable: _controller,
|
listenable: _controller,
|
||||||
builder: (context, _) => _ActionBar(
|
builder: (context, _) => widget.compact
|
||||||
controller: _controller,
|
? _IconActions(controller: _controller)
|
||||||
cupertino: usesCupertinoHost(context),
|
: _ActionBar(
|
||||||
),
|
controller: _controller,
|
||||||
|
cupertino: usesCupertinoHost(context),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,3 +191,85 @@ class _ActionBar extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Download and Share as icon buttons; a spinner stands in for the one in
|
||||||
|
/// progress. A host that cannot download or share simply has no button.
|
||||||
|
class _IconActions extends StatelessWidget {
|
||||||
|
const _IconActions({required this.controller});
|
||||||
|
|
||||||
|
final ArtifactFileActionsController controller;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final busy = controller.busy;
|
||||||
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (controller.canDownload)
|
||||||
|
ArtifactIconAction(
|
||||||
|
key: const Key('artifact-download'),
|
||||||
|
label: 'Download',
|
||||||
|
icon: Icons.download_outlined,
|
||||||
|
cupertinoIcon: CupertinoIcons.arrow_down_to_line,
|
||||||
|
busy: busy,
|
||||||
|
onPressed: busy ? null : controller.download,
|
||||||
|
),
|
||||||
|
if (controller.canShare)
|
||||||
|
ArtifactIconAction(
|
||||||
|
key: const Key('artifact-share'),
|
||||||
|
label: 'Share',
|
||||||
|
icon: Icons.share_outlined,
|
||||||
|
cupertinoIcon: CupertinoIcons.share,
|
||||||
|
onPressed: busy ? null : controller.share,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One icon-only viewer action with its name as tooltip and accessible label.
|
||||||
|
class ArtifactIconAction extends StatelessWidget {
|
||||||
|
const ArtifactIconAction({
|
||||||
|
super.key,
|
||||||
|
required this.label,
|
||||||
|
required this.icon,
|
||||||
|
required this.cupertinoIcon,
|
||||||
|
required this.onPressed,
|
||||||
|
this.busy = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String label;
|
||||||
|
final IconData icon;
|
||||||
|
final IconData cupertinoIcon;
|
||||||
|
final VoidCallback? onPressed;
|
||||||
|
final bool busy;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (usesCupertinoHost(context)) {
|
||||||
|
return Semantics(
|
||||||
|
button: true,
|
||||||
|
label: label,
|
||||||
|
child: CupertinoButton(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
onPressed: onPressed,
|
||||||
|
child: busy
|
||||||
|
? const CupertinoActivityIndicator(radius: 9)
|
||||||
|
: Icon(cupertinoIcon),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return IconButton(
|
||||||
|
tooltip: label,
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
|
onPressed: onPressed,
|
||||||
|
icon: busy
|
||||||
|
? const SizedBox(
|
||||||
|
width: 18,
|
||||||
|
height: 18,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
|
)
|
||||||
|
: Icon(icon),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'artifact_file.dart';
|
import 'artifact_file.dart';
|
||||||
import 'artifact_transfer_stub.dart'
|
import 'artifact_transfer_stub.dart'
|
||||||
if (dart.library.js_interop) 'artifact_transfer_web.dart'
|
if (dart.library.js_interop) 'artifact_transfer_web.dart'
|
||||||
|
if (dart.library.io) 'artifact_transfer_io.dart'
|
||||||
as impl;
|
as impl;
|
||||||
|
|
||||||
/// The outcome of a host file transfer.
|
/// The outcome of a host file transfer.
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
|
import 'artifact_file.dart';
|
||||||
|
import 'artifact_transfer.dart';
|
||||||
|
|
||||||
|
/// Phones and desktops: Download asks where to save the exact bytes (the
|
||||||
|
/// system "Save as"), Share hands the named file to the share sheet.
|
||||||
|
bool get artifactDownloadSupported => true;
|
||||||
|
|
||||||
|
bool get artifactShareSupported => true;
|
||||||
|
|
||||||
|
String get artifactDownloadUnsupportedMessage => '';
|
||||||
|
|
||||||
|
String get artifactShareUnsupportedMessage => '';
|
||||||
|
|
||||||
|
Future<ArtifactTransferResult> saveArtifactFile(ArtifactFile file) async {
|
||||||
|
try {
|
||||||
|
final saved = await FilePicker.saveFile(
|
||||||
|
fileName: file.name,
|
||||||
|
bytes: file.bytes,
|
||||||
|
mimeType: file.mimeType,
|
||||||
|
);
|
||||||
|
if (saved == null) {
|
||||||
|
return const ArtifactTransferResult(ArtifactTransferState.canceled, '');
|
||||||
|
}
|
||||||
|
return ArtifactTransferResult(
|
||||||
|
ArtifactTransferState.saved,
|
||||||
|
'Saved ${file.name}.',
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
return ArtifactTransferResult(
|
||||||
|
ArtifactTransferState.failed,
|
||||||
|
'Could not save ${file.name}: $error',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<ArtifactTransferResult> shareArtifactFile(ArtifactFile file) async {
|
||||||
|
try {
|
||||||
|
final result = await SharePlus.instance.share(
|
||||||
|
ShareParams(
|
||||||
|
files: [XFile.fromData(file.bytes, mimeType: file.mimeType)],
|
||||||
|
fileNameOverrides: [file.name],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return result.status == ShareResultStatus.dismissed
|
||||||
|
? const ArtifactTransferResult(ArtifactTransferState.canceled, '')
|
||||||
|
: const ArtifactTransferResult(ArtifactTransferState.shared, '');
|
||||||
|
} catch (error) {
|
||||||
|
return ArtifactTransferResult(
|
||||||
|
ArtifactTransferState.failed,
|
||||||
|
'Could not share ${file.name}: $error',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import '../domain/artifact_url.dart';
|
import '../domain/artifact_url.dart';
|
||||||
import 'artifact_external_open_stub.dart'
|
import 'artifact_external_open_stub.dart'
|
||||||
if (dart.library.js_interop) 'artifact_external_open_web.dart'
|
if (dart.library.js_interop) 'artifact_external_open_web.dart'
|
||||||
|
if (dart.library.io) 'artifact_external_open_io.dart'
|
||||||
as impl;
|
as impl;
|
||||||
|
|
||||||
/// Opens an already validated artifact url with the host's external handler.
|
/// Opens an already validated artifact url with the host's external handler.
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
/// Phones and desktops: the link opens in the system browser, which renders
|
||||||
|
/// what it can and offers to download the rest.
|
||||||
|
Future<bool> openArtifactExternally(Uri uri) async {
|
||||||
|
try {
|
||||||
|
return await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,27 +62,10 @@ class ArtifactViewerBody extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final resolved = plan.resolved;
|
final resolved = plan.resolved;
|
||||||
final controls = <Widget>[
|
|
||||||
if (resolved != null && !resolved.external)
|
|
||||||
ArtifactFileActions(
|
|
||||||
key: ValueKey<String>(
|
|
||||||
'viewer-files-${page.group.stageKey}\u0000'
|
|
||||||
'${page.group.visit}\u0000${page.artifact.url}',
|
|
||||||
),
|
|
||||||
artifact: page.artifact,
|
|
||||||
resolved: resolved,
|
|
||||||
fetch: fetch,
|
|
||||||
bridge: fileBridge,
|
|
||||||
),
|
|
||||||
if (resolved != null)
|
|
||||||
_Actions(resolved: resolved, onOpen: onOpen, onCopy: onCopy),
|
|
||||||
];
|
|
||||||
final content = SingleChildScrollView(
|
final content = SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
// Room for the controls bar, so it never covers the first line.
|
|
||||||
if (controls.isNotEmpty) const SizedBox(height: 56),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||||
child: ArtifactSelectionFacts(
|
child: ArtifactSelectionFacts(
|
||||||
@@ -102,11 +85,6 @@ class ArtifactViewerBody extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (status != null)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 4),
|
|
||||||
child: Semantics(liveRegion: true, child: Text(status!)),
|
|
||||||
),
|
|
||||||
ArtifactPreviewBody(
|
ArtifactPreviewBody(
|
||||||
plan: plan,
|
plan: plan,
|
||||||
loading: loading,
|
loading: loading,
|
||||||
@@ -118,23 +96,60 @@ class ArtifactViewerBody extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
final hasPrevious = pagedIndex(index, -1, count) != index;
|
||||||
|
final hasNext = pagedIndex(index, 1, count) != index;
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: controls.isEmpty
|
// A horizontal swipe moves to the previous or next artifact.
|
||||||
? content
|
child: GestureDetector(
|
||||||
: ArtifactControlsOverlay(
|
key: const Key('artifact-viewer-swipe'),
|
||||||
key: ValueKey<String>('viewer-overlay-${page.artifact.url}'),
|
behavior: HitTestBehavior.translucent,
|
||||||
controls: controls,
|
onHorizontalDragEnd: (details) {
|
||||||
child: content,
|
final velocity = details.primaryVelocity ?? 0;
|
||||||
),
|
if (velocity < -250 && hasNext) onNext();
|
||||||
|
if (velocity > 250 && hasPrevious) onPrevious();
|
||||||
|
},
|
||||||
|
child: content,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
_Pager(
|
// Every action as an icon at the bottom, beside the pager.
|
||||||
index: index,
|
SafeArea(
|
||||||
count: count,
|
top: false,
|
||||||
onPrevious: onPrevious,
|
child: Padding(
|
||||||
onNext: onNext,
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
|
child: Row(
|
||||||
|
key: const Key('artifact-viewer-actions'),
|
||||||
|
children: [
|
||||||
|
if (resolved != null && !resolved.external)
|
||||||
|
ArtifactFileActions(
|
||||||
|
key: ValueKey<String>(
|
||||||
|
'viewer-files-${page.group.stageKey}\u0000'
|
||||||
|
'${page.group.visit}\u0000${page.artifact.url}',
|
||||||
|
),
|
||||||
|
artifact: page.artifact,
|
||||||
|
resolved: resolved,
|
||||||
|
fetch: fetch,
|
||||||
|
bridge: fileBridge,
|
||||||
|
compact: true,
|
||||||
|
),
|
||||||
|
if (resolved != null)
|
||||||
|
_Actions(resolved: resolved, onOpen: onOpen, onCopy: onCopy),
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
|
child: _Pager(
|
||||||
|
index: index,
|
||||||
|
count: count,
|
||||||
|
onPrevious: onPrevious,
|
||||||
|
onNext: onNext,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -263,40 +278,25 @@ class _Actions extends StatelessWidget {
|
|||||||
final VoidCallback onCopy;
|
final VoidCallback onCopy;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => Row(
|
||||||
if (usesCupertinoHost(context)) {
|
mainAxisSize: MainAxisSize.min,
|
||||||
return SafeArea(
|
children: [
|
||||||
top: false,
|
ArtifactIconAction(
|
||||||
child: Wrap(
|
key: const Key('artifact-open'),
|
||||||
alignment: WrapAlignment.center,
|
label: 'Open',
|
||||||
spacing: 8,
|
icon: Icons.open_in_new,
|
||||||
children: [
|
cupertinoIcon: CupertinoIcons.arrow_up_right_square,
|
||||||
CupertinoButton(onPressed: onOpen, child: const Text('Open')),
|
onPressed: onOpen,
|
||||||
CupertinoButton(onPressed: onCopy, child: const Text('Copy link')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return SafeArea(
|
|
||||||
top: false,
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
TextButton.icon(
|
|
||||||
onPressed: onOpen,
|
|
||||||
icon: const Icon(Icons.open_in_new),
|
|
||||||
label: const Text('Open'),
|
|
||||||
),
|
|
||||||
TextButton.icon(
|
|
||||||
onPressed: onCopy,
|
|
||||||
icon: const Icon(Icons.content_copy),
|
|
||||||
label: const Text('Copy link'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
ArtifactIconAction(
|
||||||
}
|
key: const Key('artifact-copy-link'),
|
||||||
|
label: 'Copy link',
|
||||||
|
icon: Icons.link,
|
||||||
|
cupertinoIcon: CupertinoIcons.link,
|
||||||
|
onPressed: onCopy,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const artifactPreviousKey = ValueKey<String>('artifact-previous');
|
const artifactPreviousKey = ValueKey<String>('artifact-previous');
|
||||||
@@ -320,18 +320,15 @@ class _Pager extends StatelessWidget {
|
|||||||
if (count <= 1) return const SizedBox.shrink();
|
if (count <= 1) return const SizedBox.shrink();
|
||||||
final hasPrevious = pagedIndex(index, -1, count) != index;
|
final hasPrevious = pagedIndex(index, -1, count) != index;
|
||||||
final hasNext = pagedIndex(index, 1, count) != index;
|
final hasNext = pagedIndex(index, 1, count) != index;
|
||||||
return SafeArea(
|
return ChevronPager(
|
||||||
top: false,
|
index: index,
|
||||||
child: ChevronPager(
|
count: count,
|
||||||
index: index,
|
previousLabel: 'Previous artifact',
|
||||||
count: count,
|
nextLabel: 'Next artifact',
|
||||||
previousLabel: 'Previous artifact',
|
previousKey: artifactPreviousKey,
|
||||||
nextLabel: 'Next artifact',
|
nextKey: artifactNextKey,
|
||||||
previousKey: artifactPreviousKey,
|
onPrevious: hasPrevious ? onPrevious : null,
|
||||||
nextKey: artifactNextKey,
|
onNext: hasNext ? onNext : null,
|
||||||
onPrevious: hasPrevious ? onPrevious : null,
|
|
||||||
onNext: hasNext ? onNext : null,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
# Generated by pub
|
# Generated by pub
|
||||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||||
packages:
|
packages:
|
||||||
|
android_file_picker:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: android_file_picker
|
||||||
|
sha256: e94229cc41c4bb5fb6a2254146340a8b650664c99b5c93b9001f66c3375d0060
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.1"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -57,6 +65,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.19.1"
|
version: "1.19.1"
|
||||||
|
cross_file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cross_file
|
||||||
|
sha256: f141ea4f277af142a0356955707f6556f37b03947d39d55585981a06ca437bd6
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.5+5"
|
||||||
crypto:
|
crypto:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -121,6 +137,54 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.1"
|
version: "7.0.1"
|
||||||
|
file_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: file_picker
|
||||||
|
sha256: "98c0b156b6380ba55bc767a14e2e6b3feb246e713ad40092424596fa79005bea"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "13.1.0"
|
||||||
|
file_picker_darwin:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_picker_darwin
|
||||||
|
sha256: ca2918264c453400c80ef0d69ca3f8b816f894db6144bebac73064ad64927e0e
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.3"
|
||||||
|
file_picker_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_picker_linux
|
||||||
|
sha256: c6562fc7d426db2fb85ea66fe2627953d2709932df5584ceaacf0aa5e39cf4da
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
|
file_picker_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_picker_platform_interface
|
||||||
|
sha256: "336e7168306834a2b68e6168ed768e00d3fabeac23154d5793e277ca9f97cf20"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.2.0"
|
||||||
|
file_picker_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_picker_web
|
||||||
|
sha256: a2288008280aabe371aff029466b3405e60838e0a1d714767488c59b926c8b8c
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.2.0"
|
||||||
|
fixnum:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: fixnum
|
||||||
|
sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.1"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -304,6 +368,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.18.0"
|
version: "1.18.0"
|
||||||
|
mime:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: mime
|
||||||
|
sha256: bd47de35f07e27267e69c8c8b22edf9473bfee170a60d60fcc93730c5144b7f6
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.0"
|
||||||
objective_c:
|
objective_c:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -440,6 +512,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.0"
|
version: "0.6.0"
|
||||||
|
share_plus:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: share_plus
|
||||||
|
sha256: db40767f130189d53f3ae8a6393c217ff4a492da1baff718a9873679c0c00224
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "13.3.1"
|
||||||
|
share_plus_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: share_plus_platform_interface
|
||||||
|
sha256: "365ef7379fc22507256adda3385152942ffce08935452bc972c2e52a0bebae41"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "7.2.0"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -565,6 +653,78 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.4.0"
|
||||||
|
url_launcher:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: url_launcher
|
||||||
|
sha256: e8cc955c97e06df9879140a1fe301f3d493f01b7c62dec7f46834be31d7e9fda
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.3.3"
|
||||||
|
url_launcher_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_android
|
||||||
|
sha256: "611e87fb320b70d1dd721dc46af89c98aceccea9b31fde49e084591414e0c610"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.3.33"
|
||||||
|
url_launcher_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_ios
|
||||||
|
sha256: "8faa1aab294f1ab4040b43660c887b0418d5fa4f0cffef76a484e6aa1092eb4a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.4.2"
|
||||||
|
url_launcher_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_linux
|
||||||
|
sha256: "10f86fef4c2c43563fa6c211ff9cf757adf4d3ab762c56bd430664a947d70cd0"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.3"
|
||||||
|
url_launcher_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_macos
|
||||||
|
sha256: "5e835a3b869c2d70325349c81c5a45c28e20791265b67b2669da6b08c5cd5201"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.2.6"
|
||||||
|
url_launcher_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_platform_interface
|
||||||
|
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.2"
|
||||||
|
url_launcher_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_web
|
||||||
|
sha256: "85c81589622fbc87c1c683aaea164d3604a7777495a79d91e39ffcdec39ddb34"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.4.3"
|
||||||
|
url_launcher_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: url_launcher_windows
|
||||||
|
sha256: "6c5ad3f22cd4c38e089b81963b3cd7bb83b111b2df5dce008bb066162f42e429"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.6"
|
||||||
|
uuid:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: uuid
|
||||||
|
sha256: "9b129329f58692f6e6578329498a8fe9fbe98f090beb764ffbb8ee2eadd01dcd"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.6.0"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -685,6 +845,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.4.0"
|
version: "6.4.0"
|
||||||
|
windows_file_picker:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: windows_file_picker
|
||||||
|
sha256: "18452aa293de3b6961c6d05b0e71b4be7bb90c67635abdd3aa5c4e75dd875072"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ dependencies:
|
|||||||
package_info_plus: ^10.2.2
|
package_info_plus: ^10.2.2
|
||||||
path_provider: ^2.1.6
|
path_provider: ^2.1.6
|
||||||
open_filex: ^5.0.0
|
open_filex: ^5.0.0
|
||||||
|
share_plus: ^13.3.1
|
||||||
|
file_picker: ^13.1.0
|
||||||
|
url_launcher: ^6.3.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -223,7 +223,11 @@ void main() {
|
|||||||
stage: 'review',
|
stage: 'review',
|
||||||
visit: 1,
|
visit: 1,
|
||||||
artifacts: <JsonMap>[
|
artifacts: <JsonMap>[
|
||||||
artifact('report.zip', contentType: 'application/zip', sizeBytes: 3),
|
artifact(
|
||||||
|
'report.zip',
|
||||||
|
contentType: 'application/zip',
|
||||||
|
sizeBytes: 3,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -262,6 +266,14 @@ void main() {
|
|||||||
artifact: _record,
|
artifact: _record,
|
||||||
resolved: resolveArtifactUrl(_endpoint, _record.url)!,
|
resolved: resolveArtifactUrl(_endpoint, _record.url)!,
|
||||||
fetch: _fetch,
|
fetch: _fetch,
|
||||||
|
bridge: const ArtifactFileBridge(
|
||||||
|
downloadSupported: false,
|
||||||
|
shareSupported: false,
|
||||||
|
downloadUnsupportedMessage:
|
||||||
|
'Downloading files is not supported on this platform yet.',
|
||||||
|
shareUnsupportedMessage:
|
||||||
|
'File sharing is not supported on this platform yet.',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -374,8 +386,8 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('Download'), findsOneWidget);
|
expect(find.byKey(const Key('artifact-download')), findsOneWidget);
|
||||||
expect(find.text('Share'), findsOneWidget);
|
expect(find.byKey(const Key('artifact-share')), findsOneWidget);
|
||||||
|
|
||||||
final externalGroup = visitGroup(artifacts: <ArtifactRecord>[external]);
|
final externalGroup = visitGroup(artifacts: <ArtifactRecord>[external]);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@@ -395,9 +407,9 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('Download'), findsNothing);
|
expect(find.byKey(const Key('artifact-download')), findsNothing);
|
||||||
expect(find.text('Share'), findsNothing);
|
expect(find.byKey(const Key('artifact-share')), findsNothing);
|
||||||
expect(find.text('Open'), findsOneWidget);
|
expect(find.byKey(const Key('artifact-open')), findsOneWidget);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -466,7 +466,10 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
expect(tester.getSize(find.byType(CustomScrollView)).height, greaterThan(0));
|
expect(
|
||||||
|
tester.getSize(find.byType(CustomScrollView)).height,
|
||||||
|
greaterThan(0),
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
find.text('12 files excluded from artifact capture.'),
|
find.text('12 files excluded from artifact capture.'),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
|
|||||||
@@ -150,10 +150,9 @@ void main() {
|
|||||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||||
// The gallery's thumbnail and the viewer read the same recorded file.
|
// The gallery's thumbnail and the viewer read the same recorded file.
|
||||||
expect(fetched, isNotEmpty);
|
expect(fetched, isNotEmpty);
|
||||||
expect(
|
expect(fetched.toSet(), {
|
||||||
fetched.toSet(),
|
Uri.parse('http://127.0.0.1:8081/artifacts/1/1/shot.png'),
|
||||||
{Uri.parse('http://127.0.0.1:8081/artifacts/1/1/shot.png')},
|
});
|
||||||
);
|
|
||||||
expect(find.byType(Image), findsOneWidget);
|
expect(find.byType(Image), findsOneWidget);
|
||||||
expect(find.text('1 of 1 · image/png'), findsOneWidget);
|
expect(find.text('1 of 1 · image/png'), findsOneWidget);
|
||||||
expect(find.text('image/png · 1.0\u00a0KiB'), findsOneWidget);
|
expect(find.text('image/png · 1.0\u00a0KiB'), findsOneWidget);
|
||||||
@@ -247,7 +246,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(fetched, isEmpty);
|
expect(fetched, isEmpty);
|
||||||
expect(find.byType(Image), findsNothing);
|
expect(find.byType(Image), findsNothing);
|
||||||
await tester.tap(find.text('Open'));
|
await tester.tap(find.byKey(const Key('artifact-open')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(opened, [Uri.parse('https://elsewhere.test/shot.png')]);
|
expect(opened, [Uri.parse('https://elsewhere.test/shot.png')]);
|
||||||
});
|
});
|
||||||
@@ -320,8 +319,8 @@ void main() {
|
|||||||
// The player streams the url itself; the viewer never fetches its bytes.
|
// The player streams the url itself; the viewer never fetches its bytes.
|
||||||
expect(find.byType(ArtifactVideoPlayer), findsOneWidget);
|
expect(find.byType(ArtifactVideoPlayer), findsOneWidget);
|
||||||
expect(find.text('This file type cannot be previewed here.'), findsNothing);
|
expect(find.text('This file type cannot be previewed here.'), findsNothing);
|
||||||
expect(find.text('Open'), findsOneWidget);
|
expect(find.byKey(const Key('artifact-open')), findsOneWidget);
|
||||||
expect(find.text('Copy link'), findsOneWidget);
|
expect(find.byKey(const Key('artifact-copy-link')), findsOneWidget);
|
||||||
expect(fetches, 0);
|
expect(fetches, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -523,6 +522,37 @@ void main() {
|
|||||||
expect(find.byType(Material), findsNothing);
|
expect(find.byType(Material), findsNothing);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('a swipe moves to the next and previous artifact', (
|
||||||
|
tester,
|
||||||
|
) async {
|
||||||
|
final first = recordedArtifact(
|
||||||
|
'a.png',
|
||||||
|
url: '/artifacts/1/1/a.png',
|
||||||
|
contentType: 'image/png',
|
||||||
|
);
|
||||||
|
final second = recordedArtifact(
|
||||||
|
'b.png',
|
||||||
|
url: '/artifacts/1/2/b.png',
|
||||||
|
contentType: 'image/png',
|
||||||
|
);
|
||||||
|
final groups = [
|
||||||
|
_group([first], visit: 1),
|
||||||
|
_group([second], visit: 2),
|
||||||
|
];
|
||||||
|
await _pumpViewer(
|
||||||
|
tester,
|
||||||
|
groups: groups,
|
||||||
|
selected: artifactVisitIdentity(groups[0], first),
|
||||||
|
);
|
||||||
|
final swipe = find.byKey(const Key('artifact-viewer-swipe'));
|
||||||
|
await tester.fling(swipe, const Offset(-300, 0), 1000);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.textContaining('2 of 2'), findsWidgets);
|
||||||
|
await tester.fling(swipe, const Offset(300, 0), 1000);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.textContaining('1 of 2'), findsWidgets);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('Material paging stays inside 320px at 2x text', (tester) async {
|
testWidgets('Material paging stays inside 320px at 2x text', (tester) async {
|
||||||
tester.view.physicalSize = const Size(640, 1200);
|
tester.view.physicalSize = const Size(640, 1200);
|
||||||
tester.view.devicePixelRatio = 2;
|
tester.view.devicePixelRatio = 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user