使用 Flutter 的 TextStyle()课程,我怎样才能敲定一个旧价格?
TextStyle()
style: TextStyle(decoration: TextDecoration.lineThrough),
To apply strikethrough decoration to a Text widget directly:
Text
Text('\$8.99', style: TextStyle(decoration: TextDecoration.lineThrough))
You can also style separate spans of a paragraph by using the RichText widget, or the Text.rich() constructor.
RichText
Text.rich()
Based on this example code, to show a discounted price:
RichText()
new RichText( text: new TextSpan( text: 'This item costs ', children: <TextSpan>[ new TextSpan( text: '\$8.99', style: new TextStyle( color: Colors.grey, decoration: TextDecoration.lineThrough, ), ), new TextSpan( text: ' \$3.99', ), ], ), )
Text.rich(TextSpan( text: 'This item costs ', children: <TextSpan>[ new TextSpan( text: '\$8.99', style: new TextStyle( color: Colors.grey, decoration: TextDecoration.lineThrough, ), ), new TextSpan( text: ' \$3.99', ), ], ), )
i use this
Column( children: [ Text( "sample text" ), Divider(color: Colors.red,) ], ),