Compare commits

...

14 Commits

Author SHA1 Message Date
ashilkn
3d90e37a00 Merge gallery_scroll_improvement 2025-08-07 13:19:15 +05:30
ashilkn
f4605f86a4 Bump up build number 2025-08-07 13:18:27 +05:30
ashilkn
eb9f5830a5 Merge branch 'gallery_scroll_improvement' into release_mob_jul_31 2025-08-07 13:15:05 +05:30
ashilkn
1f1cad181f Reduce galleryThumbnailDiskLoadDeferDuration 2025-08-07 13:14:21 +05:30
ashilkn
0f8a8a7579 Perf: Skip recreation/modification of ImageProvider of Image used in thumbnail 2025-08-07 11:02:18 +05:30
ashilkn
33703072eb remove todo 2025-08-07 10:56:32 +05:30
ashilkn
d86f9d2ffa refactor 2025-08-06 14:45:03 +05:30
ashilkn
348ede2a03 bump up build number 2025-08-05 20:36:39 +05:30
ashilkn
5619b349b3 Merge branch 'increase_cache_extent_gallery' into release_mob_jul_31 2025-08-05 20:32:09 +05:30
ashilkn
769adb75c5 Different cache extents for different photoGridSizes 2025-08-05 20:31:10 +05:30
ashilkn
1648f62da6 Add repaint boundary over each gird item in gallery 2025-08-05 16:49:48 +05:30
Neeraj
d7fdca78f7 Update pubspec.yaml 2025-08-05 10:20:49 +05:30
ashilkn
63f24966ce Incrase cacheExtent of gallery 2025-08-05 06:53:54 +05:30
ashilkn
1c14896fd6 bump up build number 2025-07-31 22:36:49 +05:30
6 changed files with 62 additions and 33 deletions

View File

@@ -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

View File

@@ -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,
),
),
);
}

View File

@@ -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) {

View File

@@ -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));

View File

@@ -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 {

View File

@@ -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: