Merge pull request #718 from ente-io/optimize_sub_gallery

Reduce sub gallery limits in case of larger thumbnails
This commit is contained in:
Neeraj Gupta 2022-12-19 12:40:42 +05:30 committed by GitHub
commit 76ee912f25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -18,6 +18,8 @@ const int batchSize = 1000;
const photoGridSizeDefault = 4;
const photoGridSizeMin = 2;
const photoGridSizeMax = 6;
const subGalleryLimitDefault = 80;
const subGalleryLimitMin = 40;
// used to identify which ente file are available in app cache
// todo: 6Jun22: delete old media identifier after 3 months

View file

@ -55,7 +55,6 @@ class LazyLoadingGallery extends StatefulWidget {
}
class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
static const kSubGalleryItemLimit = 80;
static const kRecycleLimit = 400;
static const kNumberOfDaysToRenderBeforeAndAfter = 8;
@ -245,13 +244,16 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
Widget _getGallery() {
final List<Widget> childGalleries = [];
for (int index = 0; index < _files.length; index += kSubGalleryItemLimit) {
final subGalleryItemLimit = widget.photoGirdSize < photoGridSizeDefault
? subGalleryLimitMin
: subGalleryLimitDefault;
for (int index = 0; index < _files.length; index += subGalleryItemLimit) {
childGalleries.add(
LazyLoadingGridView(
widget.tag,
_files.sublist(
index,
min(index + kSubGalleryItemLimit, _files.length),
min(index + subGalleryItemLimit, _files.length),
),
widget.asyncLoader,
widget.selectedFiles,