RoundedPolygon class final

A closed polygonal shape, with optional rounding at its vertices.

A polygon can be built from a number of vertices, or from an ordered list of vertices.

Annotations

Constructors

RoundedPolygon(int numVertices, {double radius = 1.0, Offset center = .zero, CornerRounding rounding = .unrounded, List<CornerRounding>? perVertexRounding})
Creates a regular polygon with numVertices vertices, equally spaced around a circle of the given radius about center.
factory
RoundedPolygon.circle({int numVertices = 8, double radius = 1.0, Offset center = .zero})
Creates a circle of the given radius about center, approximated by rounding a polygon of numVertices vertices.
factory
RoundedPolygon.fromFeatures(List<PolygonFeature> features, {Offset? center})
Creates a polygon from features, which describe each segment of its outline.
factory
RoundedPolygon.fromVertices(List<Offset> vertices, {CornerRounding rounding = .unrounded, List<CornerRounding>? perVertexRounding, Offset? center})
Creates a polygon with the given vertices.
factory
RoundedPolygon.pill({double width = 2.0, double height = 1.0, double smoothing = 0.0, Offset center = .zero})
Creates a pill about center, width wide and height high: a rectangle capped by a semicircle at either end of its longer dimension.
factory
RoundedPolygon.pillStar({double width = 2.0, double height = 1.0, int numVerticesPerRadius = 8, double innerRadiusRatio = 0.5, CornerRounding rounding = .unrounded, CornerRounding? innerRounding, List<CornerRounding>? perVertexRounding, double vertexSpacing = 0.5, double startLocation = 0.0, Offset center = .zero})
Creates a pill star about center, width wide and height high: a RoundedPolygon.pill with inner and outer radii along its outline, the way a RoundedPolygon.star has them along a circle, with numVerticesPerRadius vertices on each.
factory
RoundedPolygon.rectangle({double width = 2.0, double height = 2.0, CornerRounding rounding = .unrounded, List<CornerRounding>? perVertexRounding, Offset center = .zero})
Creates a rectangle width wide and height high about center, with optional rounding at its four corners.
factory
RoundedPolygon.star({required int numVerticesPerRadius, double radius = 1.0, double innerRadius = 0.5, CornerRounding rounding = .unrounded, CornerRounding? innerRounding, List<CornerRounding>? perVertexRounding, Offset center = .zero})
Creates a star about center, with numVerticesPerRadius vertices on the outer radius alternating with as many on the innerRadius.
factory

Properties

center → Offset
The center of this polygon, around which all vertices are placed.
no setter
cubics → List<CubicBezier>
A flattened version of the PolygonFeatures, as a List<CubicBezier>.
no setter
features → List<PolygonFeature>
The PolygonFeatures this polygon is composed of.
no setter
hashCode → int
The hash code for this object.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

calculateApproximateBounds() → Rect
A cheaper alternative to calculateBounds, based on the min/max values of all anchor and control points that make up this shape.
calculateBounds() → Rect
Calculates the axis-aligned bounds of this shape.
calculateMaxBounds() → Rect
Like calculateBounds, calculates the axis-aligned bounds of this shape, but determines the max dimension of the shape (by calculating the distance from its center to the start and midpoint of each curve) and returns a square which can be used to hold the object in any rotation.
normalized() → RoundedPolygon
Returns a new RoundedPolygon, moving and resizing this one, so it's completely inside the (0, 0) -> (1, 1) square, centered if there is extra space in one direction.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toPath({double startAngle = 0.0, bool repeatPath = false, bool closePath = true, Path? path}) → Path
Returns a Path for this polygon.
toString() → String
A string representation of this object.
override
transformed(ShapePointTransformer transformer) → RoundedPolygon
Returns a new RoundedPolygon with every point of this one, including its center, mapped through transformer.

Operators

operator ==(Object other) → bool
The equality operator.
override