【发布时间】:2019-02-12 07:19:03
【问题描述】:
我必须显示 html 文本,就像 android 提供 Html.fromHtml 来显示 htmltextview 一样,flutter 是否提供任何东西来显示 html 文本?
【问题讨论】:
标签: flutter mobile-application
我必须显示 html 文本,就像 android 提供 Html.fromHtml 来显示 htmltextview 一样,flutter 是否提供任何东西来显示 html 文本?
【问题讨论】:
标签: flutter mobile-application
有一些包可以做到这一点
https://pub.dartlang.org/packages/flutter_html 直接在 Flutter 中渲染 HTML 子集
【讨论】:
将以下内容添加到您的 pubspec.yaml 文件中:
dependencies:
flutter_html:
当前支持的 HTML 标签:
a、abbr、首字母缩略词、地址、文章、aside、b、bdi、bdo、big、blockquote、body、br、标题、引用、代码、数据、dd、del、dfn、div、dl、 dt, em, figcaption, 图, 页脚, h1, h2, h3, h4, h5, h6, 页眉, hr, i, img, ins, kbd, li, main, mark, nav, noscript, ol, p, pre, q,rp,rt,ruby,s,samp,section,small,span,strike,strong,sub,sup,table,tbody,td,模板,tfoot,th,thead,时间,tr,tt,u,ul,变量
示例用法:
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Html(
data: "<b>Hai</b>,
defaultTextStyle: TextStyle(fontSize: 15),
),
],
)
【讨论】: