Merge pull request #718 from ente-io/optimize_sub_gallery
Reduce sub gallery limits in case of larger thumbnails
This commit is contained in:
commit
76ee912f25
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue