|
@@ -3,7 +3,6 @@ import "package:flutter/services.dart";
|
|
|
import "package:media_extension/media_extension.dart";
|
|
|
import "package:media_extension/media_extension_action_types.dart";
|
|
|
import "package:photos/core/constants.dart";
|
|
|
-import "package:photos/extensions/string_ext.dart";
|
|
|
import "package:photos/models/file.dart";
|
|
|
import "package:photos/models/selected_files.dart";
|
|
|
import "package:photos/services/app_lifecycle_service.dart";
|
|
@@ -39,16 +38,23 @@ class GalleryFileWidget extends StatelessWidget {
|
|
|
Widget build(BuildContext context) {
|
|
|
final isFileSelected = selectedFiles?.isFileSelected(file) ?? false;
|
|
|
Color selectionColor = Colors.white;
|
|
|
- if (isFileSelected &&
|
|
|
- file.isUploaded &&
|
|
|
- (file.ownerID != currentUserID ||
|
|
|
- file.pubMagicMetadata!.uploaderName != null)) {
|
|
|
+ if (isFileSelected && file.isUploaded && file.ownerID != currentUserID) {
|
|
|
final avatarColors = getEnteColorScheme(context).avatarColors;
|
|
|
- final int randomID = file.ownerID != currentUserID
|
|
|
- ? file.ownerID!
|
|
|
- : file.pubMagicMetadata!.uploaderName.sumAsciiValues;
|
|
|
- selectionColor = avatarColors[(randomID).remainder(avatarColors.length)];
|
|
|
+ selectionColor =
|
|
|
+ avatarColors[(file.ownerID!).remainder(avatarColors.length)];
|
|
|
}
|
|
|
+ final String heroTag = tag + file.tag;
|
|
|
+ final Widget thumbnailWidget = ThumbnailWidget(
|
|
|
+ file,
|
|
|
+ diskLoadDeferDuration: thumbnailDiskLoadDeferDuration,
|
|
|
+ serverLoadDeferDuration: thumbnailServerLoadDeferDuration,
|
|
|
+ shouldShowLivePhotoOverlay: true,
|
|
|
+ key: Key(heroTag),
|
|
|
+ thumbnailSize: photoGridSize < photoGridSizeDefault
|
|
|
+ ? thumbnailLargeSize
|
|
|
+ : thumbnailSmallSize,
|
|
|
+ shouldShowOwnerAvatar: !isFileSelected,
|
|
|
+ );
|
|
|
return GestureDetector(
|
|
|
onTap: () {
|
|
|
limitSelectionToOne
|
|
@@ -65,7 +71,7 @@ class GalleryFileWidget extends StatelessWidget {
|
|
|
ClipRRect(
|
|
|
borderRadius: BorderRadius.circular(1),
|
|
|
child: Hero(
|
|
|
- tag: tag + file.tag,
|
|
|
+ tag: heroTag,
|
|
|
child: isFileSelected
|
|
|
? ColorFiltered(
|
|
|
colorFilter: ColorFilter.mode(
|
|
@@ -74,30 +80,9 @@ class GalleryFileWidget extends StatelessWidget {
|
|
|
),
|
|
|
BlendMode.darken,
|
|
|
),
|
|
|
- child: ThumbnailWidget(
|
|
|
- file,
|
|
|
- diskLoadDeferDuration: thumbnailDiskLoadDeferDuration,
|
|
|
- serverLoadDeferDuration:
|
|
|
- thumbnailServerLoadDeferDuration,
|
|
|
- shouldShowLivePhotoOverlay: true,
|
|
|
- key: Key(tag + file.tag),
|
|
|
- thumbnailSize: photoGridSize < photoGridSizeDefault
|
|
|
- ? thumbnailLargeSize
|
|
|
- : thumbnailSmallSize,
|
|
|
- shouldShowOwnerAvatar: !isFileSelected,
|
|
|
- ),
|
|
|
+ child: thumbnailWidget,
|
|
|
)
|
|
|
- : ThumbnailWidget(
|
|
|
- file,
|
|
|
- diskLoadDeferDuration: thumbnailDiskLoadDeferDuration,
|
|
|
- serverLoadDeferDuration: thumbnailServerLoadDeferDuration,
|
|
|
- shouldShowLivePhotoOverlay: true,
|
|
|
- key: Key(tag + file.tag),
|
|
|
- thumbnailSize: photoGridSize < photoGridSizeDefault
|
|
|
- ? thumbnailLargeSize
|
|
|
- : thumbnailSmallSize,
|
|
|
- shouldShowOwnerAvatar: !isFileSelected,
|
|
|
- ),
|
|
|
+ : thumbnailWidget,
|
|
|
),
|
|
|
),
|
|
|
isFileSelected
|