Skip to content
pubscout

morphable_shape

2.0.1, released 5 weeks ago by wenkaifan.com

Create responsive shapes and morph between them in Flutter.

WASM-ready
$ flutter pub add morphable_shape
Source repository

What it does

Provides a collection of responsive shape borders (rectangles, circles, polygons, stars, etc.) that can be customized with gradient borders, shadows, and corner styles. It also includes algorithms to smoothly morph one shape into another using tweens.

AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need custom responsive shapes like rounded rectangles, polygons, or stars without manually calculating dimensions.
  • You want to animate transitions by morphing between different shapes.
  • You need gradient borders or inset shadows on shapes.

Skip it when

  • You only need standard Flutter material shapes and simple borders.
  • You require complex SVG paths that cannot be approximated by straight lines and cubic Bezier curves.

Strengths

  • Supports multiple shape types including rectangles, circles, polygons, and stars with customizable corner styles.
  • Powerful shape morphing capabilities via ShapeBorderTween.
  • Supports serialization to and from JSON.

Weaknesses

  • Morphing between completely distinct shapes may look unnatural or require tweaking the morph method.
  • Only px and percent units from the dimension package are respected since ShapeBorder has no access to the build context.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
3
ShapeBorder rectangle = RectangleShapeBorder(
    borderRadius: DynamicBorderRadius.only(
    topLeft: DynamicRadius.circular(10.toPXLength),
    bottomRight: DynamicRadius.elliptical(60.0.toPXLength, 10.0.toPercentLength))
    );

Widget widget = Material(
    shape: rectangle,
    clipBehavior: Clip.antiAlias,
    child: Container()
);

Alternatives

Packages that do the same job and could replace morphable_shape.

Works with

Packages commonly used together with morphable_shape: ones it builds on, ones built on it, and its own family.