Skip to content

[material_ui] Add the Material shapes. - #12771

Open
ksokolovskyi wants to merge 60 commits into
mainfrom
add-material-shapes-to-material-ui
Open

[material_ui] Add the Material shapes.#12771
ksokolovskyi wants to merge 60 commits into
mainfrom
add-material-shapes-to-material-ui

Conversation

@ksokolovskyi

@ksokolovskyi ksokolovskyi commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the Material shapes library to material_ui, a Dart port of the AndroidX graphics-shapes library and the Compose MaterialShapes catalog. These APIs are the foundation for upcoming M3 Expressive components (loading indicator, wavy progress indicators, etc.) and let app developers use the Material shape catalog and shape-morphing animations directly.

New public API:

  • RoundedPolygon, CornerRounding, CubicBezier, Feature: creation and transformation of rounded polygonal shapes.
  • Morph: smooth morphing between two RoundedPolygons.
  • MaterialShapes: the catalog of 35 predefined Material Design shapes (pictured below).
  • MaterialShapeBorder: an OutlinedBorder that draws a RoundedPolygon, so the shapes plug into the existing ShapeDecoration/shape APIs and animate through the usual border lerping.

The port keeps the geometry and behavior of the Kotlin original (unit tests are ported from AndroidX alongside new ones), while adapting the API surface to Dart/Flutter conventions. Every shape in MaterialShapes.all is covered by a golden test. Also includes a new example that morphs through the whole catalog.

Closes flutter/flutter#184934

Shapes catalog

material_shapes

Example

material_shapes_example.mov

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 6, 2026
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Sep 6, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a shapes library for creating and morphing rounded polygonal shapes, including classes such as RoundedPolygon, CornerRounding, CubicBezier, Feature, and Morph, along with predefined Material Design shapes in MaterialShapes and a MaterialShapeBorder class. Feedback on these changes highlights several issues: an invalid enum syntax in the example painter, potential division-by-zero or NaN bugs in LengthMeasurer and RoundedPolygon.normalized, a typo and incorrect parameter name in an error message, and performance optimization opportunities in Morph.toCubics and CubicBezier operators to avoid list allocations.

Comment thread packages/material_ui/lib/src/shapes/polygon_measure.dart
Comment thread packages/material_ui/lib/src/shapes/rounded_polygon.dart
Comment thread packages/material_ui/lib/src/shapes/rounded_polygon.dart
Comment thread packages/material_ui/lib/src/shapes/morph.dart Outdated
Comment thread packages/material_ui/lib/src/shapes/cubic.dart Outdated
@flutter flutter deleted a comment from flyovers-bot Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

M3 Expressive: Expanded shape library

1 participant