fix inline images not getting spoilered

This commit is contained in:
Henry Hiles 2026-11-28 11:42:34 -05:00
commit 9f2d223809
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 12 additions and 9 deletions

View file

@ -8,7 +8,7 @@ import "package:nexus/helpers/launch_helper.dart";
import "package:nexus/helpers/mxc_image.dart";
import "package:nexus/widgets/common/expandable_image.dart";
import "package:nexus/widgets/html/mention_chip.dart";
import "package:nexus/widgets/html/spoiler_text.dart";
import "package:nexus/widgets/html/spoiler.dart";
import "package:nexus/widgets/html/code_block.dart";
import "package:nexus/widgets/html/quoted.dart";
@ -29,7 +29,11 @@ class const Html(
}
if (element.attributes.keys.contains("data-mx-spoiler")) {
return InlineCustomWidget(child: SpoilerText(element.text));
return InlineCustomWidget(
child: Spoiler(
Html(element.innerHtml, textStyle: textStyle, roomId: roomId),
),
);
}
final height =

View file

@ -1,7 +1,7 @@
import "package:material_ui/material_ui.dart";
import "package:flutter_hooks/flutter_hooks.dart";
class const SpoilerText(final String text, {super.key}) extends HookWidget {
class const Spoiler(final Widget child, {super.key}) extends HookWidget {
@override
Widget build(BuildContext context) {
final revealed = useState(false);
@ -11,15 +11,14 @@ class const SpoilerText(final String text, {super.key}) extends HookWidget {
child: AnimatedContainer(
duration: Durations.short2,
decoration: BoxDecoration(
color: revealed.value
? Colors.blueGrey.withValues(alpha: 0.3)
: Colors.blueGrey,
color: Colors.blueGrey.withValues(alpha: 0.3),
borderRadius: .circular(4),
),
child: Text(
text,
style: .new(color: revealed.value ? null : Colors.transparent),
foregroundDecoration: BoxDecoration(
color: revealed.value ? Colors.transparent : Colors.blueGrey,
borderRadius: .circular(4),
),
child: IgnorePointer(ignoring: !revealed.value, child: child),
),
);
}