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 { class HtmlMessage extends StatelessWidget {
final String html; final String html;
final Room room; final Room room;
final Color? textColor; final Color textColor;
const HtmlMessage({ const HtmlMessage({
Key? key, Key? key,
required this.html, required this.html,
required this.room, required this.room,
this.textColor, this.textColor = Colors.black,
}) : super(key: key); }) : super(key: key);
@override @override
@ -52,24 +52,45 @@ class HtmlMessage extends StatelessWidget {
margin: Margins.all(0), margin: Margins.all(0),
fontSize: FontSize(fontSize), fontSize: FontSize(fontSize),
), ),
'a': Style(color: textColor?.withAlpha(150)), 'a': Style(color: textColor.withAlpha(150)),
'h1': Style(fontSize: FontSize(fontSize * 3)), 'h1': Style(
'h2': Style(fontSize: FontSize(fontSize * 2.5)), fontSize: FontSize(fontSize * 2),
'h3': Style(fontSize: FontSize(fontSize * 2)), lineHeight: LineHeight.number(1.5),
'h4': Style(fontSize: FontSize(fontSize * 1.75)), fontWeight: FontWeight.w600,
'h5': Style(fontSize: FontSize(fontSize * 1.5)), ),
'h6': Style(fontSize: FontSize(fontSize * 1.25)), '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( 'blockquote': Style(
border: Border( border: Border(
left: BorderSide( left: BorderSide(
width: 3, 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: [ extensions: [
UserPillExtension(context, room), UserPillExtension(context, room),