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

4 richtextbox richtext dart material-design flutter

我正在尝试在 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,
        ),
      )
    ],
  ),
)
Run Code Online (Sandbox Code Playgroud)

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

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

和这个

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

希望任何人都可以提供帮助。如果您需要一张目前的图片,请发表评论

Ama*_*rma 9

您可以使用如下所示的 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,
            ),
          )
        ],
      ),
    )
Run Code Online (Sandbox Code Playgroud)