Jelajahi Sumber

Gave stroke inside of AlbumlistItemWidget by using the border of another container stacked on top

ashilkn 2 tahun lalu
induk
melakukan
278fec90c4

+ 2 - 0
lib/models/collection.dart

@@ -81,6 +81,8 @@ class Collection {
     return (owner?.id ?? 0) == userID;
   }
 
+  String get collectionName => name ?? "Unnamed collection";
+
   void updateSharees(List<User> newSharees) {
     sharees?.clear();
     sharees?.addAll(newSharees);

+ 67 - 52
lib/ui/components/album_list_item_widget.dart

@@ -15,65 +15,80 @@ class AlbumListItemWidget extends StatelessWidget {
     final logger = Logger("AlbumListItemWidget");
     final textTheme = getEnteTextTheme(context);
     final colorScheme = getEnteColorScheme(context);
-    return Container(
-      decoration: BoxDecoration(
-        border: Border.all(color: colorScheme.strokeFainter),
-        borderRadius: BorderRadius.circular(4),
-      ),
-      child: ClipRRect(
-        borderRadius: const BorderRadius.all(
-          Radius.circular(4),
-        ),
-        child: Row(
+    const sideOfThumbnail = 60.0;
+    return Stack(
+      children: [
+        Row(
           children: [
-            SizedBox(
-              height: 60,
-              width: 60,
-              key: Key("collection_item:" + (item.thumbnail?.tag ?? "")),
-              child: item.thumbnail != null
-                  ? ThumbnailWidget(
-                      item.thumbnail,
-                      showFavForAlbumOnly: true,
-                    )
-                  : const NoThumbnailWidget(),
+            ClipRRect(
+              borderRadius: const BorderRadius.horizontal(
+                left: Radius.circular(4),
+              ),
+              child: SizedBox(
+                height: sideOfThumbnail,
+                width: sideOfThumbnail,
+                key: Key("collection_item:" + (item.thumbnail?.tag ?? "")),
+                child: item.thumbnail != null
+                    ? ThumbnailWidget(
+                        item.thumbnail,
+                        showFavForAlbumOnly: true,
+                      )
+                    : const NoThumbnailWidget(),
+              ),
             ),
-            const SizedBox(width: 12),
-            Column(
-              crossAxisAlignment: CrossAxisAlignment.start,
-              children: [
-                Text(item.collection.collectionName),
-                FutureBuilder<int>(
-                  future:
-                      FilesDB.instance.collectionFileCount(item.collection.id),
-                  builder: (context, snapshot) {
-                    if (snapshot.hasData) {
-                      final text = snapshot.data == 1 ? " memory" : " memories";
-                      return Text(
-                        snapshot.data.toString() + text,
-                        style: textTheme.small.copyWith(
-                          color: colorScheme.textMuted,
-                        ),
-                      );
-                    } else {
-                      if (snapshot.hasError) {
-                        logger.severe(
-                          "Failed to fetch file count of collection id ${item.collection.id}",
+            Padding(
+              padding: const EdgeInsets.only(left: 12),
+              child: Column(
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: [
+                  Text(item.collection.collectionName),
+                  FutureBuilder<int>(
+                    future: FilesDB.instance
+                        .collectionFileCount(item.collection.id),
+                    builder: (context, snapshot) {
+                      if (snapshot.hasData) {
+                        final text =
+                            snapshot.data == 1 ? " memory" : " memories";
+                        return Text(
+                          snapshot.data.toString() + text,
+                          style: textTheme.small.copyWith(
+                            color: colorScheme.textMuted,
+                          ),
+                        );
+                      } else {
+                        if (snapshot.hasError) {
+                          logger.severe(
+                            "Failed to fetch file count of collection id ${item.collection.id}",
+                          );
+                        }
+                        return Text(
+                          "",
+                          style: textTheme.small.copyWith(
+                            color: colorScheme.textMuted,
+                          ),
                         );
                       }
-                      return Text(
-                        "",
-                        style: textTheme.small.copyWith(
-                          color: colorScheme.textMuted,
-                        ),
-                      );
-                    }
-                  },
-                ),
-              ],
+                    },
+                  ),
+                ],
+              ),
             ),
           ],
         ),
-      ),
+        IgnorePointer(
+          child: Container(
+            height: sideOfThumbnail,
+            //32 is to account for padding of 16pts on both sides
+            width: MediaQuery.of(context).size.width - 32,
+            decoration: BoxDecoration(
+              border: Border.all(color: colorScheme.strokeFainter),
+              borderRadius: const BorderRadius.all(
+                Radius.circular(4),
+              ),
+            ),
+          ),
+        ),
+      ],
     );
   }
 }

+ 4 - 0
lib/ui/create_collection_sheet.dart

@@ -10,6 +10,8 @@ import 'package:photos/models/selected_files.dart';
 import 'package:photos/services/collections_service.dart';
 import 'package:photos/services/ignored_files_service.dart';
 import 'package:photos/services/remote_sync_service.dart';
+import 'package:photos/theme/colors.dart';
+import 'package:photos/theme/ente_theme.dart';
 import 'package:photos/ui/common/loading_widget.dart';
 import 'package:photos/ui/components/album_list_item_widget.dart';
 import 'package:photos/ui/components/bottom_of_title_bar_widget.dart';
@@ -68,6 +70,8 @@ void createCollectionSheet(
       ),
     ),
     topControl: const SizedBox.shrink(),
+    backgroundColor: getEnteColorScheme(context).backgroundElevated,
+    barrierColor: backdropFaintDark,
   );
 }