TriangleShape class
A shape that creates triangles with customizable vertex positions.
TriangleShape generates geometric paths for triangles where the position of each vertex can be controlled using percentage values. This allows for creating various triangle types including right triangles, isosceles triangles, and asymmetric triangles.
The triangle is defined by three vertices:
- Left vertex: positioned at (0, percentLeft * height)
- Bottom vertex: positioned at (percentBottom * width, height)
- Right vertex: positioned at (width, percentRight * height)
Example usage:
// Create a centered isosceles triangle
TriangleShape(percentBottom: 0.5, percentLeft: 0, percentRight: 0)
// Create a right triangle
TriangleShape(percentBottom: 0, percentLeft: 0, percentRight: 0)
// Create an asymmetric triangle
TriangleShape(percentBottom: 0.7, percentLeft: 0.2, percentRight: 0.1)
Constructors
- TriangleShape.new({double percentBottom = 0.5, double percentLeft = 0, double percentRight = 0})
- Creates a new TriangleShape with customizable vertex positions.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- percentBottom → double
-
The horizontal position of the bottom vertex as a percentage of the rectangle width.
final
- percentLeft → double
-
The vertical position of the left vertex as a percentage of the rectangle height.
final
- percentRight → double
-
The vertical position of the right vertex as a percentage of the rectangle height.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
{Rect? rect, double? scale}) → Path -
Builds the geometric path for this shape.
override
-
generatePath(
{bool? useBezier, required Rect rect}) → Path -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited