chore: Follow up html styling

This commit is contained in:
Krille 2023-05-19 08:14:48 +02:00
parent a4397e9cec
commit b62c41ce57
No known key found for this signature in database
1 changed files with 34 additions and 13 deletions

View File

@ -14,13 +14,13 @@ import '../../../utils/url_launcher.dart';
class HtmlMessage extends StatelessWidget {
final String html;
final Room room;
final Color? textColor;
final Color textColor;
const HtmlMessage({
Key? key,
required this.html,
required this.room,
this.textColor,
this.textColor = Colors.black,
}) : super(key: key);
@override
@ -52,24 +52,45 @@ class HtmlMessage extends StatelessWidget {
margin: Margins.all(0),
fontSize: FontSize(fontSize),
),
'a': Style(color: textColor?.withAlpha(150)),
'h1': Style(fontSize: FontSize(fontSize * 3)),
'h2': Style(fontSize: FontSize(fontSize * 2.5)),
'h3': Style(fontSize: FontSize(fontSize * 2)),
'h4': Style(fontSize: FontSize(fontSize * 1.75)),
'h5': Style(fontSize: FontSize(fontSize * 1.5)),
'h6': Style(fontSize: FontSize(fontSize * 1.25)),
'a': Style(color: textColor.withAlpha(150)),
'h1': Style(
fontSize: FontSize(fontSize * 2),
lineHeight: LineHeight.number(1.5),
fontWeight: FontWeight.w600,
),
'h2': Style(
fontSize: FontSize(fontSize * 1.75),
lineHeight: LineHeight.number(1.5),
fontWeight: FontWeight.w500,
),
'h3': Style(
fontSize: FontSize(fontSize * 1.5),
lineHeight: LineHeight.number(1.5),
),
'h4': Style(
fontSize: FontSize(fontSize * 1.25),
lineHeight: LineHeight.number(1.5),
),
'h5': Style(
fontSize: FontSize(fontSize * 1.25),
lineHeight: LineHeight.number(1.5),
),
'h6': Style(
fontSize: FontSize(fontSize),
lineHeight: LineHeight.number(1.5),
),
'blockquote': Style(
border: Border(
left: BorderSide(
width: 3,
color: textColor ?? Colors.black,
color: textColor,
),
),
padding: const EdgeInsets.only(left: 6),
padding: const EdgeInsets.only(left: 6, bottom: 0),
),
'hr': Style(
border: Border.all(color: textColor, width: 0.5),
),
// Otherwise list tiles are all in the same row$$
'li': Style(display: Display.block),
},
extensions: [
UserPillExtension(context, room),