π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refactor + add header and footer of gallery
ashilkn8a0f61a1c7ca
diff --git a/mobile/lib/models/gallery/gallery_sections.dart b/mobile/lib/models/gallery/gallery_sections.dartindex a2f13e53da..3cb3ced28b 100644--- a/mobile/lib/models/gallery/gallery_sections.dart+++ b/mobile/lib/models/gallery/gallery_sections.dart@@ -38,35 +38,30 @@ class GalleryGroups {init();}+ static const double spacing = 2.0;++ late final int crossAxisCount;+ late final List<FixedExtentSectionLayout> _groupLayouts;+final List<String> _groupIds = [];final Map<String, List<EnteFile>> _groupIdToFilesMap = {};final Map<String, GroupHeaderData> _groupIdToHeaderDataMap = {};- late final int crossAxisCount;final currentUserID = Configuration.instance.getUserID();- static const double spacing = 2.0;+ final _uuid = const Uuid();List<String> get groupIDs => _groupIds;Map<String, List<EnteFile>> get groupIDToFilesMap => _groupIdToFilesMap;Map<String, GroupHeaderData> get groupIdToheaderDataMap =>_groupIdToHeaderDataMap;-- final _uuid = const Uuid();+ List<FixedExtentSectionLayout> get groupLayouts => _groupLayouts;void init() {- final stopwatch = Stopwatch()..start();_buildGroups();- _logger.info(- "Built ${_groupIds.length} groups in ${stopwatch.elapsedMilliseconds} ms",- );- print(- "Built ${_groupIds.length} groups in ${stopwatch.elapsedMilliseconds} ms",- );- stopwatch.stop();-crossAxisCount = localSettings.getPhotoGridSize();+ _groupLayouts = _computeGroupLayouts();}- List<FixedExtentSectionLayout> getGroupLayouts() {+ List<FixedExtentSectionLayout> _computeGroupLayouts() {final stopwatch = Stopwatch()..start();int currentIndex = 0;double currentOffset = 0.0;@@ -184,6 +179,7 @@ class GalleryGroups {// TODO: compute this in isolatevoid _buildGroups() {+ final stopwatch = Stopwatch()..start();List<EnteFile> groupFiles = [];for (int index = 0; index < allFiles.length; index++) {if (index > 0 &&@@ -196,6 +192,13 @@ class GalleryGroups {if (groupFiles.isNotEmpty) {_createNewGroup(groupFiles);}+ _logger.info(+ "Built ${_groupIds.length} groups in ${stopwatch.elapsedMilliseconds} ms",+ );+ print(+ "Built ${_groupIds.length} groups in ${stopwatch.elapsedMilliseconds} ms",+ );+ stopwatch.stop();}void _createNewGroup(diff --git a/mobile/lib/ui/viewer/gallery/gallery.dart b/mobile/lib/ui/viewer/gallery/gallery.dartindex 1cb5721d55..e171b2f878 100644--- a/mobile/lib/ui/viewer/gallery/gallery.dart+++ b/mobile/lib/ui/viewer/gallery/gallery.dart@@ -420,6 +420,7 @@ class GalleryState extends State<Gallery> {child: CustomScrollView(// physics: const BouncingScrollPhysics(),slivers: [+ SliverToBoxAdapter(child: widget.header ?? const SizedBox.shrink()),FutureBuilder(future: groupHeaderExtent,builder: (context, snapshot) {@@ -432,13 +433,16 @@ class GalleryState extends State<Gallery> {selectedFiles: widget.selectedFiles,tagPrefix: widget.tagPrefix,headerExtent: snapshot.data!,- ).getGroupLayouts(),+ ).groupLayouts,);} else {return const SliverFillRemaining();}},),+ SliverToBoxAdapter(+ child: widget.footer,+ ),],),),