forked from Nexus/nexus
fix inline images not getting spoilered
This commit is contained in:
parent
a7e60b9464
commit
9f2d223809
2 changed files with 12 additions and 9 deletions
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue