Merge pull request #796 from ente-io/fix_blank_grids
Always break into sub-galleries with a number that's divisible by the photo-grid-size
This commit is contained in:
commit
143ae3f702
|
@ -18,8 +18,7 @@ const int batchSize = 1000;
|
||||||
const photoGridSizeDefault = 4;
|
const photoGridSizeDefault = 4;
|
||||||
const photoGridSizeMin = 2;
|
const photoGridSizeMin = 2;
|
||||||
const photoGridSizeMax = 6;
|
const photoGridSizeMax = 6;
|
||||||
const subGalleryLimitDefault = 80;
|
const subGalleryMultiplier = 10;
|
||||||
const subGalleryLimitMin = 40;
|
|
||||||
|
|
||||||
// used to identify which ente file are available in app cache
|
// used to identify which ente file are available in app cache
|
||||||
// todo: 6Jun22: delete old media identifier after 3 months
|
// todo: 6Jun22: delete old media identifier after 3 months
|
||||||
|
|
|
@ -32,7 +32,7 @@ class LazyLoadingGallery extends StatefulWidget {
|
||||||
final String tag;
|
final String tag;
|
||||||
final String? logTag;
|
final String? logTag;
|
||||||
final Stream<int> currentIndexStream;
|
final Stream<int> currentIndexStream;
|
||||||
final int? photoGirdSize;
|
final int photoGirdSize;
|
||||||
|
|
||||||
LazyLoadingGallery(
|
LazyLoadingGallery(
|
||||||
this.files,
|
this.files,
|
||||||
|
@ -190,7 +190,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
||||||
getDayWidget(
|
getDayWidget(
|
||||||
context,
|
context,
|
||||||
_files[0].creationTime!,
|
_files[0].creationTime!,
|
||||||
widget.photoGirdSize!,
|
widget.photoGirdSize,
|
||||||
),
|
),
|
||||||
ValueListenableBuilder(
|
ValueListenableBuilder(
|
||||||
valueListenable: _showSelectAllButton,
|
valueListenable: _showSelectAllButton,
|
||||||
|
@ -234,7 +234,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
||||||
? _getGallery()
|
? _getGallery()
|
||||||
: PlaceHolderWidget(
|
: PlaceHolderWidget(
|
||||||
_files.length,
|
_files.length,
|
||||||
widget.photoGirdSize!,
|
widget.photoGirdSize,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -242,9 +242,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
||||||
|
|
||||||
Widget _getGallery() {
|
Widget _getGallery() {
|
||||||
final List<Widget> childGalleries = [];
|
final List<Widget> childGalleries = [];
|
||||||
final subGalleryItemLimit = widget.photoGirdSize! < photoGridSizeDefault
|
final subGalleryItemLimit = widget.photoGirdSize * subGalleryMultiplier;
|
||||||
? subGalleryLimitMin
|
|
||||||
: subGalleryLimitDefault;
|
|
||||||
for (int index = 0; index < _files.length; index += subGalleryItemLimit) {
|
for (int index = 0; index < _files.length; index += subGalleryItemLimit) {
|
||||||
childGalleries.add(
|
childGalleries.add(
|
||||||
LazyLoadingGridView(
|
LazyLoadingGridView(
|
||||||
|
|
Loading…
Reference in a new issue