4

Im trying getting some space in Richttext. First heres my code

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

And what I want is some space between the this

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

And this

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

Hope anyone can help. If you need a picture how it looks at the moment please leave a comment

quoci
  • 2,940
  • 1
  • 9
  • 21

1 Answers1

8

You can use a SizedBox like below :

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,
            ),
          )
        ],
      ),
    )
Aman Verma
  • 818
  • 5
  • 17