morphicons_flutter 1.0.0
morphicons_flutter: ^1.0.0 copied to clipboard
Similarity-aware icon morphing: MorphIcon animates between any two stroke or filled icons — raw SVG path data or IconData — with one widget. Closed-form rotation (2D Procrustes), polar interpolation, [...]
morphicons_flutter #
MorphIcon for Flutter: similarity-aware icon morphing powered by
morphicons_core. A faithful
Flutter binding of the morphicons
React component.
Three modes, matching upstream #
// 1. Uncontrolled — change `icon`, morphicons animates.
MorphIcon(icon: isOpen ? MorphIconsLucide.x : MorphIconsLucide.menu,
spring: SpringPreset.snappy)
// 2. Controlled — explicit progress, e.g. driven by a drag gesture.
MorphIcon.controlled(from: MorphIconsLucide.menu, to: MorphIconsLucide.x,
progress: dragProgress)
// 3. Imperative — sequenced morphs.
final key = GlobalKey<MorphIconState>();
MorphIcon(key: key, icon: MorphIconsLucide.menu);
key.currentState?.morphTo(MorphIconsLucide.check); // animates
key.currentState?.set(MorphIconsLucide.x); // jumps, no animation
Behavior parity checklist #
size,strokeWidth,color,semanticLabel(Semantics; hidden when unlabeled, mirroring thearia-hiddendefault).MediaQuery.disableAnimations→ instantset()(reduced motion).- First frame paints the exact canonical shape — no async warm-up, no flash.
- Canonical snap on settle: a resting icon is pixel-identical to a static one.
- One shared
Ticker-drivenMorphSchedulersteps every active spring — cheap at icon-grid scale.
Icon data lives in companion packages, e.g.
morphicons_lucide.
License #
MIT — algorithm and design credit: Guillermo / morphicons.