material_shapes library

Material Shapes

A library for easy creation, transformation, and morphing of rounded polygonal shapes. Contains predefined Expressive Shapes that can be used at various components.

Classes

CornerRounding
Defines the amount and quality of rounding around a given vertex of a shape.
CubicBezier
A single cubic Bézier curve.
DynamicPathBorder
MaterialShapeBorder
A border that fits a material-shaped border within the rectangle of the widget it is applied to.
MaterialShapes
Holds predefined Material Design shapes as RoundedPolygons that can be used at various components as they are, or with a MaterialShapeBorder to animate between them.
Morph
An animation between two RoundedPolygon shapes.
MorphBorder
PolygonFeature
While a polygon's shape can be drawn solely using a list of CubicBezier objects representing its raw curves and lines, features add an extra layer of context to groups of cubics. Features group cubics into (straight) edges, convex corners, or concave corners. For example, rounding a rectangle adds many cubics around its edges, but the rectangle's overall number of corners remains the same. Morph therefore uses this grouping for several reasons:
RoundedPolygon
A closed polygonal shape, with optional rounding at its vertices.
RoundedPolygonBorder
StaticPathBorder

Extensions

Matrix2ShapePointTransformer on Matrix2
Adapts a Matrix2 into a ShapePointTransformer.
Matrix3ShapePointTransformer on Matrix3
Adapts a Matrix3 into a ShapePointTransformer.
Matrix4ShapePointTransformer on Matrix4
Adapts a Matrix4 into a ShapePointTransformer.

Functions

pathFromCubics(List<CubicBezier> cubics, {double startAngle = 0.0, bool repeatPath = false, bool closePath = true, Offset rotationPivot = .zero, Path? path}) → Path
Returns a Path built from the given cubics.

Typedefs

ShapePointTransformer = (double, double) Function(double x, double y)
Transforms the point (x, y) and returns the transformed coordinates.