【问题标题】:How to get some space between in Richtext?如何在富文本中获得一些空间?
【发布时间】:2023-04-04 13:59:01
【问题描述】:

我正在尝试在 Richttext 中获得一些空间。首先是我的代码

 title: RichText(
  text: TextSpan(
    text: _snapshot.data['username'], // _snapshot.data['username']
    style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
    children: <TextSpan>[
      TextSpan(
        //"${comment.data()['comment']}"
        text: "${comment.data()['comment']}",
        style: TextStyle(
          fontWeight: FontWeight.normal,
        ),
      )
    ],
  ),
)

我想要的是这个之间的一些空间

  text: TextSpan(
    text: _snapshot.data['username'], // _snapshot.data['username']
    style: TextStyle(
      fontWeight: FontWeight.bold,
      color: Colors.black,
  )

还有这个

 children: <TextSpan>[
  TextSpan(
  //"${comment.data()['comment']}"
    text: "${comment.data()['comment']}",
    style: TextStyle(
    fontWeight: FontWeight.normal,
    ),
  ],
                                                ),

希望任何人都可以提供帮助。如果你需要一张照片现在的样子,请发表评论

【问题讨论】:

    标签: flutter dart material-design richtextbox richtext


    【解决方案1】:

    您可以使用如下所示的 SizedBox:

    RichText(
          text: TextSpan(
            text: "Test:",
            style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black),
            children: <InlineSpan>[
              WidgetSpan(
                  alignment: PlaceholderAlignment.baseline,
                  baseline: TextBaseline.alphabetic,
                  child: SizedBox(width: 10)),
              TextSpan(
                text: "Data",
                style: TextStyle(
                  fontWeight: FontWeight.normal,
                ),
              )
            ],
          ),
        )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-26
      • 2011-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-26
      • 2014-10-31
      相关资源
      最近更新 更多