|
|
|
@ -53,58 +53,54 @@ class _WebContent extends State<WebContent> {
|
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
}, |
|
|
|
|
// customRender: { |
|
|
|
|
// "video": |
|
|
|
|
// (context, parsedChild) { |
|
|
|
|
// var src = attributes['src']; |
|
|
|
|
// parsedChild.toString() |
|
|
|
|
// return videoWidget( |
|
|
|
|
// double.tryParse(attributes['width'] ?? ""), |
|
|
|
|
// double.tryParse( |
|
|
|
|
// element.attributes['height'] ?? ""), |
|
|
|
|
// (src != null && |
|
|
|
|
// src != "" && |
|
|
|
|
// src.endsWith(".mp4")) |
|
|
|
|
// ? src |
|
|
|
|
// : element |
|
|
|
|
// .children.first.attributes["src"], |
|
|
|
|
// element.attributes["sandbox"]); |
|
|
|
|
// }, |
|
|
|
|
// "iframe": |
|
|
|
|
// (context, parsedChild) { |
|
|
|
|
// var src = attributes['src']; |
|
|
|
|
// return videoWidget( |
|
|
|
|
// double.tryParse(attributes['width'] ?? ""), |
|
|
|
|
// double.tryParse( |
|
|
|
|
// element.attributes['height'] ?? ""), |
|
|
|
|
// (src != null && |
|
|
|
|
// src != "" && |
|
|
|
|
// src.endsWith(".mp4")) |
|
|
|
|
// ? src |
|
|
|
|
// : element |
|
|
|
|
// .children.first.attributes["src"], |
|
|
|
|
// element.attributes["sandbox"]); |
|
|
|
|
// }, |
|
|
|
|
// "audio": |
|
|
|
|
// (context, parsedChild) { |
|
|
|
|
// final sources = <String>[ |
|
|
|
|
// if (element.attributes['src'] != null) |
|
|
|
|
// element.attributes['src'], |
|
|
|
|
// ]; |
|
|
|
|
// if (sources == null || |
|
|
|
|
// sources.isEmpty || |
|
|
|
|
// sources.first == null) { |
|
|
|
|
// return EmptyContentElement(); |
|
|
|
|
// } |
|
|
|
|
// return audioWidget( |
|
|
|
|
// attributes['controls'] != null, |
|
|
|
|
// attributes['loop'] != null, |
|
|
|
|
// attributes['autoplay'] != null, |
|
|
|
|
// sources, |
|
|
|
|
// context.style.width ?? 300.w, |
|
|
|
|
// ); |
|
|
|
|
// }, |
|
|
|
|
// }, |
|
|
|
|
customRender: { |
|
|
|
|
"video": |
|
|
|
|
(context, parsedChild) { |
|
|
|
|
var src = context.tree.element.attributes["src"]; |
|
|
|
|
return videoWidget( |
|
|
|
|
double.tryParse(context.tree.element.attributes["width"] ?? ""), |
|
|
|
|
double.tryParse( |
|
|
|
|
context.tree.element.attributes["height"] ?? ""), |
|
|
|
|
(src != null && |
|
|
|
|
src != "" && |
|
|
|
|
src.endsWith(".mp4")) |
|
|
|
|
? src |
|
|
|
|
: context.tree.children.first.attributes["src"], |
|
|
|
|
context.tree.attributes["sandbox"]); |
|
|
|
|
}, |
|
|
|
|
"iframe": |
|
|
|
|
(context, parsedChild) { |
|
|
|
|
var src = context.tree.element.children.firstWhere((element) => element.localName == "source").attributes["src"]; |
|
|
|
|
return videoWidget( |
|
|
|
|
double.tryParse(context.style.width ?? ""), |
|
|
|
|
double.tryParse(context.style.height ?? ""), |
|
|
|
|
(src != null && |
|
|
|
|
src != "" && |
|
|
|
|
src.endsWith(".mp4")) |
|
|
|
|
? src |
|
|
|
|
: context.tree.children.first.attributes["src"], |
|
|
|
|
context.tree.attributes["sandbox"]); |
|
|
|
|
}, |
|
|
|
|
"audio": |
|
|
|
|
(context, parsedChild) { |
|
|
|
|
final sources = <String>[ |
|
|
|
|
if (context.tree.attributes['src'] != null) |
|
|
|
|
context.tree.attributes['src'], |
|
|
|
|
]; |
|
|
|
|
if (sources == null || |
|
|
|
|
sources.isEmpty || |
|
|
|
|
sources.first == null) { |
|
|
|
|
return EmptyContentElement(); |
|
|
|
|
} |
|
|
|
|
return audioWidget( |
|
|
|
|
context.tree.attributes['controls'] != null, |
|
|
|
|
context.tree.attributes['loop'] != null, |
|
|
|
|
context.tree.attributes['autoplay'] != null, |
|
|
|
|
sources, |
|
|
|
|
context.style.width ?? 300.w, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|