chore: More minimal matrix pill
This commit is contained in:
parent
7e0dcc3058
commit
f0b66fda0a
1 changed files with 23 additions and 29 deletions
|
|
@ -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,41 +510,31 @@ 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(
|
child: Row(
|
||||||
shape: RoundedRectangleBorder(
|
mainAxisSize: MainAxisSize.min,
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
children: [
|
||||||
side: BorderSide(
|
Avatar(
|
||||||
color: Theme.of(outerContext).colorScheme.onPrimaryContainer,
|
mxContent: avatar,
|
||||||
width: 0.5,
|
name: name,
|
||||||
|
size: 16,
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 6),
|
||||||
color: Theme.of(outerContext).colorScheme.primaryContainer,
|
Text(
|
||||||
child: Padding(
|
name,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
style: TextStyle(
|
||||||
child: Row(
|
color: Theme.of(outerContext).colorScheme.primary,
|
||||||
mainAxisSize: MainAxisSize.min,
|
decoration: TextDecoration.underline,
|
||||||
children: [
|
fontSize: fontSize,
|
||||||
Avatar(
|
),
|
||||||
mxContent: avatar,
|
|
||||||
name: name,
|
|
||||||
size: 16,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
Text(
|
|
||||||
name,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(outerContext).colorScheme.onPrimaryContainer,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue