StrokePainter class

This stroke painter is needed because Flutter's built in stroke for containers only does inside strokes and doesn't do dotted borders.

TODO: We can use Path.extractPath to get proper curved segments instead of using tangents and all the math and logic we're doing right now. Alternatively, we can use a CustomClipper to clip out the full stroke path for dotted borders.

Inheritance

Constructors

StrokePainter({double strokeWidth = 1, Color color = Colors.black, double strokeMiterLimit = 4, List<double> dashPattern = const [], BoxShape boxShape = BoxShape.rectangle, StrokeSide strokeSide = StrokeSide.all, StrokeAlignC strokeAlign = StrokeAlignC.inside, StrokeCapEnum strokeCap = StrokeCapEnum.square, BorderRadius borderRadius = BorderRadius.zero})
The constructor for the stroke painter.

Properties

border Border
The border of the box. This is constructed from the other properties.
final
borderRadius BorderRadius
The border radius of the box.
final
boxShape BoxShape
The shape of the box. Whether it is a rectangle or a circle.
final
color Color
The color of the stroke.
final
dashArray LoopingList<double>
A helper list to iterate the dashes cleanly for dashed or dotted borders. This is constructed from the dash pattern.
final
dashPattern List<double>
The dash pattern of the stroke. Empty if solid.
final
hashCode int
The hash code for this object.
no setterinherited
isCenter double
A convenience getter for the inside alignment of the stroke. Helps simplify some calculations.
no setter
isInside double
A convenience getter for the inside alignment of the stroke. Helps simplify some calculations.
no setter
isOutside double
A convenience getter for the inside alignment of the stroke. Helps simplify some calculations.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsBuilder SemanticsBuilderCallback?
Returns a function that builds semantic information for the picture drawn by this painter.
no setterinherited
strokeAlign → StrokeAlignC
The alignment of the stroke. Whether it is inside, outside, or centered.
final
strokeCap → StrokeCapEnum
The cap shape of the stroke.
final
strokeMiterLimit double
The miter limit of the stroke.
final
strokeSide → StrokeSide
The side of the stroke. Whether it is all, top, bottom, left, or right.
final
strokeWidth double
The width of the stroke.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be notified when it is time to repaint.
inherited
hitTest(Offset position) bool?
Called whenever a hit test is being performed on an object that is using this custom paint delegate.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas, Size size) → void
Called whenever the object needs to paint. The given Canvas has its coordinate space configured such that the origin is at the top left of the box. The area of the box is the size of the size argument.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies when it is time to repaint.
inherited
shouldRebuildSemantics(covariant CustomPainter oldDelegate) bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
inherited
shouldRepaint(covariant StrokePainter oldDelegate) bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited