decorationThickness property Null safety
final
The thickness of the decoration stroke as a multiplier of the thickness defined by the font.
The font provides a base stroke width for decorations which scales off of the fontSize. This property may be used to achieve a thinner or thicker decoration stroke, without changing the fontSize. For example, a decorationThickness of 2.0 will draw a decoration twice as thick as the font defined decoration thickness.
To achieve a bolded strike-through, we can apply a thicker stroke for the
decoration.
const Text(
'This has a very BOLD strike through!',
style: TextStyle(
decoration: TextDecoration.lineThrough,
decorationThickness: 2.85,
),
)
We can apply a very thin and subtle wavy underline (perhaps, when words
are misspelled) by using a decorationThickness < 1.0.
const Text(
'oopsIforgottousespaces!',
style: TextStyle(
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.wavy,
decorationColor: Colors.red,
decorationThickness: 0.5,
),
)
The default decorationThickness is 1.0, which will use the font's base stroke thickness/width.
Implementation
final double? decorationThickness;