diff --git a/lib/ui/create_collection_sheet.dart b/lib/ui/create_collection_sheet.dart index 272812b01..73161d874 100644 --- a/lib/ui/create_collection_sheet.dart +++ b/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 { 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; - 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; + 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(); + } + }, ), ), - ], - ), + ), + ], ), ), - ], + ), ); }