AnimatedDrawing.paths constructor

AnimatedDrawing.paths(
  1. List<Path> paths, {
  2. List<Paint> paints = const <Paint>[],
  3. AnimationController? controller,
  4. bool? run,
  5. Duration? duration,
  6. Curve? animationCurve,
  7. VoidCallback? onFinish,
  8. PaintedPathCallback? onPaint,
  9. PathOrder? animationOrder,
  10. double? width,
  11. double? height,
  12. AnimationRange? range,
  13. LineAnimation? lineAnimation = LineAnimation.oneByOne,
  14. bool scaleToViewport = true,
  15. DebugOptions? debug,
})

Creates an instance of AnimatedDrawing by directly passing path elements to the constructor (still experimental).

AnimatedDrawing.paths(
    [
    ///Path objects
    ],
    paints:[
    ///Paint objects (optional), specifies a [Paint] object for each [Path] element in `paths`.
    ],
    run: this.run,
    duration: new Duration(seconds: 3),
    onFinish: () => setState(() {
      this.run  = false;
    }),
  )

Updating paths allows dynamically building animation scenes based on external states. For this widget the internal data structure is rebuild every time the state changes, therefore the animation performance might suffer if the amount of elements in paths is very high.

Optionally, paints can be provided which specifies a Paint object for each Path element in paths.

Implementation

AnimatedDrawing.paths(
  this.paths, {
  //AnimatedDrawing.paths
  this.paints = const <Paint>[],
  //Standard
  this.controller,
  //Simplified version
  this.run,
  this.duration,
  this.animationCurve,
  this.onFinish,
  this.onPaint,
  //For both
  this.animationOrder,
  this.width,
  this.height,
  this.range,
  this.lineAnimation = LineAnimation.oneByOne,
  this.scaleToViewport = true,
  this.debug,
}) : assetPath = '' {
  assertAnimationParameters();
  assert(paths.isNotEmpty);
  if (paints.isNotEmpty) assert(paints.length == paths.length);
}