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
2 changed files with 5 additions and 8 deletions
|
@ -18,8 +18,7 @@ const int batchSize = 1000;
|
|||
const photoGridSizeDefault = 4;
|
||||
const photoGridSizeMin = 2;
|
||||
const photoGridSizeMax = 6;
|
||||
const subGalleryLimitDefault = 80;
|
||||
const subGalleryLimitMin = 40;
|
||||
const subGalleryMultiplier = 10;
|
||||
|
||||
// used to identify which ente file are available in app cache
|
||||
// todo: 6Jun22: delete old media identifier after 3 months
|
||||
|
|
|
@ -32,7 +32,7 @@ class LazyLoadingGallery extends StatefulWidget {
|
|||
final String tag;
|
||||
final String? logTag;
|
||||
final Stream<int> currentIndexStream;
|
||||
final int? photoGirdSize;
|
||||
final int photoGirdSize;
|
||||
|
||||
LazyLoadingGallery(
|
||||
this.files,
|
||||
|
@ -190,7 +190,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
|||
getDayWidget(
|
||||
context,
|
||||
_files[0].creationTime!,
|
||||
widget.photoGirdSize!,
|
||||
widget.photoGirdSize,
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: _showSelectAllButton,
|
||||
|
@ -234,7 +234,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
|||
? _getGallery()
|
||||
: PlaceHolderWidget(
|
||||
_files.length,
|
||||
widget.photoGirdSize!,
|
||||
widget.photoGirdSize,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
@ -242,9 +242,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
|||
|
||||
Widget _getGallery() {
|
||||
final List<Widget> childGalleries = [];
|
||||
final subGalleryItemLimit = widget.photoGirdSize! < photoGridSizeDefault
|
||||
? subGalleryLimitMin
|
||||
: subGalleryLimitDefault;
|
||||
final subGalleryItemLimit = widget.photoGirdSize * subGalleryMultiplier;
|
||||
for (int index = 0; index < _files.length; index += subGalleryItemLimit) {
|
||||
childGalleries.add(
|
||||
LazyLoadingGridView(
|
||||
|
|
Loading…
Add table
Reference in a new issue