toPaint method

Paint toPaint()

Create a Paint object that, if used to stroke a line, will draw the line in this border's style.

The strokeAlign property is not reflected in the Paint; consumers must implement that directly by inflating or deflating their region appropriately.

Not all borders use this method to paint their border sides. For example, non-uniform rectangular Borders have beveled edges and so paint their border sides as filled shapes rather than using a stroke.

Implementation

Paint toPaint() {
  switch (style) {
    case BorderStyle.solid:
      return Paint()
        ..color = color
        ..strokeWidth = width
        ..style = PaintingStyle.stroke;
    case BorderStyle.none:
      return Paint()
        ..color = const Color(0x00000000)
        ..strokeWidth = 0.0
        ..style = PaintingStyle.stroke;
  }
}