Fix comment overflow. Close #237

This commit is contained in:
2025-03-04 15:36:02 +08:00
parent 7b5c13200d
commit d089163220
2 changed files with 13 additions and 4 deletions

View File

@@ -651,10 +651,16 @@ class _CommentImage {
} }
class RichCommentContent extends StatefulWidget { class RichCommentContent extends StatefulWidget {
const RichCommentContent({super.key, required this.text}); const RichCommentContent({
super.key,
required this.text,
this.showImages = true,
});
final String text; final String text;
final bool showImages;
@override @override
State<RichCommentContent> createState() => _RichCommentContentState(); State<RichCommentContent> createState() => _RichCommentContentState();
} }
@@ -808,7 +814,7 @@ class _RichCommentContentState extends State<RichCommentContent> {
children: textSpan, children: textSpan,
), ),
); );
if (images.isNotEmpty) { if (images.isNotEmpty && widget.showImages) {
content = Column( content = Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [

View File

@@ -138,7 +138,10 @@ class _CommentWidget extends StatelessWidget {
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Expanded( Expanded(
child: RichCommentContent(text: comment.content).fixWidth(324), child: RichCommentContent(
text: comment.content,
showImages: false,
).fixWidth(324),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
if (comment.time != null) if (comment.time != null)
@@ -147,4 +150,4 @@ class _CommentWidget extends StatelessWidget {
), ),
); );
} }
} }