morphable_shape
2.0.1, released 5 weeks ago by wenkaifan.com
Create responsive shapes and morph between them in Flutter.
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.
- simple_tooltip
A Flutter widget for customizable balloon‑style tooltips.
50Compare - material_new_shapes
Provides Material 3 shape definitions (e.g., RoundedPolygon, Cubic) for Flutter UI.
48Compare - touchable
Add gesture callbacks and interactivity to shapes drawn inside a Flutter CustomPainter canvas.
50Compare - flutter_custom_clippers
Provides pre-made custom clippers for various shapes in Flutter applications.
50Compare
Works with
Packages commonly used together with morphable_shape: ones it builds on, ones built on it, and its own family.
- flutter_class_parsermorphable_shape depends on itSerialize and deserialize common Flutter UI data classes and widgets.
- animated_box_decorationmorphable_shape depends on itSmoothly animate between any two BoxDecoration including colors, gradients, and images.
- dimensionmorphable_shape depends on itMimics CSS length units (px, percentage, vw, vh, vmin, vmax) for responsive Flutter layouts.
- responsive_propertySame familyResponsive values and widgets based on screen size using ScreenScope and Responsive classes
- animated_styled_widgetBuilt on morphable_shapeSerializable CSS-inspired styles with implicit and explicit animations for custom widgets.