فهرست منبع

Added constraints to CreateCollectionSheet

ashilkn 2 سال پیش
والد
کامیت
4fbeccecda
1فایلهای تغییر یافته به همراه50 افزوده شده و 50 حذف شده
  1. 50 50
      lib/ui/create_collection_sheet.dart

+ 50 - 50
lib/ui/create_collection_sheet.dart

@@ -1,3 +1,5 @@
+import 'dart:math';
+
 import 'package:collection/collection.dart';
 import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
@@ -98,61 +100,59 @@ class _CreateCollectionSheetState extends State<CreateCollectionSheet> {
     final filesCount = widget.sharedFiles != null
         ? widget.sharedFiles!.length
         : widget.selectedFiles!.files.length;
-    return Column(
-      mainAxisSize: MainAxisSize.min,
-      crossAxisAlignment: CrossAxisAlignment.start,
-      children: [
-        Expanded(
-          child: Padding(
-            padding: const EdgeInsets.fromLTRB(0, 32, 0, 12),
-            child: Column(
-              children: [
-                BottomOfTitleBarWidget(
-                  title: TitleBarTitleWidget(
-                    title: _actionName(widget.actionType, filesCount > 1),
-                  ),
-                  caption: "Create or select album",
+    return Center(
+      child: ConstrainedBox(
+        constraints: BoxConstraints(
+          maxWidth: min(428, MediaQuery.of(context).size.width),
+        ),
+        child: Padding(
+          padding: const EdgeInsets.fromLTRB(0, 32, 0, 12),
+          child: Column(
+            children: [
+              BottomOfTitleBarWidget(
+                title: TitleBarTitleWidget(
+                  title: _actionName(widget.actionType, filesCount > 1),
                 ),
-                Expanded(
-                  child: Padding(
-                    padding: const EdgeInsets.fromLTRB(16, 24, 16, 48),
-                    child: FutureBuilder(
-                      future: _getCollectionsWithThumbnail(),
-                      builder: (context, snapshot) {
-                        if (snapshot.hasError) {
-                          //Need to show an error on the UI here
-                          return const SizedBox.shrink();
-                        } else if (snapshot.hasData) {
-                          final collectionsWithThumbnail =
-                              snapshot.data as List<CollectionWithThumbnail>;
-                          return ListView.separated(
-                            itemBuilder: (context, index) {
-                              return AlbumListItemWidget(
-                                item: collectionsWithThumbnail[index],
-                              );
-                              // return _buildCollectionItem(
-                              //   collectionsWithThumbnail[index],
-                              // );
-                            },
-                            separatorBuilder: (context, index) =>
-                                const SizedBox(
-                              height: 8,
-                            ),
-                            itemCount: collectionsWithThumbnail.length,
-                            shrinkWrap: true,
-                          );
-                        } else {
-                          return const EnteLoadingWidget();
-                        }
-                      },
-                    ),
+                caption: "Create or select album",
+              ),
+              Expanded(
+                child: Padding(
+                  padding: const EdgeInsets.fromLTRB(16, 24, 16, 48),
+                  child: FutureBuilder(
+                    future: _getCollectionsWithThumbnail(),
+                    builder: (context, snapshot) {
+                      if (snapshot.hasError) {
+                        //Need to show an error on the UI here
+                        return const SizedBox.shrink();
+                      } else if (snapshot.hasData) {
+                        final collectionsWithThumbnail =
+                            snapshot.data as List<CollectionWithThumbnail>;
+                        return ListView.separated(
+                          itemBuilder: (context, index) {
+                            return AlbumListItemWidget(
+                              item: collectionsWithThumbnail[index],
+                            );
+                            // return _buildCollectionItem(
+                            //   collectionsWithThumbnail[index],
+                            // );
+                          },
+                          separatorBuilder: (context, index) => const SizedBox(
+                            height: 8,
+                          ),
+                          itemCount: collectionsWithThumbnail.length,
+                          shrinkWrap: true,
+                        );
+                      } else {
+                        return const EnteLoadingWidget();
+                      }
+                    },
                   ),
                 ),
-              ],
-            ),
+              ),
+            ],
           ),
         ),
-      ],
+      ),
     );
   }