chore: More minimal matrix pill

pull/953/head
Krille 1 year ago
parent 7e0dcc3058
commit f0b66fda0a
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652

@ -147,7 +147,7 @@ class HtmlMessage extends StatelessWidget {
), ),
}, },
extensions: [ extensions: [
RoomPillExtension(context, room), RoomPillExtension(context, room, fontSize),
CodeExtension(fontSize: fontSize), CodeExtension(fontSize: fontSize),
MatrixMathExtension( MatrixMathExtension(
style: TextStyle(fontSize: fontSize, color: textColor), style: TextStyle(fontSize: fontSize, color: textColor),
@ -432,8 +432,9 @@ class FallbackTextExtension extends HtmlExtension {
class RoomPillExtension extends HtmlExtension { class RoomPillExtension extends HtmlExtension {
final Room room; final Room room;
final BuildContext context; final BuildContext context;
final double fontSize;
RoomPillExtension(this.context, this.room); RoomPillExtension(this.context, this.room, this.fontSize);
@override @override
Set<String> get supportedTags => {'a'}; Set<String> get supportedTags => {'a'};
@ -470,6 +471,7 @@ class RoomPillExtension extends HtmlExtension {
avatar: _cachedUsers[room.id + matrixId]?.avatarUrl, avatar: _cachedUsers[room.id + matrixId]?.avatarUrl,
uri: href, uri: href,
outerContext: this.context, outerContext: this.context,
fontSize: fontSize,
), ),
), ),
); );
@ -485,6 +487,7 @@ class RoomPillExtension extends HtmlExtension {
avatar: room.avatar, avatar: room.avatar,
uri: href, uri: href,
outerContext: this.context, outerContext: this.context,
fontSize: fontSize,
), ),
); );
} }
@ -499,6 +502,7 @@ class MatrixPill extends StatelessWidget {
final BuildContext outerContext; final BuildContext outerContext;
final Uri? avatar; final Uri? avatar;
final String uri; final String uri;
final double? fontSize;
const MatrixPill({ const MatrixPill({
super.key, super.key,
@ -506,23 +510,13 @@ class MatrixPill extends StatelessWidget {
required this.outerContext, required this.outerContext,
this.avatar, this.avatar,
required this.uri, required this.uri,
required this.fontSize,
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: UrlLauncher(outerContext, uri).launchUrl, onTap: UrlLauncher(outerContext, uri).launchUrl,
child: Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
side: BorderSide(
color: Theme.of(outerContext).colorScheme.onPrimaryContainer,
width: 0.5,
),
),
color: Theme.of(outerContext).colorScheme.primaryContainer,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 6.0),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -535,13 +529,13 @@ class MatrixPill extends StatelessWidget {
Text( Text(
name, name,
style: TextStyle( style: TextStyle(
color: Theme.of(outerContext).colorScheme.onPrimaryContainer, color: Theme.of(outerContext).colorScheme.primary,
decoration: TextDecoration.underline,
fontSize: fontSize,
), ),
), ),
], ],
), ),
),
),
); );
} }
} }

Loading…
Cancel
Save