Skip to content

BorderSide

BorderSide #

Creates the side of a border.

By default, the border is 1.0 logical pixels wide and solid black color.

RAISES DESCRIPTION
AssertionError

if width is negative.

color #

color: ColorValue = BLACK

The color of this side of the border.

stroke_align #

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

stroke_inset #

stroke_inset

The amount of the stroke width that lies inside of the BorderSide.

For example, this will return the width for a stroke_align of -1, half the width for a stroke_align of 0, and 0 for a stroke_align of 1.

stroke_offset #

stroke_offset

The offset of the stroke, taking into account the stroke alignment.

For example, this will return the negative width of the stroke for a stroke_align of -1, 0 for a stroke_align of 0, and the width for a stroke_align of -1.

stroke_outset #

stroke_outset

The amount of the stroke width that lies outside of the [BorderSide].

For example, this will return 0 for a stroke_align of -1, half the width for a stroke_align of 0, and the width for a stroke_align of 1.

style #

style: BorderStyle = SOLID

The style of this side of the border.

To omit a side, set style to BorderStyle.NONE. This skips painting the border, but the border still has a width.

width #

width: Number = 1.0

The width of this side of the border, in logical pixels.

Setting width to 0.0 will result in a hairline border. This means that the border will have the width of one physical pixel. Hairline rendering takes shortcuts when the path overlaps a pixel more than once. This means that it will render faster than otherwise, but it might double-hit pixels, giving it a slightly darker/lighter result.

To omit the border entirely, set the style to BorderStyle.NONE.

copy_with #

copy_with(
    *,
    width: Number | None = None,
    color: ColorValue | None = None,
    stroke_align: BorderSideStrokeAlignValue | None = None,
) -> BorderSide

Returns a copy of this object with the specified properties overridden.

none #

none() -> BorderSide

A hairline black border that is not rendered.