💄 Optimize attachment list width in post
This commit is contained in:
parent
5c7929e618
commit
e236b7f98b
@ -18,6 +18,7 @@ class AttachmentList extends StatefulWidget {
|
|||||||
final bool noGrow;
|
final bool noGrow;
|
||||||
final BoxFit fit;
|
final BoxFit fit;
|
||||||
final double? maxHeight;
|
final double? maxHeight;
|
||||||
|
final double? minWidth;
|
||||||
final EdgeInsets? padding;
|
final EdgeInsets? padding;
|
||||||
|
|
||||||
const AttachmentList({
|
const AttachmentList({
|
||||||
@ -28,6 +29,7 @@ class AttachmentList extends StatefulWidget {
|
|||||||
this.noGrow = false,
|
this.noGrow = false,
|
||||||
this.fit = BoxFit.cover,
|
this.fit = BoxFit.cover,
|
||||||
this.maxHeight,
|
this.maxHeight,
|
||||||
|
this.minWidth,
|
||||||
this.padding,
|
this.padding,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
widget.bordered ? BorderSide(width: 1, color: Theme.of(context).dividerColor) : BorderSide.none;
|
widget.bordered ? BorderSide(width: 1, color: Theme.of(context).dividerColor) : BorderSide.none;
|
||||||
final backgroundColor = Theme.of(context).colorScheme.surfaceContainer;
|
final backgroundColor = Theme.of(context).colorScheme.surfaceContainer;
|
||||||
final constraints = BoxConstraints(
|
final constraints = BoxConstraints(
|
||||||
minWidth: 80,
|
minWidth: widget.minWidth ?? 80,
|
||||||
maxHeight: widget.maxHeight ?? MediaQuery.of(context).size.height,
|
maxHeight: widget.maxHeight ?? MediaQuery.of(context).size.height,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -67,10 +69,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: widget.padding ?? EdgeInsets.zero,
|
padding: widget.padding ?? EdgeInsets.zero,
|
||||||
constraints: BoxConstraints(maxHeight: constraints.maxHeight),
|
|
||||||
child: Container(
|
|
||||||
constraints: constraints,
|
constraints: constraints,
|
||||||
width: double.infinity,
|
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: singleAspectRatio,
|
aspectRatio: singleAspectRatio,
|
||||||
@ -103,7 +102,6 @@ class _AttachmentListState extends State<AttachmentList> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +253,7 @@ class PostItem extends StatelessWidget {
|
|||||||
bordered: true,
|
bordered: true,
|
||||||
gridded: true,
|
gridded: true,
|
||||||
maxHeight: showFullPost ? null : 480,
|
maxHeight: showFullPost ? null : 480,
|
||||||
|
minWidth: 640,
|
||||||
fit: showFullPost ? BoxFit.cover : BoxFit.contain,
|
fit: showFullPost ? BoxFit.cover : BoxFit.contain,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
),
|
),
|
||||||
@ -930,6 +931,7 @@ class _PostQuoteContent extends StatelessWidget {
|
|||||||
child: AttachmentList(
|
child: AttachmentList(
|
||||||
data: child.preload!.attachments!,
|
data: child.preload!.attachments!,
|
||||||
maxHeight: 360,
|
maxHeight: 360,
|
||||||
|
minWidth: 640,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
gridded: true,
|
gridded: true,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
Loading…
Reference in New Issue
Block a user