π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refactor file and collection list widgets to enhance selection indicators and improve avatar display
AmanRajSinghMouryae779724ceb20
diff --git a/mobile/apps/locker/lib/ui/components/collection_list_widget.dart b/mobile/apps/locker/lib/ui/components/collection_list_widget.dartindex ec472368a6..3128c14568 100644--- a/mobile/apps/locker/lib/ui/components/collection_list_widget.dart+++ b/mobile/apps/locker/lib/ui/components/collection_list_widget.dart@@ -1,6 +1,5 @@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";@@ -165,25 +164,45 @@ class CollectionListWidget extends StatelessWidget {if (!isFavourite)Padding(padding: const EdgeInsets.only(right: 12.0),- child: AnimatedSwitcher(- duration: const Duration(milliseconds: 300),- switchInCurve: Curves.easeOut,- switchOutCurve: Curves.easeIn,- child: isSelected- ? IconButtonWidget(- key: const ValueKey("selected"),- icon: Icons.check_circle_rounded,- iconButtonType: IconButtonType.secondary,- iconColor: colorScheme.primary700,- )- : (showSharingIndicator && hasSharees)- ? _buildShareesAvatars(- collection.sharees.whereType<User>().toList(),- )- : const SizedBox(- key: ValueKey("unselected"),- width: 12,- ),+ child: SizedBox(+ width: 44,+ height: 24,+ child: AnimatedSwitcher(+ duration: const Duration(milliseconds: 300),+ switchInCurve: Curves.easeOut,+ switchOutCurve: Curves.easeIn,+ layoutBuilder: (currentChild, previousChildren) {+ return Stack(+ alignment: Alignment.centerRight,+ children: [+ ...previousChildren,+ if (currentChild != null) currentChild,+ ],+ );+ },+ child: isSelected+ ? Icon(+ key: const ValueKey("selected"),+ Icons.check_circle_rounded,+ color: colorScheme.primary700,+ size: 24,+ )+ : showSharingIndicator+ ? (isIncoming+ ? _buildOwnerAvatar(collection.owner)+ : (hasSharees+ ? _buildShareesAvatars(+ collection.sharees+ .whereType<User>()+ .toList(),+ )+ : const SizedBox(+ key: ValueKey("unselected"),+ )))+ : const SizedBox(+ key: ValueKey("unselected"),+ ),+ ),),),],@@ -202,6 +221,21 @@ class CollectionListWidget extends StatelessWidget {);}+ Widget _buildOwnerAvatar(User owner) {+ const double avatarSize = 24.0;++ return SizedBox(+ height: avatarSize,+ width: avatarSize,+ child: UserAvatarWidget(+ owner,+ type: AvatarType.mini,+ thumbnailView: true,+ config: Configuration.instance,+ ),+ );+ }+Widget _buildShareesAvatars(List<User> sharees) {if (sharees.isEmpty) {return const SizedBox.shrink();@@ -228,4 +262,5 @@ class CollectionListWidget extends StatelessWidget {),);}+}diff --git a/mobile/apps/locker/lib/ui/components/file_list_widget.dart b/mobile/apps/locker/lib/ui/components/file_list_widget.dartindex 62251ea86c..ba8c947d21 100644--- a/mobile/apps/locker/lib/ui/components/file_list_widget.dart+++ b/mobile/apps/locker/lib/ui/components/file_list_widget.dart@@ -1,6 +1,5 @@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";@@ -140,23 +139,41 @@ class FileListWidget extends StatelessWidget {fileRowWidget,Padding(padding: const EdgeInsets.only(right: 12.0),- child: AnimatedSwitcher(- duration: const Duration(milliseconds: 300),- switchInCurve: Curves.easeOut,- switchOutCurve: Curves.easeIn,- child: isSelected- ? IconButtonWidget(- key: const ValueKey("selected"),- icon: Icons.check_circle_rounded,- iconButtonType: IconButtonType.secondary,- iconColor: colorScheme.primary700,- )- : (showSharingIndicator && hasSharees)- ? _buildShareesAvatars(sharees)- : const SizedBox(- key: ValueKey("unselected"),- width: 12,- ),+ child: SizedBox(+ width: 44,+ height: 24,+ child: AnimatedSwitcher(+ duration: const Duration(milliseconds: 300),+ switchInCurve: Curves.easeOut,+ switchOutCurve: Curves.easeIn,+ layoutBuilder: (currentChild, previousChildren) {+ return Stack(+ alignment: Alignment.centerRight,+ children: [+ ...previousChildren,+ if (currentChild != null) currentChild,+ ],+ );+ },+ child: isSelected+ ? Icon(+ key: const ValueKey("selected"),+ Icons.check_circle_rounded,+ color: colorScheme.primary700,+ size: 24,+ )+ : showSharingIndicator+ ? (isIncoming+ ? _buildOwnerAvatar(collection.owner)+ : (hasSharees+ ? _buildShareesAvatars(sharees)+ : const SizedBox(+ key: ValueKey("unselected"),+ )))+ : const SizedBox(+ key: ValueKey("unselected"),+ ),+ ),),),],@@ -182,6 +199,21 @@ class FileListWidget extends StatelessWidget {return FileIconUtils.getFileIcon(file.displayName, showBackground: true);}+ Widget _buildOwnerAvatar(User owner) {+ const double avatarSize = 24.0;++ return SizedBox(+ height: avatarSize,+ width: avatarSize,+ child: UserAvatarWidget(+ owner,+ type: AvatarType.mini,+ thumbnailView: true,+ config: Configuration.instance,+ ),+ );+ }+Widget _buildShareesAvatars(List<User> sharees) {if (sharees.isEmpty) {return const SizedBox.shrink();