createPath method

  1. @override
Path createPath(
  1. Offset offset,
  2. double size,
  3. Neighbors? neighbors
)
override

Implementation

@override
Path createPath(Offset offset,double size, Neighbors? neighbors) {
  final cf = cornerFraction.coerceIn(0, .5);
  final cTopLeft = topLeft ? cf : 0;
  final cTopRight = topRight ? cf : 0;
  final cBottomLeft = bottomLeft ? cf : 0;
  final cBottomRight = bottomRight ? cf : 0;
  final w = size / 7 * widthFraction.coerceIn(0, 2);

  return Path()
    ..fillType=PathFillType.evenOdd
    ..addRRect(RRect.fromLTRBAndCorners(
      offset.dx, offset.dy,
      offset.dx + size, offset.dy + size,
      topLeft: Radius.circular(size * cTopLeft),
      topRight: Radius.circular(size * cTopRight),
      bottomLeft: Radius.circular(size * cBottomLeft),
      bottomRight: Radius.circular(size * cBottomRight),
    ))
    ..addRRect(RRect.fromLTRBAndCorners(
      offset.dx + w, offset.dy + w,
      offset.dx + size - w,  offset.dy + size - w,
      topLeft: Radius.circular((size - 2 * w) * cTopLeft),
      topRight: Radius.circular((size - 2 * w) * cTopRight),
      bottomLeft: Radius.circular((size - 2 * w) * cBottomLeft),
      bottomRight: Radius.circular((size - 2 * w) * cBottomRight),
    ));
}