Rollback to old style attachment list

This commit is contained in:
LittleSheep 2025-01-21 12:12:21 +08:00
parent 19076f8136
commit bb7b731602
4 changed files with 135 additions and 127 deletions

View File

@ -108,7 +108,7 @@ class _AttachmentListState extends State<AttachmentList> {
if (widget.gridded) {
final fullOfImage =
widget.data.where((ele) => ele?.mediaType == SnMediaType.image).length == widget.data.length;
if(!fullOfImage) {
if (!fullOfImage) {
return Container(
margin: widget.padding ?? EdgeInsets.zero,
decoration: BoxDecoration(
@ -191,8 +191,10 @@ class _AttachmentListState extends State<AttachmentList> {
);
}
return Container(
constraints: BoxConstraints(maxHeight: constraints.maxHeight),
return AspectRatio(
aspectRatio: widget.data.isNotEmpty ? widget.data.first?.data['ratio']?.toDouble() ?? 1 : 1,
child: Container(
constraints: constraints,
child: ScrollConfiguration(
behavior: _AttachmentListScrollBehavior(),
child: ListView.separated(
@ -209,7 +211,8 @@ class _AttachmentListState extends State<AttachmentList> {
if (widget.data[idx]?.mediaType != SnMediaType.image) return;
context.pushTransparentRoute(
AttachmentZoomView(
data: widget.data.where((ele) => ele != null && ele.mediaType == SnMediaType.image).cast(),
data:
widget.data.where((ele) => ele != null && ele.mediaType == SnMediaType.image).cast(),
initialIndex: idx,
heroTags: heroTags,
),
@ -255,6 +258,7 @@ class _AttachmentListState extends State<AttachmentList> {
scrollDirection: Axis.horizontal,
),
),
),
);
},
);

View File

@ -415,6 +415,7 @@ class _AttachmentZoomDetailPopup extends StatelessWidget {
],
).padding(horizontal: 20, top: 16, bottom: 12),
Expanded(
child: SingleChildScrollView(
child: Table(
columnWidths: {
0: IntrinsicColumnWidth(),
@ -487,6 +488,7 @@ class _AttachmentZoomDetailPopup extends StatelessWidget {
],
).padding(horizontal: 20, vertical: 8),
),
),
],
),
);

View File

@ -94,11 +94,14 @@ class _LinkPreviewEntry extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (meta.icon?.isNotEmpty ?? false)
StyledWidget(
meta.icon!.endsWith('.svg')
? SvgPicture.network(meta.icon!)
SizedBox(
width: 36,
height: 36,
child: meta.icon!.endsWith('.svg')
? SvgPicture.network(meta.icon!, width: 36, height: 36)
: UniversalImage(
meta.icon!,
noErrorWidget: true,
width: 36,
height: 36,
cacheHeight: 36,

View File

@ -256,9 +256,8 @@ class PostItem extends StatelessWidget {
AttachmentList(
data: displayableAttachments!,
bordered: true,
gridded: true,
maxHeight: showFullPost ? null : 480,
minWidth: 640,
maxWidth: MediaQuery.of(context).size.width - 20,
fit: showFullPost ? BoxFit.cover : BoxFit.contain,
padding: const EdgeInsets.symmetric(horizontal: 12),
),