put bridge for link colors
This commit is contained in:
parent
a090d88a23
commit
0887421f3e
1 changed files with 118 additions and 110 deletions
|
|
@ -18,7 +18,9 @@ class const Html(
|
||||||
super.key,
|
super.key,
|
||||||
}) extends ConsumerWidget {
|
}) extends ConsumerWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) => HtmlWidget(
|
Widget build(BuildContext context, WidgetRef ref) =>
|
||||||
|
MaterialUiCompatibilityBridge(
|
||||||
|
child: HtmlWidget(
|
||||||
html,
|
html,
|
||||||
buildAsync: false,
|
buildAsync: false,
|
||||||
textStyle: textStyle,
|
textStyle: textStyle,
|
||||||
|
|
@ -33,7 +35,9 @@ class const Html(
|
||||||
|
|
||||||
final height =
|
final height =
|
||||||
int.tryParse(element.attributes["height"] ?? "") ??
|
int.tryParse(element.attributes["height"] ?? "") ??
|
||||||
(element.attributes.keys.contains("data-mx-emoticon") ? 32 : null) ??
|
(element.attributes.keys.contains("data-mx-emoticon")
|
||||||
|
? 32
|
||||||
|
: null) ??
|
||||||
300;
|
300;
|
||||||
final width = int.tryParse(element.attributes["width"] ?? "");
|
final width = int.tryParse(element.attributes["width"] ?? "");
|
||||||
final src = Uri.tryParse(element.attributes["src"] ?? "");
|
final src = Uri.tryParse(element.attributes["src"] ?? "");
|
||||||
|
|
@ -69,7 +73,9 @@ class const Html(
|
||||||
image: MxcImage(ref, .new(mxc: src)),
|
image: MxcImage(ref, .new(mxc: src)),
|
||||||
errorBuilder: (_, error, _) => Text(
|
errorBuilder: (_, error, _) => Text(
|
||||||
"Image Failed to Load",
|
"Image Failed to Load",
|
||||||
style: .new(color: Theme.of(context).colorScheme.error),
|
style: .new(
|
||||||
|
color: Theme.of(context).colorScheme.error,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
height: height.toDouble(),
|
height: height.toDouble(),
|
||||||
width: width?.toDouble(),
|
width: width?.toDouble(),
|
||||||
|
|
@ -135,6 +141,8 @@ class const Html(
|
||||||
.nonNulls,
|
.nonNulls,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
onTapUrl: (url) => ref.watch(LaunchHelper.provider).launchUrl(.parse(url)),
|
onTapUrl: (url) =>
|
||||||
|
ref.watch(LaunchHelper.provider).launchUrl(.parse(url)),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue