Add a hook to create a collage
This commit is contained in:
parent
68392fa8c6
commit
481443f547
1
lib/generated/intl/messages_en.dart
generated
1
lib/generated/intl/messages_en.dart
generated
|
@ -427,6 +427,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"createAccount": MessageLookupByLibrary.simpleMessage("Create account"),
|
||||
"createAlbumActionHint": MessageLookupByLibrary.simpleMessage(
|
||||
"Long press to select photos and click + to create an album"),
|
||||
"createCollage": MessageLookupByLibrary.simpleMessage("Create collage"),
|
||||
"createNewAccount":
|
||||
MessageLookupByLibrary.simpleMessage("Create new account"),
|
||||
"createOrSelectAlbum":
|
||||
|
|
10
lib/generated/l10n.dart
generated
10
lib/generated/l10n.dart
generated
|
@ -4855,6 +4855,16 @@ class S {
|
|||
);
|
||||
}
|
||||
|
||||
/// `Create collage`
|
||||
String get createCollage {
|
||||
return Intl.message(
|
||||
'Create collage',
|
||||
name: 'createCollage',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Add to ente`
|
||||
String get addToEnte {
|
||||
return Intl.message(
|
||||
|
|
|
@ -687,6 +687,7 @@
|
|||
"favorite": "Favorite",
|
||||
"removeFromFavorite": "Remove from favorite",
|
||||
"shareLink": "Share link",
|
||||
"createCollage": "Create collage",
|
||||
"addToEnte": "Add to ente",
|
||||
"addToAlbum": "Add to album",
|
||||
"delete": "Delete",
|
||||
|
|
|
@ -6,6 +6,7 @@ import "package:photos/generated/l10n.dart";
|
|||
import 'package:photos/models/collection.dart';
|
||||
import 'package:photos/models/device_collection.dart';
|
||||
import 'package:photos/models/file.dart';
|
||||
import "package:photos/models/file_type.dart";
|
||||
import 'package:photos/models/files_split.dart';
|
||||
import 'package:photos/models/gallery_type.dart';
|
||||
import "package:photos/models/metadata/common_keys.dart";
|
||||
|
@ -33,6 +34,9 @@ class FileSelectionActionWidget extends StatefulWidget {
|
|||
final DeviceCollection? deviceCollection;
|
||||
final SelectedFiles selectedFiles;
|
||||
|
||||
static const int collageItemsMin = 2;
|
||||
static const int collageItemsMax = 5;
|
||||
|
||||
const FileSelectionActionWidget(
|
||||
this.type,
|
||||
this.selectedFiles, {
|
||||
|
@ -135,6 +139,28 @@ class _FileSelectionActionWidgetState extends State<FileSelectionActionWidget> {
|
|||
}
|
||||
}
|
||||
|
||||
bool hasVideoFile = false;
|
||||
for (final file in widget.selectedFiles.files) {
|
||||
if (file.fileType == FileType.video) {
|
||||
hasVideoFile = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasVideoFile &&
|
||||
widget.selectedFiles.files.length >=
|
||||
FileSelectionActionWidget.collageItemsMin &&
|
||||
widget.selectedFiles.files.length <=
|
||||
FileSelectionActionWidget.collageItemsMax) {
|
||||
firstList.add(
|
||||
BlurMenuItemWidget(
|
||||
leadingIcon: Icons.grid_view_outlined,
|
||||
labelText: S.of(context).createCollage,
|
||||
menuItemColor: colorScheme.fillFaint,
|
||||
onTap: () {},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final showUploadIcon = widget.type == GalleryType.localFolder &&
|
||||
split.ownedByCurrentUser.isEmpty;
|
||||
if (widget.type.showAddToAlbum()) {
|
||||
|
|
Loading…
Reference in a new issue