build method
构建描边文本组件
@return 包含描边效果的Text组件
Implementation
@override
Widget build(BuildContext context) {
Paint paint = Paint()
..style = PaintingStyle.stroke
..strokeJoin = strokeJoin
..strokeWidth = strokeWidth
..strokeCap = strokeCap
..color = strokeColor;
TextStyle currentStyle = style == null
? TextStyle(foreground: paint)
: style!.copyWith(foreground: paint);
return Text(
text,
style: currentStyle,
textAlign: textAlign,
textDirection: textDirection,
locale: locale,
softWrap: softWrap,
overflow: overflow,
textScaler: TextScaler.linear(textScaleFactor ?? 1),
maxLines: maxLines,
);
}