Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob] Defer loading of thumbnail

Neeraj Guptabb92766d5e4b
diff --git a/mobile/lib/ui/settings/backup/backup_item_card.dart b/mobile/lib/ui/settings/backup/backup_item_card.dart
index 4d7dca7f0d..bfe657ed45 100644
--- a/mobile/lib/ui/settings/backup/backup_item_card.dart
+++ b/mobile/lib/ui/settings/backup/backup_item_card.dart
@@ -1,4 +1,4 @@
-import "dart:typed_data";
+import "dart:async";
import 'package:flutter/material.dart';
import "package:photos/models/backup/backup_item.dart";
@@ -21,11 +21,21 @@ class BackupItemCard extends StatefulWidget {
class _BackupItemCardState extends State<BackupItemCard> {
String? folderName;
+ bool showThumbnail = false;
@override
void initState() {
super.initState();
folderName = widget.item.file.deviceFolder ?? '';
+
+ // Delay rendering of the thumbnail for 0.5 seconds
+ Timer(const Duration(milliseconds: 500), () {
+ if (mounted) {
+ setState(() {
+ showThumbnail = true;
+ });
+ }
+ });
}
@override
@@ -42,9 +52,7 @@ class _BackupItemCardState extends State<BackupItemCard> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
border: Border.all(
- color: Theme.of(context).brightness == Brightness.light
- ? const Color(0xFF000000).withOpacity(0.08)
- : const Color(0xFFFFFFFF).withOpacity(0.08),
+ color: colorScheme.fillFaint.withOpacity(0.08),
width: 1,
),
),
@@ -55,10 +63,14 @@ class _BackupItemCardState extends State<BackupItemCard> {
height: 60,
child: ClipRRect(
borderRadius: BorderRadius.circular(4),
- child: ThumbnailWidget(
- widget.item.file,
- shouldShowSyncStatus: false,
- ),
+ child: showThumbnail
+ ? ThumbnailWidget(
+ widget.item.file,
+ shouldShowSyncStatus: false,
+ )
+ : Container(
+ color: colorScheme.fillFaint, // Placeholder color
+ ),
),
),
const SizedBox(width: 12),