feat(chat): make messagePreviewMaxLines configurable, with default 128

This commit is contained in:
Halil Kaskavalci 2026-04-10 21:51:37 +02:00
commit bcc4d4d204
No known key found for this signature in database
GPG key ID: 661B952D20DB9835
3 changed files with 11 additions and 2 deletions

View file

@ -1,4 +1,5 @@
import 'package:collection/collection.dart';
import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/utils/code_highlight_theme.dart';
import 'package:fluffychat/utils/event_checkbox_extension.dart';
import 'package:fluffychat/widgets/avatar.dart';
@ -509,11 +510,15 @@ class HtmlMessage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final element = parser.parse(html).body ?? dom.Element.html('');
final configuredMaxLines = AppSettings.messagePreviewMaxLines.value;
final maxLines = !limitHeight || configuredMaxLines <= 0
? null
: configuredMaxLines;
return Text.rich(
_renderHtml(element, context),
style: TextStyle(fontSize: fontSize, color: textColor),
maxLines: limitHeight ? 64 : null,
overflow: TextOverflow.fade,
maxLines: maxLines,
overflow: maxLines == null ? TextOverflow.visible : TextOverflow.fade,
selectionColor: textColor.withAlpha(128),
);
}