drawing_animation_plus 1.2.0 copy "drawing_animation_plus: ^1.2.0" to clipboard
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: fillMode paints the fills of the SVG elements (fill, fill-opacity, fill-rule are parsed). With FillMode.afterStroke every fill fades in as soon as its outline is drawn (fillFade controls the fade length), with FillMode.always fills are visible from the start. fillColor overrides the fill color (and enables fills for AnimatedDrawing.paths).
  • paintBuilder callback customizes the Paint of every path (e.g. to color paths by index) for SVG sources.
  • semanticsLabel describes 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.
  • animationCurve was ignored when an external controller was provided and dropped while an animation was paused.
  • onFinish fired only once per widget lifetime when an external controller was reset and started again.
  • onPaint fired when a path started (not when it was completely painted) and used the wrong index for custom animationOrders; 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.
  • range used 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 style attributes without a trailing semicolon or without stroke-width, and accumulated paths across loads.
  • dart:io is no longer imported unconditionally, so the package works on Flutter web (frame recording uses DebugOptions.onFrame there).
  • Test files were named without the _test.dart suffix and never ran.

Features #

  • AnimatedDrawing.svgString renders SVG markup provided at runtime.
  • SVG parsing now supports rect, circle, ellipse, line, polyline and polygon, groups (<g>) with inherited attributes, transform attributes (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).
  • repeat flag for the simplified constructor to run an animation only once.
  • strokeColor/strokeWidth overrides for all constructors.
  • key parameter on all constructors.
  • PathOrder.reversed, PathOrder.byLength(groupByPath: true) and PathOrder.byPosition(groupByPath: true) keep the segments of a path together.
  • DebugOptions.onFrame receives recorded frames as PNG bytes.
  • SvgParser, SvgColor and SvgTransform are exported for custom use.
  • Hot reload reloads the SVG asset; the asset is loaded from DefaultAssetBundle.
  • Widgets without width/height in unbounded parents (e.g. a Column) are sized by the aspect ratio of the drawing instead of the screen size.

Performance #

  • AnimatedDrawing.paths no 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 paths lists are allowed (nothing is drawn).
  • AnimationRange.start/end are non-nullable and PathIndexRange is const.
  • 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 range field), +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.
2
likes
160
points
216
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Gradually paint SVG paths or Flutter Path objects on a canvas (drawing line animation) with orders, curves, ranges and callbacks.

Repository (GitHub)
View/report issues

Topics

#svg #animation #drawing #path #canvas

License

BSD-2-Clause (license)

Dependencies

flutter, path_parsing, xml

More

Packages that depend on drawing_animation_plus