Reduce sub gallery limits in case of larger thumbnails

This commit is contained in:
vishnukvmd 2022-12-19 12:36:14 +05:30
parent 31673c6a1d
commit c7a30a3bc2
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

@ -53,7 +53,6 @@ class LazyLoadingGallery extends StatefulWidget {
}
class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
static const kSubGalleryItemLimit = 80;
static const kRecycleLimit = 400;
static const kNumberOfDaysToRenderBeforeAndAfter = 8;
@ -243,13 +242,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,