Compare commits
14 Commits
commons
...
release_mo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d90e37a00 | ||
|
|
f4605f86a4 | ||
|
|
eb9f5830a5 | ||
|
|
1f1cad181f | ||
|
|
0f8a8a7579 | ||
|
|
33703072eb | ||
|
|
d86f9d2ffa | ||
|
|
348ede2a03 | ||
|
|
5619b349b3 | ||
|
|
769adb75c5 | ||
|
|
1648f62da6 | ||
|
|
d7fdca78f7 | ||
|
|
63f24966ce | ||
|
|
1c14896fd6 |
@@ -27,7 +27,7 @@ const subGalleryMultiplier = 10;
|
||||
// used to identify which ente file are available in app cache
|
||||
const String sharedMediaIdentifier = 'ente-shared-media://';
|
||||
|
||||
const galleryThumbnailDiskLoadDeferDuration = Duration(milliseconds: 500);
|
||||
const galleryThumbnailDiskLoadDeferDuration = Duration(milliseconds: 80);
|
||||
const galleryThumbnailServerLoadDeferDuration = Duration(milliseconds: 80);
|
||||
|
||||
// 256 bit key maps to 24 words
|
||||
|
||||
@@ -224,18 +224,20 @@ class GalleryGroups {
|
||||
int i = 0;
|
||||
while (!endOfListReached) {
|
||||
gridRowChildren.add(
|
||||
GalleryFileWidget(
|
||||
RepaintBoundary(
|
||||
key: ValueKey(
|
||||
tagPrefix +
|
||||
filesInGroup[firstIndexOfRowWrtFilesInGroup + i]
|
||||
.tag,
|
||||
),
|
||||
file: filesInGroup[firstIndexOfRowWrtFilesInGroup + i],
|
||||
selectedFiles: selectedFiles,
|
||||
limitSelectionToOne: limitSelectionToOne,
|
||||
tag: tagPrefix,
|
||||
photoGridSize: crossAxisCount,
|
||||
currentUserID: currentUserID,
|
||||
child: GalleryFileWidget(
|
||||
file: filesInGroup[firstIndexOfRowWrtFilesInGroup + i],
|
||||
selectedFiles: selectedFiles,
|
||||
limitSelectionToOne: limitSelectionToOne,
|
||||
tag: tagPrefix,
|
||||
photoGridSize: crossAxisCount,
|
||||
currentUserID: currentUserID,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -247,18 +249,20 @@ class GalleryGroups {
|
||||
} else {
|
||||
for (int i = 0; i < crossAxisCount; i++) {
|
||||
gridRowChildren.add(
|
||||
GalleryFileWidget(
|
||||
RepaintBoundary(
|
||||
key: ValueKey(
|
||||
tagPrefix +
|
||||
filesInGroup[firstIndexOfRowWrtFilesInGroup + i]
|
||||
.tag,
|
||||
),
|
||||
file: filesInGroup[firstIndexOfRowWrtFilesInGroup + i],
|
||||
selectedFiles: selectedFiles,
|
||||
limitSelectionToOne: limitSelectionToOne,
|
||||
tag: tagPrefix,
|
||||
photoGridSize: crossAxisCount,
|
||||
currentUserID: currentUserID,
|
||||
child: GalleryFileWidget(
|
||||
file: filesInGroup[firstIndexOfRowWrtFilesInGroup + i],
|
||||
selectedFiles: selectedFiles,
|
||||
limitSelectionToOne: limitSelectionToOne,
|
||||
tag: tagPrefix,
|
||||
photoGridSize: crossAxisCount,
|
||||
currentUserID: currentUserID,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -151,13 +151,7 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
||||
Widget? image;
|
||||
if (_imageProvider != null) {
|
||||
image = Image(
|
||||
image: optimizedImageHeight != null || optimizedImageWidth != null
|
||||
? ResizeImage(
|
||||
_imageProvider!,
|
||||
width: optimizedImageWidth,
|
||||
height: optimizedImageHeight,
|
||||
)
|
||||
: _imageProvider!,
|
||||
image: _imageProvider!,
|
||||
fit: widget.fit,
|
||||
);
|
||||
}
|
||||
@@ -251,7 +245,11 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
||||
final cachedSmallThumbnail =
|
||||
ThumbnailInMemoryLruCache.get(widget.file, thumbnailSmallSize);
|
||||
if (cachedSmallThumbnail != null) {
|
||||
_imageProvider = Image.memory(cachedSmallThumbnail).image;
|
||||
_imageProvider = Image.memory(
|
||||
cachedSmallThumbnail,
|
||||
cacheHeight: optimizedImageHeight,
|
||||
cacheWidth: optimizedImageWidth,
|
||||
).image;
|
||||
_hasLoadedThumbnail = true;
|
||||
} else {
|
||||
if (widget.diskLoadDeferDuration != null) {
|
||||
@@ -296,7 +294,11 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
final imageProvider = Image.memory(thumbData).image;
|
||||
final imageProvider = Image.memory(
|
||||
thumbData,
|
||||
cacheHeight: optimizedImageHeight,
|
||||
cacheWidth: optimizedImageWidth,
|
||||
).image;
|
||||
_cacheAndRender(imageProvider);
|
||||
}
|
||||
ThumbnailInMemoryLruCache.put(
|
||||
@@ -381,10 +383,15 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
||||
_isLoadingRemoteThumbnail = true;
|
||||
final cachedThumbnail = ThumbnailInMemoryLruCache.get(widget.file);
|
||||
if (cachedThumbnail != null) {
|
||||
_imageProvider = Image.memory(cachedThumbnail).image;
|
||||
_imageProvider = Image.memory(
|
||||
cachedThumbnail,
|
||||
cacheHeight: optimizedImageHeight,
|
||||
cacheWidth: optimizedImageWidth,
|
||||
).image;
|
||||
_hasLoadedThumbnail = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (widget.serverLoadDeferDuration != null) {
|
||||
Future.delayed(widget.serverLoadDeferDuration!, () {
|
||||
if (mounted) {
|
||||
@@ -401,7 +408,11 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
||||
try {
|
||||
final thumbnail = await getThumbnailFromServer(widget.file);
|
||||
if (mounted) {
|
||||
final imageProvider = Image.memory(thumbnail).image;
|
||||
final imageProvider = Image.memory(
|
||||
thumbnail,
|
||||
cacheHeight: optimizedImageHeight,
|
||||
cacheWidth: optimizedImageWidth,
|
||||
).image;
|
||||
_cacheAndRender(imageProvider);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -42,12 +42,6 @@ class SectionedListSliver<T> extends StatelessWidget {
|
||||
sectionLayouts: sectionLayouts,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
//TODO:
|
||||
// This could be optimized by using a combination of
|
||||
//linear search and binary search depending on the index (use linear
|
||||
//if index is small) or keep track on lastIndex of section and
|
||||
//go to next section after the last index.
|
||||
// Check if the optimization is required.
|
||||
if (index >= childCount) return null;
|
||||
final sectionLayout = sectionLayouts
|
||||
.firstWhereOrNull((section) => section.hasChild(index));
|
||||
|
||||
@@ -600,6 +600,7 @@ class GalleryState extends State<Gallery> {
|
||||
? const NeverScrollableScrollPhysics()
|
||||
: const ExponentialBouncingScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
cacheExtent: galleryCacheExtent,
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: SizeChangedLayoutNotifier(
|
||||
@@ -637,6 +638,25 @@ class GalleryState extends State<Gallery> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
double get galleryCacheExtent {
|
||||
final int photoGridSize = localSettings.getPhotoGridSize();
|
||||
switch (photoGridSize) {
|
||||
case 2:
|
||||
case 3:
|
||||
return 1000;
|
||||
case 4:
|
||||
return 850;
|
||||
case 5:
|
||||
return 600;
|
||||
case 6:
|
||||
return 300;
|
||||
default:
|
||||
throw StateError(
|
||||
'Invalid photo grid size configuration: $photoGridSize',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PinnedGroupHeader extends StatefulWidget {
|
||||
|
||||
@@ -12,7 +12,7 @@ description: ente photos application
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
|
||||
version: 1.2.0+1120
|
||||
version: 1.2.0+1203
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
|
||||
Reference in New Issue
Block a user