Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make space between TextSpan

Tags:

flutter

I am trying to make space between TextSpan What is the best way to add space between TextSpan?

child: RichText(
        text: TextSpan(
          children: [
            TextSpan(
              text: 'Don\'t have an Account?',
              style: TextStyle(
                color: Colors.white,
                fontSize: 15.0,
                fontWeight: FontWeight.w400,
              ),
            ),
            
            TextSpan(
              text: 'Sign Up',
              style: TextStyle(
                color: Colors.white,
                fontSize: 15.0,
                fontWeight: FontWeight.bold,
              ),
            ),
          ],
        ),
      ),
like image 363
Taka Avatar asked Jul 16 '26 00:07

Taka


1 Answers

SizedBox widget can be used in between two widgets to add space between two widgets. use the SizedBox by wrapping it with a WidgetSpan widgit

child: RichText(
        text: TextSpan(
          children: [
            TextSpan(
              text: 'Don\'t have an Account?',
              style: TextStyle(
                color: Colors.white,
                fontSize: 15.0,
                fontWeight: FontWeight.w400,
              ),
            ),
            WidgetSpan(
             child: SizedBox(width: 10),
            ),
            TextSpan(
              text: 'Sign Up',
              style: TextStyle(
                color: Colors.white,
                fontSize: 15.0,
                fontWeight: FontWeight.bold,
              ),
            ),
          ],
        ),
      ),
like image 109
Samuel Olufemi Avatar answered Jul 18 '26 17:07

Samuel Olufemi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!