Przeglądaj źródła

show archive icon for archived albums

Neeraj Gupta 3 lat temu
rodzic
commit
ffea2f0de0
2 zmienionych plików z 31 dodań i 12 usunięć
  1. 2 1
      lib/ui/collections_gallery_widget.dart
  2. 29 11
      lib/ui/thumbnail_widget.dart

+ 2 - 1
lib/ui/collections_gallery_widget.dart

@@ -489,7 +489,8 @@ class CollectionItem extends StatelessWidget {
                   tag: "collection" + c.thumbnail.tag(),
                   child: ThumbnailWidget(
                     c.thumbnail,
-                    key: Key("collection" + c.thumbnail.tag()),
+                    shouldShowArchiveStatus: c.collection.isArchived(),
+                    key: Key("collection" + c.thumbnail.tag(),),
                   )),
               height: 140,
               width: 140,

+ 29 - 11
lib/ui/thumbnail_widget.dart

@@ -21,6 +21,7 @@ class ThumbnailWidget extends StatefulWidget {
   final File file;
   final BoxFit fit;
   final bool shouldShowSyncStatus;
+  final bool shouldShowArchiveStatus;
   final bool shouldShowLivePhotoOverlay;
   final Duration diskLoadDeferDuration;
   final Duration serverLoadDeferDuration;
@@ -31,6 +32,7 @@ class ThumbnailWidget extends StatefulWidget {
     this.fit = BoxFit.cover,
     this.shouldShowSyncStatus = true,
     this.shouldShowLivePhotoOverlay = false,
+    this.shouldShowArchiveStatus = false,
     this.diskLoadDeferDuration,
     this.serverLoadDeferDuration,
   }) : super(key: key ?? Key(file.tag()));
@@ -74,6 +76,18 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
     ),
   );
 
+  static final kArchiveIconOverlay = Align(
+    alignment: Alignment.bottomRight,
+    child: Padding(
+      padding: const EdgeInsets.only(right: 8, bottom: 8),
+      child: Icon(
+        Icons.archive_outlined,
+        size: 42,
+        color: Colors.white.withOpacity(0.9),
+      ),
+    ),
+  );
+
   static final kUnsyncedIconOverlay = Container(
     decoration: BoxDecoration(
       gradient: LinearGradient(
@@ -173,18 +187,22 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
         content = image;
       }
     }
+    List<Widget> viewChildrens = [
+      loadingWidget,
+      AnimatedOpacity(
+        opacity: content == null ? 0 : 1.0,
+        duration: Duration(milliseconds: 200),
+        child: content,
+      ),
+      widget.shouldShowSyncStatus && widget.file.uploadedFileID == null
+          ? kUnsyncedIconOverlay
+          : getFileInfoContainer(widget.file),
+    ];
+    if (widget.shouldShowArchiveStatus) {
+      viewChildrens.add(kArchiveIconOverlay);
+    }
     return Stack(
-      children: [
-        loadingWidget,
-        AnimatedOpacity(
-          opacity: content == null ? 0 : 1.0,
-          duration: Duration(milliseconds: 200),
-          child: content,
-        ),
-        widget.shouldShowSyncStatus && widget.file.uploadedFileID == null
-            ? kUnsyncedIconOverlay
-            : getFileInfoContainer(widget.file),
-      ],
+      children: viewChildrens,
       fit: StackFit.expand,
     );
   }