Add max height to attachments

This commit is contained in:
LittleSheep 2024-07-12 22:50:52 +08:00
parent 156e6f1075
commit df7348e117
2 changed files with 17 additions and 8 deletions

View File

@ -1,5 +1,3 @@
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:solian/models/event.dart'; import 'package:solian/models/event.dart';
@ -25,9 +23,13 @@ class ChatEventMessage extends StatelessWidget {
Widget buildAttachment(BuildContext context) { Widget buildAttachment(BuildContext context) {
final body = EventMessageBody.fromJson(item.body); final body = EventMessageBody.fromJson(item.body);
return SizedBox( return Container(
key: Key('m${item.uuid}attachments-box'), key: Key('m${item.uuid}attachments-box'),
width: min(MediaQuery.of(context).size.width, 640), width: MediaQuery.of(context).size.width,
constraints: const BoxConstraints(
maxHeight: 720,
maxWidth: 640,
),
child: AttachmentList( child: AttachmentList(
key: Key('m${item.uuid}attachments'), key: Key('m${item.uuid}attachments'),
parentId: item.uuid, parentId: item.uuid,

View File

@ -270,11 +270,18 @@ class _PostItemState extends State<PostItem> {
right: 16, right: 16,
left: 16, left: 16,
), ),
AttachmentList( Container(
width: MediaQuery.of(context).size.width,
constraints: const BoxConstraints(
maxHeight: 720,
maxWidth: 640,
),
child: AttachmentList(
parentId: widget.item.alias, parentId: widget.item.alias,
attachmentsId: item.attachments ?? List.empty(), attachmentsId: item.attachments ?? List.empty(),
divided: true, divided: true,
), ),
),
if (widget.isShowReply && widget.isReactable) if (widget.isShowReply && widget.isReactable)
PostQuickAction( PostQuickAction(
isShowReply: widget.isShowReply, isShowReply: widget.isShowReply,