微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 Richtext 之间获得一些空间?

如何解决如何在 Richtext 之间获得一些空间?

我正在尝试在 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,),)
    ],)

而我想要的是 this 之间的一些空间

  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,],

希望大家帮忙。如果您需要图片现在的样子,请发表评论

解决方法

您可以使用如下所示的 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,),)
        ],)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。