Search code examples
flutterrichtexttextspan

Is there any trick to apply padding in one of my SpanText more than the other spanText or Rich Text's Padding?


RichText(
  textAlign:TextAlign.center,
  text:TextSpan(
    children:[
      TextSpan(
        text:'Create an Account to Continue \n \n',
        style:TextStyle(
          fontSize:17.0,
          fontWeight:FontWeight.bold,
          color:Colors.black,
        ),
      ),
      TextSpan(
        text:'By continuing You Agreed to Our ',
        style:TextStyle(
          fontSize:17.0,
          color:Colors.black45,
        ),
      ),
      TextSpan(
        text:'terms of services',
        style:TextStyle(
          fontSize:17.0,
          color:Colors.blue,
        ),
      ),
      TextSpan(
        text:'.',
        style:TextStyle(
          color:Colors.black,
        ),
      ),

    ],),
),

Solution

  • I don't think so, this is not the role of TextSpan widget, Padding is a graphic element and TextPan is a text element. You better do two RichText and apply padding on them, your code will be clearer.