createPath method

  1. @override
Path createPath()
override

Returns the path for this glyph shape centered at origin.

Implementation

@override
Path createPath() {
  final half = size / 2;
  // Equilateral triangle inscribed in circle
  final height = size * math.sqrt(3) / 2;
  final topY = pointUp ? -height * 2 / 3 : height * 2 / 3;
  final baseY = pointUp ? height / 3 : -height / 3;

  final path = Path();
  path.moveTo(0, topY);
  path.lineTo(-half, baseY);
  path.lineTo(half, baseY);
  path.close();

  return path;
}