strokeAlign property

double strokeAlign
final

The relative position of the stroke on a BorderSide in an OutlinedBorder or Border.

Values typically range from -1.0 (strokeAlignInside, inside border, default) to 1.0 (strokeAlignOutside, outside border), without any bound constraints (e.g., a value of -2.0 is not typical, but allowed). A value of 0 (strokeAlignCenter) will center the border on the edge of the widget.

When set to strokeAlignInside, the stroke is drawn completely inside the widget. For strokeAlignCenter and strokeAlignOutside, a property such as Container.clipBehavior can be used in an outside widget to clip it. If Container.decoration has a border, the container may incorporate width as additional padding:

This property is not honored by toPaint (because the Paint object cannot represent it); it is intended that classes that use BorderSide objects implement this property when painting borders by suitably inflating or deflating their regions.

This example shows an animation of how strokeAlign affects the drawing when applied to borders of various shapes.
link

To create a local project with this code sample, run:
flutter create --sample=painting.BorderSide.strokeAlign.1 mysample

Implementation

final double strokeAlign;