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/helpers/mxc_image.dart";
|
||||||
import "package:nexus/widgets/common/expandable_image.dart";
|
import "package:nexus/widgets/common/expandable_image.dart";
|
||||||
import "package:nexus/widgets/html/mention_chip.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/code_block.dart";
|
||||||
import "package:nexus/widgets/html/quoted.dart";
|
import "package:nexus/widgets/html/quoted.dart";
|
||||||
|
|
||||||
|
|
@ -29,7 +29,11 @@ class const Html(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.attributes.keys.contains("data-mx-spoiler")) {
|
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 =
|
final height =
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import "package:material_ui/material_ui.dart";
|
import "package:material_ui/material_ui.dart";
|
||||||
import "package:flutter_hooks/flutter_hooks.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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final revealed = useState(false);
|
final revealed = useState(false);
|
||||||
|
|
@ -11,15 +11,14 @@ class const SpoilerText(final String text, {super.key}) extends HookWidget {
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: Durations.short2,
|
duration: Durations.short2,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: revealed.value
|
color: Colors.blueGrey.withValues(alpha: 0.3),
|
||||||
? Colors.blueGrey.withValues(alpha: 0.3)
|
|
||||||
: Colors.blueGrey,
|
|
||||||
borderRadius: .circular(4),
|
borderRadius: .circular(4),
|
||||||
),
|
),
|
||||||
child: Text(
|
foregroundDecoration: BoxDecoration(
|
||||||
text,
|
color: revealed.value ? Colors.transparent : Colors.blueGrey,
|
||||||
style: .new(color: revealed.value ? null : Colors.transparent),
|
borderRadius: .circular(4),
|
||||||
),
|
),
|
||||||
|
child: IgnorePointer(ignoring: !revealed.value, child: child),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue