瀏覽代碼

Add icons for uploaded and on device files in debugMode

Neeraj Gupta 2 年之前
父節點
當前提交
f51d6ebd59
共有 3 個文件被更改,包括 37 次插入2 次删除
  1. 1 2
      lib/db/trash_db.dart
  2. 26 0
      lib/ui/viewer/file/file_icons_widget.dart
  3. 10 0
      lib/ui/viewer/file/thumbnail_widget.dart

+ 1 - 2
lib/db/trash_db.dart

@@ -225,11 +225,10 @@ class TrashDB {
     trashFile.fileDecryptionHeader = row[columnFileDecryptionHeader];
     trashFile.thumbnailDecryptionHeader = row[columnThumbnailDecryptionHeader];
     trashFile.updationTime = row[columnUpdationTime] ?? 0;
-
-    trashFile.localID = row[columnLocalID];
     trashFile.creationTime = row[columnCreationTime];
     final fileMetadata = row[columnFileMetadata] ?? '{}';
     trashFile.applyMetadata(jsonDecode(fileMetadata));
+    trashFile.localID = row[columnLocalID];
 
     trashFile.mMdVersion = row[columnMMdVersion] ?? 0;
     trashFile.mMdEncodedJson = row[columnMMdEncodedJson] ?? '{}';

+ 26 - 0
lib/ui/viewer/file/file_icons_widget.dart

@@ -27,6 +27,32 @@ class UnSyncedIcon extends StatelessWidget {
   }
 }
 
+class DeviceIcon extends StatelessWidget {
+  const DeviceIcon({Key? key}) : super(key: key);
+
+  @override
+  Widget build(BuildContext context) {
+    return const _BottomLeftOverlayIcon(
+      Icons.mobile_friendly_rounded,
+      baseSize: 18,
+      color: Color.fromRGBO(1, 222, 77, 0.8),
+    );
+  }
+}
+
+class CloudOnlyIcon extends StatelessWidget {
+  const CloudOnlyIcon({Key? key}) : super(key: key);
+
+  @override
+  Widget build(BuildContext context) {
+    return const _BottomLeftOverlayIcon(
+      Icons.cloud_done_outlined,
+      baseSize: 18,
+      color: Color.fromRGBO(1, 222, 77, 0.8),
+    );
+  }
+}
+
 class FavoriteOverlayIcon extends StatelessWidget {
   const FavoriteOverlayIcon({Key? key}) : super(key: key);
 

+ 10 - 0
lib/ui/viewer/file/thumbnail_widget.dart

@@ -1,3 +1,4 @@
+import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
 import 'package:photos/core/cache/thumbnail_cache.dart';
@@ -157,6 +158,15 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
     if (widget.shouldShowSyncStatus && widget.file!.uploadedFileID == null) {
       viewChildren.add(const UnSyncedIcon());
     }
+    if (kDebugMode &&
+        widget.shouldShowSyncStatus &&
+        widget.file!.uploadedFileID != null) {
+      if (widget.file!.localID != null) {
+        viewChildren.add(const DeviceIcon());
+      } else {
+        viewChildren.add(const CloudOnlyIcon());
+      }
+    }
     if (widget.file is TrashFile) {
       viewChildren.add(TrashedFileOverlayText(widget.file as TrashFile));
     }