您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Flutter:仅在传递给文本小部件之前,才可以在字符串中格式化(粗体,斜体等)吗?

Flutter:仅在传递给文本小部件之前,才可以在字符串中格式化(粗体,斜体等)吗?

您可以为此使用flutter_html_view包。

String html = '<bold>Hello<bold> World';

new HtmlTextView(data: html);

如果您只想使用不同的样式,则可以使用像@L_404_2@的RichText小部件。TextSpans

new RichText( text: new TextSpan(text: 'Hello ', style: DefaultTextStyle.of(context).style, children:          
<TextSpan>[
new TextSpan(text: 'bold', style: new TextStyle(fontWeight: FontWeight.bold)), 
new TextSpan(text: ' world!'), 
], ), )
其他 2022/1/1 18:15:29 有551人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶