strokeAlign property Null safety

double strokeAlign

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 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 example shows an animation of how strokeAlign affects the drawing when applied to borders of various shapes.

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


final double strokeAlign;