TextDecoration
是用来在文本附近绘制线性装饰的类.
目前有4个属性
lineThrough
在每行文字中画一条线 (删除线)
none
不做任何事情
overline
在每行文本上方画一条线 (上划线)
underline
在每行文本下面画一条线(下划线)
lineThrough
none
overline
underline
代码
TextStyle _getTextStyle(BuildContext context) {
return new TextStyle(
color: Colors.black54,
decoration: TextDecoration.overline,
);
}
new Text('巧克力?' , style: _getTextStyle(context),)
TextDecorationStyle
这枚举style可能控制画实线,虚线,两条线,点, 波浪线
/// The style in which to draw a text decoration
enum TextDecorationStyle {
///画一条直线
solid,
/// 画两条线
double,
/// 画圆点虚线
dotted,
/// 画破折号虚线
dashed,
/// 画波浪线
wavy
}
solid
double
dotted
dashed
wavy
只修改函数 _getTextStyle
TextStyle _getTextStyle(BuildContext context) {
return new TextStyle(
color: Colors.black54,
decoration: TextDecoration.overline,
decorationStyle: TextDecorationStyle.solid
);
}