如何使用Flutter编写带有项目符号点的段落? [英] How can I write a paragraph with bullet points using Flutter?

查看:148
本文介绍了如何使用Flutter编写带有项目符号点的段落?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用HTML,我可以在这样的段落中添加一个项目符号:

Using HTML I can add a bullet points to a paragraph like this:

<ul>
   <li> example </li>
   <li> example </li>
   <li> example </li>
<ul>

如何在Flutter中编写项目符号表格?

How can I write bullet point form in Flutter?

new Text(''),

推荐答案

为此使用降价是过大的.到目前为止,使用字符更加容易.

Using markdown for this is overkill. Using character is by far easier.

如果您懒得复制粘贴字符,这是一个自定义的Text,可以为您完成此操作:

If you're too lazy to copy paste the character, here's a custom Text that does it for you:

class Bullet extends Text {
  const Bullet(
    String data, {
    Key key,
    TextStyle style,
    TextAlign textAlign,
    TextDirection textDirection,
    Locale locale,
    bool softWrap,
    TextOverflow overflow,
    double textScaleFactor,
    int maxLines,
    String semanticsLabel,
  }) : super(
          '• ${data}',
          key: key,
          style: style,
          textAlign: textAlign,
          textDirection: textDirection,
          locale: locale,
          softWrap: softWrap,
          overflow: overflow,
          textScaleFactor: textScaleFactor,
          maxLines: maxLines,
          semanticsLabel: semanticsLabel,
        );
}

这篇关于如何使用Flutter编写带有项目符号点的段落?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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