π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix: make album sqaure and show file count
Aman Raj Singh Mouryaded497d421e7
diff --git a/mobile/lib/ui/collections/album/row_item.dart b/mobile/lib/ui/collections/album/row_item.dartindex faf6438f6b..05c825cfa8 100644--- a/mobile/lib/ui/collections/album/row_item.dart+++ b/mobile/lib/ui/collections/album/row_item.dart@@ -1,3 +1,4 @@+import "package:figma_squircle/figma_squircle.dart";import 'package:flutter/material.dart';import "package:intl/intl.dart";import "package:photos/core/configuration.dart";@@ -53,186 +54,192 @@ class AlbumRowItemWidget extends StatelessWidget {: null;return GestureDetector(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: <Widget>[- Stack(- children: [- ClipRRect(- borderRadius: BorderRadius.circular(1),- child: SizedBox(- height: sideOfThumbnail,- width: sideOfThumbnail,- child: Stack(- children: [- FutureBuilder<EnteFile?>(- future: CollectionsService.instance.getCover(c),- builder: (context, snapshot) {- EnteFile? thumbnail;- if (snapshot.hasData) {- thumbnail = snapshot.data!;- } else {- //Need to use cached thumbnail so that the hero- //animation works as expected.- thumbnail =- CollectionsService.instance.getCoverCache(c);- }- if (thumbnail != null) {- final bool isSelected =- selectedAlbums?.isAlbumSelected(c) ?? false;- final String heroTag = tagPrefix + thumbnail.tag;- final thumbnailWidget = ThumbnailWidget(- thumbnail,- shouldShowArchiveStatus: isOwner- ? c.isArchived()- : c.hasShareeArchived(),- showFavForAlbumOnly: true,- shouldShowSyncStatus: false,- shouldShowPinIcon: isOwner && c.isPinned,- key: Key(heroTag),- );- return Hero(- tag: heroTag,- transitionOnUserGestures: true,- child: isSelected- ? ColorFiltered(- colorFilter: ColorFilter.mode(- Colors.black.withOpacity(- 0.4,- ),- BlendMode.darken,- ),- child: thumbnailWidget,- )- : thumbnailWidget,- );- } else {- return const NoThumbnailWidget();- }- },- ),- if (isOwner && (c.hasSharees || c.hasLink))- Hero(- tag: tagPrefix + "_sharees",- transitionOnUserGestures: true,- child: Align(- alignment: Alignment.topLeft,- child: AlbumSharesIcons(- padding: const EdgeInsets.only(left: 4, top: 4),- sharees: c.getSharees(),- type: AvatarType.mini,- trailingWidget: linkIcon,- ),- ),- ),- Positioned(- top: 5,- right: 5,- child: Hero(- tag: tagPrefix + "_album_selection",- transitionOnUserGestures: true,- child: ListenableBuilder(- listenable: selectedAlbums ?? ValueNotifier(false),- builder: (context, _) {+ child: ClipSmoothRect(+ radius: SmoothBorderRadius(cornerRadius: 2.35, cornerSmoothing: 1),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: <Widget>[+ Stack(+ children: [+ ClipRRect(+ borderRadius: BorderRadius.circular(1),+ child: SizedBox(+ height: sideOfThumbnail,+ width: sideOfThumbnail,+ child: Stack(+ children: [+ FutureBuilder<EnteFile?>(+ future: CollectionsService.instance.getCover(c),+ builder: (context, snapshot) {+ EnteFile? thumbnail;+ if (snapshot.hasData) {+ thumbnail = snapshot.data!;+ } else {+ //Need to use cached thumbnail so that the hero+ //animation works as expected.+ thumbnail =+ CollectionsService.instance.getCoverCache(c);+ }+ if (thumbnail != null) {final bool isSelected =selectedAlbums?.isAlbumSelected(c) ?? false;- return AnimatedSwitcher(- duration: const Duration(milliseconds: 200),- switchInCurve: Curves.easeOut,- switchOutCurve: Curves.easeIn,+ final String heroTag = tagPrefix + thumbnail.tag;+ final thumbnailWidget = ThumbnailWidget(+ thumbnail,+ shouldShowArchiveStatus: isOwner+ ? c.isArchived()+ : c.hasShareeArchived(),+ showFavForAlbumOnly: true,+ shouldShowSyncStatus: false,+ shouldShowPinIcon: isOwner && c.isPinned,+ key: Key(heroTag),+ );+ return Hero(+ tag: heroTag,+ transitionOnUserGestures: true,child: isSelected- ? const Icon(- Icons.check_circle_rounded,- color: Colors.white,- size: 22,+ ? ColorFiltered(+ colorFilter: ColorFilter.mode(+ Colors.black.withOpacity(+ 0.4,+ ),+ BlendMode.darken,+ ),+ child: thumbnailWidget,)- : null,+ : thumbnailWidget,);- },- ),+ } else {+ return const NoThumbnailWidget();+ }+ },),- ),- if (!isOwner)- Align(- alignment: Alignment.bottomRight,- child: Hero(- tag: tagPrefix + "_owner_other",+ if (isOwner && (c.hasSharees || c.hasLink))+ Hero(+ tag: tagPrefix + "_sharees",transitionOnUserGestures: true,- child: Padding(- padding:- const EdgeInsets.only(right: 4, bottom: 4),- child: UserAvatarWidget(- c.owner,- thumbnailView: true,+ child: Align(+ alignment: Alignment.topLeft,+ child: AlbumSharesIcons(+ padding: const EdgeInsets.only(left: 4, top: 4),+ sharees: c.getSharees(),+ type: AvatarType.mini,+ trailingWidget: linkIcon,),),),+ Positioned(+ top: 5,+ right: 5,+ child: Hero(+ tag: tagPrefix + "_album_selection",+ transitionOnUserGestures: true,+ child: ListenableBuilder(+ listenable:+ selectedAlbums ?? ValueNotifier(false),+ builder: (context, _) {+ final bool isSelected =+ selectedAlbums?.isAlbumSelected(c) ?? false;+ return AnimatedSwitcher(+ duration: const Duration(milliseconds: 200),+ switchInCurve: Curves.easeOut,+ switchOutCurve: Curves.easeIn,+ child: isSelected+ ? const Icon(+ Icons.check_circle_rounded,+ color: Colors.white,+ size: 22,+ )+ : null,+ );+ },+ ),+ ),),- ],+ if (!isOwner)+ Align(+ alignment: Alignment.bottomRight,+ child: Hero(+ tag: tagPrefix + "_owner_other",+ transitionOnUserGestures: true,+ child: Padding(+ padding:+ const EdgeInsets.only(right: 4, bottom: 4),+ child: UserAvatarWidget(+ c.owner,+ thumbnailView: true,+ ),+ ),+ ),+ ),+ ],+ ),),),- ),- ],- ),- const SizedBox(height: 4),- Hero(- tag: tagPrefix + "_title",- transitionOnUserGestures: true,- child: SizedBox(- width: sideOfThumbnail,- child: FutureBuilder<int>(- future: showFileCount- ? CollectionsService.instance.getFileCount(c)- : Future.value(0),- builder: (context, snapshot) {- int? cachedCount;- if (showFileCount) {- if (snapshot.hasData) {- cachedCount = snapshot.data;- } else {- //Need to use cached count so that the hero- //animation works as expected without flickering.- cachedCount =- CollectionsService.instance.getCachedFileCount(c);+ ],+ ),+ const SizedBox(height: 4),+ Hero(+ tag: tagPrefix + "_title",+ transitionOnUserGestures: true,+ child: SizedBox(+ width: sideOfThumbnail,+ child: FutureBuilder<int>(+ future: showFileCount+ ? CollectionsService.instance.getFileCount(c)+ : Future.value(0),+ builder: (context, snapshot) {+ int? cachedCount;+ if (showFileCount) {+ if (snapshot.hasData) {+ cachedCount = snapshot.data;+ } else {+ //Need to use cached count so that the hero+ //animation works as expected without flickering.+ cachedCount =+ CollectionsService.instance.getCachedFileCount(c);+ }}- }- if (cachedCount != null && cachedCount > 0) {- final String textCount = NumberFormat().format(cachedCount);- return Row(- children: [- Container(- constraints: BoxConstraints(- maxWidth:- sideOfThumbnail - ((textCount.length + 3) * 10),- ),- child: Text(- c.displayName,- style: enteTextTheme.small,- overflow: TextOverflow.ellipsis,+ if (cachedCount != null && cachedCount > 0) {+ final String textCount =+ NumberFormat().format(cachedCount);+ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Container(+ constraints: BoxConstraints(+ maxWidth: sideOfThumbnail,+ ),+ child: Text(+ c.displayName,+ style: enteTextTheme.small,+ overflow: TextOverflow.ellipsis,+ ),),- ),- RichText(- text: TextSpan(- style: enteTextTheme.smallMuted,- children: [- TextSpan(text: ' \u2022 $textCount'),- ],+ const SizedBox(height: 2),+ RichText(+ text: TextSpan(+ style: enteTextTheme.tinyMuted,+ children: [+ TextSpan(text: textCount),+ ],+ ),),- ),- ],- );- } else {- return Text(- c.displayName,- style: enteTextTheme.small,- overflow: TextOverflow.ellipsis,- );- }- },+ ],+ );+ } else {+ return Text(+ c.displayName,+ style: enteTextTheme.small,+ overflow: TextOverflow.ellipsis,+ );+ }+ },+ ),),),- ),- ],+ ],+ ),),onTap: () async {if (onTapCallback != null) {diff --git a/mobile/lib/ui/collections/flex_grid_view.dart b/mobile/lib/ui/collections/flex_grid_view.dartindex ef7803808a..27051acfa0 100644--- a/mobile/lib/ui/collections/flex_grid_view.dart+++ b/mobile/lib/ui/collections/flex_grid_view.dart@@ -22,15 +22,15 @@ import "package:photos/utils/navigation_util.dart";class CollectionsFlexiGridViewWidget extends StatefulWidget {/*- Aspect ratio 1:1 Max width 224 Fixed gap 8- Width changes dynamically with screen width such that we can fit 2 in one row.+ Aspect ratio 1:1 Max width 224 Fixed gap 4+ Width changes dynamically with screen width such that we can fit 3 in one row.Keep the width integral (center the albums to distribute excess pixels)*/static const maxThumbnailWidth = 224.0;static const fixedGapBetweenAlbum = 4.0;static const minGapForHorizontalPadding = 8.0;static const collectionItemsToPreload = 20;-+ static const silverHorizontalPadding = 16.0;final List<Collection>? collections;// At max how many albums to displayfinal int displayLimitCount;@@ -130,9 +130,11 @@ class _CollectionsFlexiGridViewWidgetState.minGapForHorizontalPadding)) %albumsCountInOneRow;- final double sideOfThumbnail =- (screenWidth - gapOnSizeOfAlbums - gapBetweenAlbums) /- albumsCountInOneRow;+ final double sideOfThumbnail = (screenWidth -+ gapOnSizeOfAlbums -+ gapBetweenAlbums -+ CollectionsFlexiGridViewWidget.silverHorizontalPadding) /+ albumsCountInOneRow;final int totalCollections = widget.collections!.length;final bool showCreateAlbum = widget.shouldShowCreateAlbum;@@ -163,7 +165,6 @@ class _CollectionsFlexiGridViewWidgetStatesideOfThumbnail,tag: widget.tag,selectedAlbums: widget.selectedAlbums,- showFileCount: false,onTapCallback: (c) {isAnyAlbumSelected? _toggleAlbumSelection(c)@@ -184,7 +185,7 @@ class _CollectionsFlexiGridViewWidgetStatecrossAxisCount: albumsCountInOneRow,mainAxisSpacing: 2,crossAxisSpacing: gapBetweenAlbums,- childAspectRatio: sideOfThumbnail / (sideOfThumbnail + 46),+ childAspectRatio: sideOfThumbnail / (sideOfThumbnail + 56),),),);