getTrianglePath method

Path getTrianglePath(
  1. double x,
  2. double y
)

Implementation

Path getTrianglePath(double x, double y) {
  switch (direction) {
    case AxisDirection.up:
      return Path()
        ..moveTo(0, y)
        ..lineTo(x / 2, 0)
        ..lineTo(x, y)
        ..lineTo(0, y);
    case AxisDirection.right:
      return Path()
        ..moveTo(0, 0)
        ..lineTo(0, y)
        ..lineTo(x, y / 2)
        ..lineTo(0, 0);
    case AxisDirection.down:
      return Path()
        ..moveTo(0, 0)
        ..lineTo(x / 2, y)
        ..lineTo(x, 0)
        ..lineTo(0, 0);
    case AxisDirection.left:
      return Path()
        ..moveTo(x, 0)
        ..lineTo(0, y / 2)
        ..lineTo(x, y)
        ..lineTo(x, 0);
  }
}