PolygonShape class

A shape that creates regular polygons with a configurable number of sides.

PolygonShape generates geometric paths for regular polygons (shapes with equal sides and angles) such as triangles, squares, pentagons, hexagons, etc. The polygon is inscribed in a circle that fits within the bounding rectangle.

Example usage:

// Create a pentagon
PolygonShape(numberOfSides: 5)

// Create a hexagon
PolygonShape(numberOfSides: 6)
Inheritance

Constructors

PolygonShape({int numberOfSides = 5})
Creates a new PolygonShape with the specified number of sides.

Properties

hashCode → int
The hash code for this object.
no setterinherited
numberOfSides → int
The number of sides for the polygon.
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