drawing_animation_plus 1.2.0
drawing_animation_plus: ^1.2.0 copied to clipboard
Gradually paint SVG paths or Flutter Path objects on a canvas (drawing line animation) with orders, curves, ranges and callbacks.
CHANGES #
1.2.0 #
Features #
- Fill support:
fillModepaints the fills of the SVG elements (fill,fill-opacity,fill-ruleare parsed). WithFillMode.afterStrokeevery fill fades in as soon as its outline is drawn (fillFadecontrols the fade length), withFillMode.alwaysfills are visible from the start.fillColoroverrides the fill color (and enables fills forAnimatedDrawing.paths). paintBuildercallback customizes thePaintof every path (e.g. to color paths by index) for SVG sources.semanticsLabeldescribes the drawing for assistive technologies.SvgParser.getPathStyles()exposes the resolved stroke and fill attributes of each element.
Performance #
- The drawing is wrapped in a
RepaintBoundary, so the surrounding UI is no longer repainted on every animation frame. - Added a benchmark suite (
benchmark/). Parsing the largest example asset (149 KB, 968 segments) takes about 3 ms, recording a frame less than 0.2 ms.
Other #
- Point the package metadata (
repository,issue_tracker) at the maintained fork.
1.1.0 #
Bug fixes #
width/height: specifying only one of them crashed with a null check error; the aspect ratio is now preserved as documented.animationCurvewas ignored when an externalcontrollerwas provided and dropped while an animation was paused.onFinishfired only once per widget lifetime when an external controller was reset and started again.onPaintfired when a path started (not when it was completely painted) and used the wrong index for customanimationOrders; it now fires once per completed path, for every animation order, and again when the animation repeats.- Listeners registered on external controllers were never removed, causing
setState() called after dispose()errors. - Background paths (below
range.start) were scaled independently from the animated paths, so both parts did not line up. rangeused a stale list of segments after the paths were updated and crashed when the SVG asset was rebuilt.- Reversing an external controller painted nothing; the drawing is now un-drawn.
- The parser crashed on
styleattributes without a trailing semicolon or withoutstroke-width, and accumulated paths across loads. dart:iois no longer imported unconditionally, so the package works on Flutter web (frame recording usesDebugOptions.onFramethere).- Test files were named without the
_test.dartsuffix and never ran.
Features #
AnimatedDrawing.svgStringrenders SVG markup provided at runtime.- SVG parsing now supports
rect,circle,ellipse,line,polylineandpolygon, groups (<g>) with inherited attributes,transformattributes (matrix,translate,scale,rotate,skewX,skewY), nested<svg>viewports, simple<style>sheets (tag/class/id selectors),display/visibility,stroke-linecap,stroke-linejoin,stroke-opacity,opacity, lengths with units and all CSS color formats (#rgb,#rgba,#rrggbb,#rrggbbaa,rgb(),rgba(),hsl(),hsla(), named colors,currentColor). - Invalid elements no longer crash the widget: they are skipped and reported (
SvgParser.warnings;SvgParser(strict: true)throws instead). repeatflag for the simplified constructor to run an animation only once.strokeColor/strokeWidthoverrides for all constructors.keyparameter on all constructors.PathOrder.reversed,PathOrder.byLength(groupByPath: true)andPathOrder.byPosition(groupByPath: true)keep the segments of a path together.DebugOptions.onFramereceives recorded frames as PNG bytes.SvgParser,SvgColorandSvgTransformare exported for custom use.- Hot reload reloads the SVG asset; the asset is loaded from
DefaultAssetBundle. - Widgets without
width/heightin unbounded parents (e.g. aColumn) are sized by the aspect ratio of the drawing instead of the screen size.
Performance #
AnimatedDrawing.pathsno longer re-parses all paths on every animation frame; paths are only parsed when a different list is provided.- The painters no longer sort the segments on every frame and cache path metrics.
Other #
- Empty
pathslists are allowed (nothing is drawn). AnimationRange.start/endare non-nullable andPathIndexRangeisconst.- Requires Dart 3.6 / Flutter 3.27.
1.0.0 #
- Stable release of null safety migration
- Update dependencies
0.1.4 #
- Update dependencies
0.1.3 #
- Fix color problem
0.1.2 #
- First part of some major refactorings
0.1.0 #
- Migration to stable version
0.0.9 #
- Fixes when using custom controller
0.0.8 #
- Fix crash before callback returns from path segment parsing
0.0.7 #
- Fix crash when no range provided
0.0.6 #
- Define a range for one animation cycle (see
rangefield), +Several Fixes
0.0.5 #
- Allow to toggle scaleToViewport
- Callback for painted path added
0.0.4 #
- Fix SDK version
0.0.3 #
- DebugOptions: Record canvas is now also possible when widget is rebuild. When changing parameters in DebugOptions hot restart required.
- Several Fixes and performance optimizations.
- Examples on how to use
_.paths
0.0.2 #
- Update links and paths
- Remove typos
- Create minimal README_pub.md for pub-repo
0.0.1 #
- Initial release. Relies on pre-released master.