Clearer revealed spoilers

Fixes #184
This commit is contained in:
Henry Hiles 2026-11-25 15:50:59 -05:00
commit 3ba258d6b4
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 6 additions and 5 deletions

View file

@ -92,19 +92,19 @@ class ComposerDraftController(final ComposerParams composer)
({String text, IList<Tag> tags}) _restoreTags(String text) { ({String text, IList<Tag> tags}) _restoreTags(String text) {
final rooms = ref.read(RoomsController.provider); final rooms = ref.read(RoomsController.provider);
Tag tagOf(Match match) => switch ((match[1], match[2], match[3])) { Tag tagOf(Match match) => switch ((match[1], match[2], match[3])) {
(final userId?, _, _) => Tag( (final userId?, _, _) => .new(
id: match[0]!, id: match[0]!,
text: userId.split(":").first, text: userId.split(":").first,
triggerCharacter: "@", triggerCharacter: "@",
), ),
(_, final roomId?, _) => Tag( (_, final roomId?, _) => .new(
id: match[0]!, id: match[0]!,
text: text:
rooms["!$roomId"]?.metadata?.canonicalAlias?.localpart ?? rooms["!$roomId"]?.metadata?.canonicalAlias?.localpart ??
"!$roomId", "!$roomId",
triggerCharacter: "#", triggerCharacter: "#",
), ),
(_, _, final shortcode) => Tag( (_, _, final shortcode) => .new(
id: match[0]!, id: match[0]!,
text: shortcode!, text: shortcode!,
triggerCharacter: ":", triggerCharacter: ":",

View file

@ -10,9 +10,10 @@ class const SpoilerText(final String text, {super.key}) extends HookWidget {
onTap: () => revealed.value = !revealed.value, onTap: () => revealed.value = !revealed.value,
child: AnimatedContainer( child: AnimatedContainer(
duration: Durations.short2, duration: Durations.short2,
padding: const .symmetric(horizontal: 4, vertical: 2),
decoration: BoxDecoration( decoration: BoxDecoration(
color: revealed.value ? Colors.transparent : Colors.blueGrey, color: revealed.value
? Colors.blueGrey.withValues(alpha: 0.3)
: Colors.blueGrey,
borderRadius: .circular(4), borderRadius: .circular(4),
), ),
child: Text( child: Text(