|
@@ -1,3 +1,5 @@
|
|
|
|
+import "dart:async";
|
|
|
|
+
|
|
import 'package:fast_base58/fast_base58.dart';
|
|
import 'package:fast_base58/fast_base58.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter/services.dart';
|
|
@@ -132,18 +134,6 @@ class _FileSelectionActionsWidgetState
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- items.add(
|
|
|
|
- SelectionActionButton(
|
|
|
|
- labelText: S.of(context).share,
|
|
|
|
- icon: Icons.adaptive.share_outlined,
|
|
|
|
- onTap: () => shareSelected(
|
|
|
|
- context,
|
|
|
|
- shareButtonKey,
|
|
|
|
- widget.selectedFiles.files.toList(),
|
|
|
|
- ),
|
|
|
|
- ),
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
final showUploadIcon = widget.type == GalleryType.localFolder &&
|
|
final showUploadIcon = widget.type == GalleryType.localFolder &&
|
|
split.ownedByCurrentUser.isEmpty;
|
|
split.ownedByCurrentUser.isEmpty;
|
|
if (widget.type.showAddToAlbum()) {
|
|
if (widget.type.showAddToAlbum()) {
|
|
@@ -219,17 +209,6 @@ class _FileSelectionActionsWidgetState
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- if (widget.type.showDeleteOption()) {
|
|
|
|
- items.add(
|
|
|
|
- SelectionActionButton(
|
|
|
|
- icon: Icons.delete_outline,
|
|
|
|
- labelText: S.of(context).delete,
|
|
|
|
- onTap: anyOwnedFiles ? _onDeleteClick : null,
|
|
|
|
- shouldShow: ownedAndPendingUploadFilesCount > 0,
|
|
|
|
- ),
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (widget.type.showFavoriteOption()) {
|
|
if (widget.type.showFavoriteOption()) {
|
|
items.add(
|
|
items.add(
|
|
SelectionActionButton(
|
|
SelectionActionButton(
|
|
@@ -250,6 +229,26 @@ class _FileSelectionActionsWidgetState
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ items.add(
|
|
|
|
+ SelectionActionButton(
|
|
|
|
+ icon: Icons.grid_view_outlined,
|
|
|
|
+ labelText: S.of(context).createCollage,
|
|
|
|
+ onTap: _onCreateCollageClicked,
|
|
|
|
+ shouldShow: showCollageOption,
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ if (widget.type.showDeleteOption()) {
|
|
|
|
+ items.add(
|
|
|
|
+ SelectionActionButton(
|
|
|
|
+ icon: Icons.delete_outline,
|
|
|
|
+ labelText: S.of(context).delete,
|
|
|
|
+ onTap: anyOwnedFiles ? _onDeleteClick : null,
|
|
|
|
+ shouldShow: ownedAndPendingUploadFilesCount > 0,
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
if (widget.type.showHideOption()) {
|
|
if (widget.type.showHideOption()) {
|
|
items.add(
|
|
items.add(
|
|
SelectionActionButton(
|
|
SelectionActionButton(
|
|
@@ -311,10 +310,13 @@ class _FileSelectionActionsWidgetState
|
|
|
|
|
|
items.add(
|
|
items.add(
|
|
SelectionActionButton(
|
|
SelectionActionButton(
|
|
- icon: Icons.grid_view_outlined,
|
|
|
|
- labelText: S.of(context).createCollage,
|
|
|
|
- onTap: _onCreateCollageClicked,
|
|
|
|
- shouldShow: showCollageOption,
|
|
|
|
|
|
+ labelText: S.of(context).share,
|
|
|
|
+ icon: Icons.adaptive.share_outlined,
|
|
|
|
+ onTap: () => shareSelected(
|
|
|
|
+ context,
|
|
|
|
+ shareButtonKey,
|
|
|
|
+ widget.selectedFiles.files.toList(),
|
|
|
|
+ ),
|
|
),
|
|
),
|
|
);
|
|
);
|
|
|
|
|
|
@@ -500,9 +502,11 @@ class _FileSelectionActionsWidgetState
|
|
|
|
|
|
Future<void> _onCreatedSharedLinkClicked() async {
|
|
Future<void> _onCreatedSharedLinkClicked() async {
|
|
if (split.ownedByCurrentUser.isEmpty) {
|
|
if (split.ownedByCurrentUser.isEmpty) {
|
|
- showShortToast(
|
|
|
|
- context,
|
|
|
|
- S.of(context).canOnlyCreateLinkForFilesOwnedByYou,
|
|
|
|
|
|
+ unawaited(
|
|
|
|
+ showShortToast(
|
|
|
|
+ context,
|
|
|
|
+ S.of(context).canOnlyCreateLinkForFilesOwnedByYou,
|
|
|
|
+ ),
|
|
);
|
|
);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -545,7 +549,7 @@ class _FileSelectionActionsWidgetState
|
|
await _copyLink();
|
|
await _copyLink();
|
|
}
|
|
}
|
|
if (actionResult.action == ButtonAction.second) {
|
|
if (actionResult.action == ButtonAction.second) {
|
|
- routeToPage(
|
|
|
|
|
|
+ await routeToPage(
|
|
context,
|
|
context,
|
|
ManageSharedLinkWidget(collection: _cachedCollectionForSharedLink),
|
|
ManageSharedLinkWidget(collection: _cachedCollectionForSharedLink),
|
|
);
|
|
);
|
|
@@ -566,7 +570,7 @@ class _FileSelectionActionsWidgetState
|
|
final String url =
|
|
final String url =
|
|
"${_cachedCollectionForSharedLink!.publicURLs?.first?.url}#$collectionKey";
|
|
"${_cachedCollectionForSharedLink!.publicURLs?.first?.url}#$collectionKey";
|
|
await Clipboard.setData(ClipboardData(text: url));
|
|
await Clipboard.setData(ClipboardData(text: url));
|
|
- showShortToast(context, S.of(context).linkCopiedToClipboard);
|
|
|
|
|
|
+ unawaited(showShortToast(context, S.of(context).linkCopiedToClipboard));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|