π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Improve performance of group building function by not eagerly computing each group header's title and instead, offload it to the GroupHeaderWidget to compute lazily when it's built
ashilknfd059613039d
diff --git a/mobile/lib/models/gallery/gallery_sections.dart b/mobile/lib/models/gallery/gallery_sections.dartindex 387d82c2d8..0901e3a445 100644--- a/mobile/lib/models/gallery/gallery_sections.dart+++ b/mobile/lib/models/gallery/gallery_sections.dart@@ -25,12 +25,10 @@ class GalleryGroups {final bool sortOrderAsc;final double widthAvailable;final double headerExtent;- final BuildContext context;GalleryGroups({required this.allFiles,required this.groupType,required this.widthAvailable,- required this.context,required this.selectedFiles,required this.tagPrefix,this.sortOrderAsc = true,@@ -102,7 +100,9 @@ class GalleryGroups {builder: (context, rowIndex) {if (rowIndex == firstIndex) {return GroupHeaderWidget(- title: _groupIdToHeaderDataMap[groupID]!.title,+ title: _groupIdToHeaderDataMap[groupID]!+ .groupType+ .getTitle(context, groupIDToFilesMap[groupID]!.first),gridSize: crossAxisCount,);} else {@@ -205,21 +205,15 @@ class GalleryGroups {_groupIds.add(uuid);_groupIdToFilesMap[uuid] = dailyFiles;_groupIdToHeaderDataMap[uuid] = GroupHeaderData(- title: groupType.getTitle(- context,- dailyFiles.first,- ),groupType: groupType,);}}class GroupHeaderData {- final String title;final GroupType groupType;GroupHeaderData({- required this.title,required this.groupType,});}diff --git a/mobile/lib/ui/viewer/gallery/gallery.dart b/mobile/lib/ui/viewer/gallery/gallery.dartindex 003c0eb13a..fa27556469 100644--- a/mobile/lib/ui/viewer/gallery/gallery.dart+++ b/mobile/lib/ui/viewer/gallery/gallery.dart@@ -418,6 +418,7 @@ class GalleryState extends State<Gallery> {child: Scrollbar(interactive: true,child: CustomScrollView(+ // physics: const BouncingScrollPhysics(),slivers: [FutureBuilder(future: headerExtent,@@ -428,7 +429,6 @@ class GalleryState extends State<Gallery> {allFiles: _allGalleryFiles,groupType: widget.groupType,widthAvailable: MediaQuery.sizeOf(context).width,- context: context,selectedFiles: widget.selectedFiles,tagPrefix: widget.tagPrefix,headerExtent: snapshot.data!,