|
@@ -19,7 +19,6 @@ import 'package:photos/ui/viewer/file/detail_page.dart';
|
|
import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
|
|
import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
|
|
import 'package:photos/ui/viewer/gallery/gallery.dart';
|
|
import 'package:photos/ui/viewer/gallery/gallery.dart';
|
|
import 'package:photos/utils/date_time_util.dart';
|
|
import 'package:photos/utils/date_time_util.dart';
|
|
-import 'package:photos/utils/local_settings.dart';
|
|
|
|
import 'package:photos/utils/navigation_util.dart';
|
|
import 'package:photos/utils/navigation_util.dart';
|
|
import 'package:visibility_detector/visibility_detector.dart';
|
|
import 'package:visibility_detector/visibility_detector.dart';
|
|
|
|
|
|
@@ -33,6 +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;
|
|
|
|
|
|
LazyLoadingGallery(
|
|
LazyLoadingGallery(
|
|
this.files,
|
|
this.files,
|
|
@@ -44,6 +44,7 @@ class LazyLoadingGallery extends StatefulWidget {
|
|
this.tag,
|
|
this.tag,
|
|
this.currentIndexStream, {
|
|
this.currentIndexStream, {
|
|
this.logTag = "",
|
|
this.logTag = "",
|
|
|
|
+ this.photoGirdSize = photoGridSizeDefault,
|
|
Key key,
|
|
Key key,
|
|
}) : super(key: key ?? UniqueKey());
|
|
}) : super(key: key ?? UniqueKey());
|
|
|
|
|
|
@@ -236,7 +237,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
|
? _getGallery()
|
|
? _getGallery()
|
|
: PlaceHolderWidget(
|
|
: PlaceHolderWidget(
|
|
_files.length,
|
|
_files.length,
|
|
- LocalSettings.instance.getPhotoGridSize(),
|
|
|
|
|
|
+ widget.photoGirdSize,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
);
|
|
);
|
|
@@ -258,6 +259,7 @@ class _LazyLoadingGalleryState extends State<LazyLoadingGallery> {
|
|
_files.length > kRecycleLimit,
|
|
_files.length > kRecycleLimit,
|
|
_toggleSelectAllFromDay,
|
|
_toggleSelectAllFromDay,
|
|
_areAllFromDaySelected,
|
|
_areAllFromDaySelected,
|
|
|
|
+ widget.photoGirdSize,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -285,6 +287,7 @@ class LazyLoadingGridView extends StatefulWidget {
|
|
final bool shouldRecycle;
|
|
final bool shouldRecycle;
|
|
final ValueNotifier toggleSelectAllFromDay;
|
|
final ValueNotifier toggleSelectAllFromDay;
|
|
final ValueNotifier areAllFilesSelected;
|
|
final ValueNotifier areAllFilesSelected;
|
|
|
|
+ final int photoGridSize;
|
|
|
|
|
|
LazyLoadingGridView(
|
|
LazyLoadingGridView(
|
|
this.tag,
|
|
this.tag,
|
|
@@ -294,7 +297,8 @@ class LazyLoadingGridView extends StatefulWidget {
|
|
this.shouldRender,
|
|
this.shouldRender,
|
|
this.shouldRecycle,
|
|
this.shouldRecycle,
|
|
this.toggleSelectAllFromDay,
|
|
this.toggleSelectAllFromDay,
|
|
- this.areAllFilesSelected, {
|
|
|
|
|
|
+ this.areAllFilesSelected,
|
|
|
|
+ this.photoGridSize, {
|
|
Key key,
|
|
Key key,
|
|
}) : super(key: key ?? UniqueKey());
|
|
}) : super(key: key ?? UniqueKey());
|
|
|
|
|
|
@@ -304,7 +308,6 @@ class LazyLoadingGridView extends StatefulWidget {
|
|
|
|
|
|
class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|
class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|
bool _shouldRender;
|
|
bool _shouldRender;
|
|
- int _photoGridSize;
|
|
|
|
StreamSubscription<ClearSelectionsEvent> _clearSelectionsEvent;
|
|
StreamSubscription<ClearSelectionsEvent> _clearSelectionsEvent;
|
|
|
|
|
|
@override
|
|
@override
|
|
@@ -340,7 +343,6 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|
|
|
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
- _photoGridSize = LocalSettings.instance.getPhotoGridSize();
|
|
|
|
if (widget.shouldRecycle) {
|
|
if (widget.shouldRecycle) {
|
|
return _getRecyclableView();
|
|
return _getRecyclableView();
|
|
} else {
|
|
} else {
|
|
@@ -361,7 +363,7 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|
},
|
|
},
|
|
child: _shouldRender
|
|
child: _shouldRender
|
|
? _getGridView()
|
|
? _getGridView()
|
|
- : PlaceHolderWidget(widget.filesInDay.length, _photoGridSize),
|
|
|
|
|
|
+ : PlaceHolderWidget(widget.filesInDay.length, widget.photoGridSize),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -376,7 +378,8 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- child: PlaceHolderWidget(widget.filesInDay.length, _photoGridSize),
|
|
|
|
|
|
+ child:
|
|
|
|
+ PlaceHolderWidget(widget.filesInDay.length, widget.photoGridSize),
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
return _getGridView();
|
|
return _getGridView();
|
|
@@ -386,8 +389,8 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|
Widget _getGridView() {
|
|
Widget _getGridView() {
|
|
return GridView.builder(
|
|
return GridView.builder(
|
|
shrinkWrap: true,
|
|
shrinkWrap: true,
|
|
- physics:
|
|
|
|
- const NeverScrollableScrollPhysics(), // to disable GridView's scrolling
|
|
|
|
|
|
+ physics: const NeverScrollableScrollPhysics(),
|
|
|
|
+ // to disable GridView's scrolling
|
|
itemBuilder: (context, index) {
|
|
itemBuilder: (context, index) {
|
|
return _buildFile(context, widget.filesInDay[index]);
|
|
return _buildFile(context, widget.filesInDay[index]);
|
|
},
|
|
},
|
|
@@ -395,7 +398,7 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisSpacing: 2,
|
|
crossAxisSpacing: 2,
|
|
mainAxisSpacing: 2,
|
|
mainAxisSpacing: 2,
|
|
- crossAxisCount: _photoGridSize,
|
|
|
|
|
|
+ crossAxisCount: widget.photoGridSize,
|
|
),
|
|
),
|
|
padding: const EdgeInsets.all(0),
|
|
padding: const EdgeInsets.all(0),
|
|
);
|
|
);
|
|
@@ -433,8 +436,7 @@ class _LazyLoadingGridViewState extends State<LazyLoadingGridView> {
|
|
serverLoadDeferDuration: thumbnailServerLoadDeferDuration,
|
|
serverLoadDeferDuration: thumbnailServerLoadDeferDuration,
|
|
shouldShowLivePhotoOverlay: true,
|
|
shouldShowLivePhotoOverlay: true,
|
|
key: Key(widget.tag + file.tag),
|
|
key: Key(widget.tag + file.tag),
|
|
- thumbnailSize: LocalSettings.instance.getPhotoGridSize() <
|
|
|
|
- photoGridSizeDefault
|
|
|
|
|
|
+ thumbnailSize: widget.photoGridSize < photoGridSizeDefault
|
|
? thumbnailLargeSize
|
|
? thumbnailLargeSize
|
|
: thumbnailSmallSize,
|
|
: thumbnailSmallSize,
|
|
),
|
|
),
|