From 1cd3dad8abcfacbd77fdd9e11ea9e53878332be1 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 4 Dec 2025 19:13:31 -0500 Subject: [PATCH] Add mentions, kind of --- README.md | 6 +++--- lib/widgets/chat_page/html/html.dart | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f7e068c..7dc61cb 100644 --- a/README.md +++ b/README.md @@ -60,11 +60,11 @@ A simple and user-friendly Matrix client made with Flutter and the Matrix Dart S - [ ] Downloading attachments - [ ] Opening attachments in their own view - [ ] Mentions - - [ ] Users - - [ ] Rooms + - [x] Users + - [x] Rooms - [ ] Plain text - [ ] Matrix URIs - - [ ] Matrix.to links + - [x] Matrix.to links - [x] Custom emojis/stickers - [ ] Encrypted messages - [x] History loading diff --git a/lib/widgets/chat_page/html/html.dart b/lib/widgets/chat_page/html/html.dart index 01a0345..dcb4e4f 100644 --- a/lib/widgets/chat_page/html/html.dart +++ b/lib/widgets/chat_page/html/html.dart @@ -36,6 +36,26 @@ class Html extends ConsumerWidget { "blockquote" => Quoted(Html(element.innerHtml, client: client)), + "a" => + Uri.tryParse(element.attributes["href"] ?? "")?.host == "matrix.to" + ? InlineCustomWidget( + child: ActionChip( + label: Text( + element.text, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.onPrimary, + ), + ), + backgroundColor: Theme.of(context).colorScheme.primary, + onPressed: () { + // TODO: Open room or join room dialog, or user popover + showAboutDialog(context: context); + }, + ), + ) + : null, + "img" => element.attributes["src"] == null ? null @@ -90,7 +110,6 @@ class Html extends ConsumerWidget { "h5" || "h6" || "p" || - "a" || "ul" || "ol" || "sup" ||