getInnerPath method Null safety
- Rect rect,
- {TextDirection? textDirection}
override
Create a Path that describes the inner edge of the border.
This path must not cross the path given by getOuterPath for the same Rect.
To obtain a Path that describes the area of the border itself, set the Path.fillType of the returned object to PathFillType.evenOdd, and add to this object the path returned from getOuterPath (using Path.addPath).
The textDirection
argument must be provided and non-null if the border
has a text direction dependency (for example if it is expressed in terms
of "start" and "end" instead of "left" and "right"). It may be null if
the border will not need the text direction to paint itself.
See also:
- getOuterPath, which creates the path for the outer edge.
- Path.contains, which can tell if an Offset is within a Path.
Implementation
@override
Path getInnerPath(Rect rect, { TextDirection? textDirection }) {
final RRect borderRect = borderRadius.resolve(textDirection).toRRect(rect);
final RRect adjustedRect;
switch (side.strokeAlign) {
case StrokeAlign.inside:
adjustedRect = borderRect.deflate(side.width);
break;
case StrokeAlign.center:
adjustedRect = borderRect.deflate(side.width / 2);
break;
case StrokeAlign.outside:
adjustedRect = borderRect;
break;
}
return Path()
..addRRect(adjustedRect);
}