buildPath method

  1. @override
Path buildPath(
  1. Size size
)
override

Builds the path that defines this shape's outline.

The path should be constructed within the bounds of the given size. The origin (0,0) represents the top-left corner.

Parameters:

  • size - The size of the node

Returns a Path that defines the shape's outline.

Implementation

@override
Path buildPath(Size size) {
  final centerX = size.width / 2;
  final centerY = size.height / 2;

  return Path()
    ..moveTo(centerX, 0) // Top point
    ..lineTo(size.width, centerY) // Right point
    ..lineTo(centerX, size.height) // Bottom point
    ..lineTo(0, centerY) // Left point
    ..close();
}