Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Enhance file sharing indicators and adjust icon sizes

AmanRajSinghMourya72fa28f9a6c9
diff --git a/mobile/apps/locker/lib/ui/components/file_list_widget.dart b/mobile/apps/locker/lib/ui/components/file_list_widget.dart
index 8bc03f7bf9..cb16e40a76 100644
--- a/mobile/apps/locker/lib/ui/components/file_list_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/file_list_widget.dart
@@ -1,13 +1,17 @@
+import "package:ente_sharing/models/user.dart";
+import "package:ente_sharing/user_avator_widget.dart";
import "package:ente_ui/components/buttons/icon_button_widget.dart";
import "package:ente_ui/theme/ente_theme.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:locker/models/selected_files.dart";
+import "package:locker/services/collections/collections_service.dart";
import "package:locker/services/configuration.dart";
import "package:locker/services/files/sync/models/file.dart";
import "package:locker/services/info_file_service.dart";
import "package:locker/ui/components/file_popup_menu_widget.dart";
import "package:locker/ui/components/item_list_view.dart";
+import "package:locker/ui/sharing/album_share_info_widget.dart";
import "package:locker/utils/file_icon_utils.dart";
import "package:locker/utils/file_util.dart";
import "package:locker/utils/info_item_utils.dart";
@@ -40,15 +44,56 @@ class FileListWidget extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
+ final collection = file.collectionID != null
+ ? CollectionService.instance.getFromCache(file.collectionID!)
+ : null;
+
+ final int? currentUserID = Configuration.instance.getUserID();
+ final bool isOwner = collection != null &&
+ currentUserID != null &&
+ collection.isOwner(currentUserID);
+ final List<User> sharees =
+ collection?.sharees.whereType<User>().toList() ?? const [];
+ final bool hasSharees = sharees.isNotEmpty;
+ final bool isOutgoing = isOwner && hasSharees;
+ final bool isIncoming = collection != null && !isOwner;
+ final bool showSharingIndicator = isOutgoing || isIncoming;
+
final fileRowWidget = Flexible(
flex: 6,
child: Row(
children: [
- Container(
- padding: const EdgeInsets.all(10.0),
+ SizedBox(
height: 60,
width: 60,
- child: _buildFileIcon(),
+ child: Stack(
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(10.0),
+ child: _buildFileIcon(),
+ ),
+ if (showSharingIndicator)
+ Positioned(
+ right: 1,
+ bottom: 10,
+ child: Container(
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: colorScheme.backdropBase,
+ ),
+ padding: const EdgeInsets.all(1.0),
+ child: HugeIcon(
+ icon: isOutgoing
+ ? HugeIcons.strokeRoundedCircleArrowUpRight
+ : HugeIcons.strokeRoundedCircleArrowDownLeft,
+ strokeWidth: 2.0,
+ color: colorScheme.primary700,
+ size: 16.0,
+ ),
+ ),
+ ),
+ ],
+ ),
),
const SizedBox(width: 12),
Flexible(
@@ -103,33 +148,38 @@ class FileListWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
fileRowWidget,
- Flexible(
- flex: 1,
- child: AnimatedSwitcher(
- duration: const Duration(milliseconds: 200),
- switchInCurve: Curves.easeOut,
- switchOutCurve: Curves.easeIn,
- child: isSelected
- ? IconButtonWidget(
- key: const ValueKey("selected"),
- icon: Icons.check_circle_rounded,
- iconButtonType: IconButtonType.secondary,
- iconColor: colorScheme.primary700,
- )
- : _isFileOwnedByUser
- ? FilePopupMenuWidget(
- file: file,
- overflowActions: overflowActions,
- child: Padding(
- padding: const EdgeInsets.all(12.0),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedMoreVertical,
- color: getEnteColorScheme(context).textBase,
+ Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (showSharingIndicator && hasSharees)
+ _buildShareesAvatars(sharees),
+ AnimatedSwitcher(
+ duration: const Duration(milliseconds: 200),
+ switchInCurve: Curves.easeOut,
+ switchOutCurve: Curves.easeIn,
+ child: isSelected
+ ? IconButtonWidget(
+ key: const ValueKey("selected"),
+ icon: Icons.check_circle_rounded,
+ iconButtonType: IconButtonType.secondary,
+ iconColor: colorScheme.primary700,
+ )
+ : _isFileOwnedByUser
+ ? FilePopupMenuWidget(
+ file: file,
+ overflowActions: overflowActions,
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedMoreVertical,
+ color:
+ getEnteColorScheme(context).textBase,
+ ),
),
- ),
- )
- : const SizedBox(width: 48),
- ),
+ )
+ : const SizedBox(width: 48),
+ ),
+ ],
),
],
),
@@ -140,7 +190,6 @@ class FileListWidget extends StatelessWidget {
}
Widget _buildFileIcon() {
- // Check if this is an info file
if (InfoFileService.instance.isInfoFile(file)) {
try {
final infoItem = InfoFileService.instance.extractInfoFromFile(file);
@@ -152,7 +201,33 @@ class FileListWidget extends StatelessWidget {
}
}
- // For non-info files or if extraction fails, use the original logic
return FileIconUtils.getFileIcon(file.displayName, showBackground: true);
}
+
+ Widget _buildShareesAvatars(List<User> sharees) {
+ if (sharees.isEmpty) {
+ return const SizedBox.shrink();
+ }
+
+ const int limitCountTo = 1;
+ const double avatarSize = 24.0;
+ const double overlapPadding = 20.0;
+
+ final hasMore = sharees.length > limitCountTo;
+
+ final double totalWidth =
+ hasMore ? avatarSize + overlapPadding : avatarSize;
+
+ return SizedBox(
+ height: avatarSize,
+ width: totalWidth,
+ child: AlbumSharesIcons(
+ sharees: sharees,
+ padding: EdgeInsets.zero,
+ limitCountTo: limitCountTo,
+ type: AvatarType.mini,
+ removeBorder: true,
+ ),
+ );
+ }
}
diff --git a/mobile/apps/locker/lib/utils/file_icon_utils.dart b/mobile/apps/locker/lib/utils/file_icon_utils.dart
index cd6284c47b..948091023e 100644
--- a/mobile/apps/locker/lib/utils/file_icon_utils.dart
+++ b/mobile/apps/locker/lib/utils/file_icon_utils.dart
@@ -73,7 +73,7 @@ class FileIconUtils {
static Widget getFileIcon(
String fileName, {
bool showBackground = true,
- double size = 20,
+ double size = 24,
}) {
final config = _getFileConfig(fileName);
diff --git a/mobile/apps/locker/lib/utils/info_item_utils.dart b/mobile/apps/locker/lib/utils/info_item_utils.dart
index b15516c99b..a34d3b782a 100644
--- a/mobile/apps/locker/lib/utils/info_item_utils.dart
+++ b/mobile/apps/locker/lib/utils/info_item_utils.dart
@@ -46,7 +46,7 @@ class InfoItemUtils {
static Widget getInfoIcon(
InfoType type, {
bool showBackground = true,
- double size = 20,
+ double size = 24,
}) {
final config = _getInfoConfig(type);