diff --git a/lib/widgets/attachment/attachment_list.dart b/lib/widgets/attachment/attachment_list.dart index 82ebc67..abc77ec 100644 --- a/lib/widgets/attachment/attachment_list.dart +++ b/lib/widgets/attachment/attachment_list.dart @@ -18,6 +18,7 @@ class AttachmentList extends StatefulWidget { final bool noGrow; final BoxFit fit; final double? maxHeight; + final double? minWidth; final EdgeInsets? padding; const AttachmentList({ @@ -28,6 +29,7 @@ class AttachmentList extends StatefulWidget { this.noGrow = false, this.fit = BoxFit.cover, this.maxHeight, + this.minWidth, this.padding, }); @@ -51,7 +53,7 @@ class _AttachmentListState extends State { widget.bordered ? BorderSide(width: 1, color: Theme.of(context).dividerColor) : BorderSide.none; final backgroundColor = Theme.of(context).colorScheme.surfaceContainer; final constraints = BoxConstraints( - minWidth: 80, + minWidth: widget.minWidth ?? 80, maxHeight: widget.maxHeight ?? MediaQuery.of(context).size.height, ); @@ -67,42 +69,38 @@ class _AttachmentListState extends State { return Container( padding: widget.padding ?? EdgeInsets.zero, - constraints: BoxConstraints(maxHeight: constraints.maxHeight), - child: Container( - constraints: constraints, - width: double.infinity, - child: GestureDetector( - child: AspectRatio( - aspectRatio: singleAspectRatio, - child: Container( - decoration: BoxDecoration( - color: backgroundColor, - border: Border.fromBorderSide(borderSide), - borderRadius: AttachmentList.kDefaultRadius, - ), - child: ClipRRect( - borderRadius: AttachmentList.kDefaultRadius, - child: AttachmentItem( - data: widget.data[0], - heroTag: heroTags[0], - fit: widget.fit, - ), + constraints: constraints, + child: GestureDetector( + child: AspectRatio( + aspectRatio: singleAspectRatio, + child: Container( + decoration: BoxDecoration( + color: backgroundColor, + border: Border.fromBorderSide(borderSide), + borderRadius: AttachmentList.kDefaultRadius, + ), + child: ClipRRect( + borderRadius: AttachmentList.kDefaultRadius, + child: AttachmentItem( + data: widget.data[0], + heroTag: heroTags[0], + fit: widget.fit, ), ), ), - onTap: () { - if (widget.data.firstOrNull?.mediaType != SnMediaType.image) return; - context.pushTransparentRoute( - AttachmentZoomView( - data: widget.data.where((ele) => ele != null).cast(), - initialIndex: 0, - heroTags: heroTags, - ), - backgroundColor: Colors.black.withOpacity(0.7), - rootNavigator: true, - ); - }, ), + onTap: () { + if (widget.data.firstOrNull?.mediaType != SnMediaType.image) return; + context.pushTransparentRoute( + AttachmentZoomView( + data: widget.data.where((ele) => ele != null).cast(), + initialIndex: 0, + heroTags: heroTags, + ), + backgroundColor: Colors.black.withOpacity(0.7), + rootNavigator: true, + ); + }, ), ); } diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index c3ffa82..424cdde 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -253,6 +253,7 @@ class PostItem extends StatelessWidget { bordered: true, gridded: true, maxHeight: showFullPost ? null : 480, + minWidth: 640, fit: showFullPost ? BoxFit.cover : BoxFit.contain, padding: const EdgeInsets.symmetric(horizontal: 12), ), @@ -930,6 +931,7 @@ class _PostQuoteContent extends StatelessWidget { child: AttachmentList( data: child.preload!.attachments!, maxHeight: 360, + minWidth: 640, fit: BoxFit.contain, gridded: true, padding: const EdgeInsets.symmetric(horizontal: 12),