Skip to content

armgit / ente

Public Imported from GitHub
0

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

Show sharing indicator

AmanRajSinghMourya16fe6b38fd8d
diff --git a/mobile/apps/locker/lib/ui/components/collection_list_widget.dart b/mobile/apps/locker/lib/ui/components/collection_list_widget.dart
index 790bb97279..63c0d3618d 100644
--- a/mobile/apps/locker/lib/ui/components/collection_list_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/collection_list_widget.dart
@@ -1,3 +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";
@@ -7,9 +9,11 @@ import "package:locker/l10n/l10n.dart";
import "package:locker/models/selected_collections.dart";
import "package:locker/services/collections/collections_service.dart";
import "package:locker/services/collections/models/collection.dart";
+import "package:locker/services/configuration.dart";
import "package:locker/ui/components/collection_popup_menu_widget.dart";
import "package:locker/ui/components/item_list_view.dart";
import "package:locker/ui/pages/collection_page.dart";
+import "package:locker/ui/sharing/album_share_info_widget.dart";
class CollectionListWidget extends StatelessWidget {
final Collection collection;
@@ -34,6 +38,14 @@ class CollectionListWidget extends StatelessWidget {
final textTheme = getEnteTextTheme(context);
final colorScheme = getEnteColorScheme(context);
final bool isFavourite = collection.type == CollectionType.favorites;
+ final bool hasSharees = collection.sharees.isNotEmpty;
+
+ final int? currentUserID = Configuration.instance.getUserID();
+ final bool isOwner =
+ currentUserID != null && collection.isOwner(currentUserID);
+ final bool isOutgoing = isOwner && hasSharees;
+ final bool isIncoming = !isOwner;
+ final bool showSharingIndicator = isOutgoing || isIncoming;
final collectionRowWidget = Flexible(
flex: 6,
@@ -42,26 +54,50 @@ class CollectionListWidget extends StatelessWidget {
SizedBox(
height: 60,
width: 60,
- child: Padding(
- padding: const EdgeInsets.all(10.0),
- child: Container(
- decoration: BoxDecoration(
- color: colorScheme.backgroundElevated,
- borderRadius: BorderRadius.circular(12),
- ),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: collection.type == CollectionType.favorites
- ? HugeIcon(
- icon: HugeIcons.strokeRoundedStar,
- color: colorScheme.primary700,
- )
- : HugeIcon(
- icon: HugeIcons.strokeRoundedWallet05,
- color: colorScheme.textBase,
- ),
+ child: Stack(
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(10.0),
+ child: Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: collection.type == CollectionType.favorites
+ ? HugeIcon(
+ icon: HugeIcons.strokeRoundedStar,
+ color: colorScheme.primary700,
+ )
+ : HugeIcon(
+ icon: HugeIcons.strokeRoundedWallet05,
+ color: colorScheme.textBase,
+ ),
+ ),
+ ),
),
- ),
+ 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),
@@ -132,31 +168,40 @@ class CollectionListWidget extends StatelessWidget {
collectionRowWidget,
isFavourite
? const SizedBox.shrink()
- : 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,
- )
- : CollectionPopupMenuWidget(
- collection: collection,
- overflowActions: overflowActions,
- child: Padding(
- padding: const EdgeInsets.all(12.0),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedMoreVertical,
- color: colorScheme.textBase,
+ : 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,
+ )
+ : hasSharees
+ ? Padding(
+ key: const ValueKey("sharees"),
+ padding: const EdgeInsets.only(right: 12.0),
+ child: _buildShareesAvatars(
+ collection.sharees
+ .whereType<User>()
+ .toList(),
+ ),
+ )
+ : CollectionPopupMenuWidget(
+ key: const ValueKey("menu"),
+ collection: collection,
+ overflowActions: overflowActions,
+ child: Padding(
+ padding: const EdgeInsets.all(12.0),
+ child: HugeIcon(
+ icon:
+ HugeIcons.strokeRoundedMoreVertical,
+ color: colorScheme.textBase,
+ ),
),
),
- ),
- ),
),
],
),
@@ -173,4 +218,31 @@ class CollectionListWidget extends StatelessWidget {
),
);
}
+
+ 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/ui/sharing/more_count_badge.dart b/mobile/apps/locker/lib/ui/sharing/more_count_badge.dart
index 78067c0a9b..bf8961f61a 100644
--- a/mobile/apps/locker/lib/ui/sharing/more_count_badge.dart
+++ b/mobile/apps/locker/lib/ui/sharing/more_count_badge.dart
@@ -1,4 +1,3 @@
-import "package:ente_ui/theme/colors.dart";
import "package:ente_ui/theme/ente_theme.dart";
import 'package:flutter/material.dart';
import 'package:tuple/tuple.dart';
@@ -21,23 +20,18 @@ class MoreCountWidget extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final displayChar = "+$count";
- final Color decorationColor = thumbnailView
- ? backgroundElevated2Light
- : colorScheme.backgroundElevated2;
+
+ final Color decorationColor = colorScheme.avatarColors[1];
final avatarStyle = getAvatarStyle(context, type);
final double size = avatarStyle.item1;
- final TextStyle textStyle = thumbnailView
- ? avatarStyle.item2.copyWith(color: textFaintLight)
- : avatarStyle.item2.copyWith(color: Colors.white);
+ final TextStyle textStyle = avatarStyle.item2.copyWith(color: Colors.white);
+
return Container(
- padding: const EdgeInsets.all(0.5),
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
- color: thumbnailView
- ? strokeMutedDark
- : getEnteColorScheme(context).strokeMuted,
+ color: getEnteColorScheme(context).backdropBase,
width: 1.0,
strokeAlign: BorderSide.strokeAlignOutside,
),
@@ -51,7 +45,6 @@ class MoreCountWidget extends StatelessWidget {
scale: 0.85,
child: Text(
displayChar.toUpperCase(),
- // fixed color
style: textStyle,
),
),
diff --git a/mobile/packages/sharing/lib/user_avator_widget.dart b/mobile/packages/sharing/lib/user_avator_widget.dart
index 6c85244aab..979cbf8005 100644
--- a/mobile/packages/sharing/lib/user_avator_widget.dart
+++ b/mobile/packages/sharing/lib/user_avator_widget.dart
@@ -1,7 +1,6 @@
import "package:ente_configuration/base_configuration.dart";
import "package:ente_sharing/extensions/user_extension.dart";
import "package:ente_sharing/models/user.dart";
-import "package:ente_ui/theme/colors.dart";
import "package:ente_ui/theme/ente_theme.dart";
import 'package:flutter/material.dart';
import 'package:tuple/tuple.dart';
@@ -33,28 +32,15 @@ class _UserAvatarWidgetState extends State<UserAvatarWidget> {
@override
Widget build(BuildContext context) {
final double size = getAvatarSize(widget.type);
- return Container(
- padding: const EdgeInsets.all(0.5),
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- border: Border.all(
- color: widget.thumbnailView
- ? strokeMutedDark
- : getEnteColorScheme(context).strokeMuted,
- width: UserAvatarWidget.strokeWidth,
- strokeAlign: BorderSide.strokeAlignOutside,
- ),
- ),
- child: SizedBox(
- height: size,
- width: size,
- child: _FirstLetterCircularAvatar(
- user: widget.user,
- currentUserID: widget.currentUserID,
- thumbnailView: widget.thumbnailView,
- type: widget.type,
- config: widget.config,
- ),
+ return SizedBox(
+ height: size,
+ width: size,
+ child: _FirstLetterCircularAvatar(
+ user: widget.user,
+ currentUserID: widget.currentUserID,
+ thumbnailView: widget.thumbnailView,
+ type: widget.type,
+ config: widget.config,
),
);
}
@@ -102,28 +88,15 @@ class _FirstLetterCircularAvatarState
final avatarStyle = getAvatarStyle(context, widget.type);
final double size = avatarStyle.item1;
final TextStyle textStyle = avatarStyle.item2;
- return Container(
- padding: const EdgeInsets.all(0.5),
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- border: Border.all(
- color: widget.thumbnailView
- ? strokeMutedDark
- : getEnteColorScheme(context).strokeMuted,
- width: UserAvatarWidget.strokeWidth,
- strokeAlign: BorderSide.strokeAlignOutside,
- ),
- ),
- child: SizedBox(
- height: size,
- width: size,
- child: CircleAvatar(
- backgroundColor: decorationColor,
- child: Text(
- displayChar.toUpperCase(),
- // fixed color
- style: textStyle.copyWith(color: Colors.white),
- ),
+ return SizedBox(
+ height: size,
+ width: size,
+ child: CircleAvatar(
+ backgroundColor: decorationColor,
+ child: Text(
+ displayChar.toUpperCase(),
+ // fixed color
+ style: textStyle.copyWith(color: Colors.white),
),
),
);