Flutter:flutter_markdown字体大小 [英] Flutter: flutter_markdown fontSize

查看:426
本文介绍了Flutter:flutter_markdown字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用flutter_markdown时是否可以更改文本的字体大小?诸如向Text小部件提供TextStyle之类的东西.谢谢!

Is there any way to change the font size of text when using flutter_markdown? Something like supplying a TextStyle to a Text widget. Thanks!

推荐答案

Markdown(
    data: html2md.convert(article.content),
    styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context))
                    .copyWith(
                       p: Theme.of(context).textTheme.body1.copyWith(fontSize: 12.0)
                    ),
)

您可以在markdown中覆盖特殊元素的文本样式,上面的示例代码可以覆盖markdown中的p元素(在html中为<p>元素)

you can overide text style of spesific element in markdown, code above example to overide p element from markdown (<p> element in html)

这篇关于Flutter:flutter_markdown字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆