KanjiViewer class

A widget that iteratively draws path segment data to a defined canvas (drawing line animation).

Path data can be either passed directly (KanjiViewer.paths) or via an Svg file (KanjiViewer.svg).

Inheritance

Constructors

KanjiViewer.paths(List<Path> paths, {Key? key, List<Paint> paints = const <Paint>[], AnimationController? controller, bool? run, Duration? duration, Curve? animationCurve, VoidCallback? onFinish, PaintedPathCallback? onPaint, PathOrder? animationOrder, double? width, double? height, AnimationRange? range, LineAnimation lineAnimation = LineAnimation.oneByOne, bool? underlayStrokes, bool scaleToViewport = true, DebugOptions? debug})
Creates an instance of KanjiViewer by directly passing path elements to the constructor (still experimental).
KanjiViewer.str(String svgStr, {Key? key, AnimationController? controller, bool? run, Duration? duration, Curve? animationCurve, VoidCallback? onFinish, PaintedPathCallback? onPaint, PathOrder? animationOrder, double? width, double? height, AnimationRange? range, LineAnimation lineAnimation = LineAnimation.oneByOne, bool? underlayStrokes, bool scaleToViewport = true, DebugOptions? debug})
Parses path data from string content. Handy if you are storing your SVG on server, and retrieve it through an API:
KanjiViewer.svg(String assetPath, {Key? key, AnimationController? controller, bool? run, Duration? duration, Curve? animationCurve, VoidCallback? onFinish, PaintedPathCallback? onPaint, PathOrder? animationOrder, double? width, double? height, AnimationRange? range, LineAnimation lineAnimation = LineAnimation.oneByOne, bool? underlayStrokes, bool scaleToViewport = true, DebugOptions? debug})
Parses path data from an SVG asset. In order to use assets in your project specify those in pubspec.yaml:

Properties

animationCurve → Curve?
Easing curves are used to adjust the rate of change of an animation over time, allowing them to speed up and slow down, rather than moving at a constant rate.
final
animationOrder → PathOrder?
Denotes the order in which the path elements are drawn to canvas when lineAnimation is set to LineAnimation.oneByOne. When no animationOrder is specified it defaults to PathOrder.original. Do not confuse this option with the default rendering order, whereas the first path elements are painted first to the canvas and therefore potentially occluded by subsequent elements (w3-specs). For now the rendering order always defaults to PathOrder.original.
final
assetPath → String
Provide path data via an SVG asset.
final
controller → AnimationController?
When a animation controller is specified, the progress of the animation can be controlled externally.
final
debug → DebugOptions?
For debugging, not for production use.
final
duration → Duration?
When no custom animation controller is provided the duration of the animation can be controlled via duration.
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
When height is specified parent constraints are ignored. When only width or height is specified the original aspect ratio is preserved.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lineAnimation → LineAnimation
Specifies in which way the path elements are drawn to the canvas.
final
onFinish → VoidCallback?
Callback is evoked after one animation cycle has finished.
final
onPaint → PaintedPathCallback?
Callback is evoked when a complete path is painted to the canvas.
final
paints → List<Paint>
When specified each Path object in paths is painted by applying the corresponding Paint object.
final
paths → List<Path>
Provide path data via an list of Path objects.
final
range → AnimationRange?
Specifies a start and end point from where to start and stop the animation.
final
run → bool?
When no custom animation controller is provided the state of the animation can be controlled via run.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scaleToViewport → bool
Denotes if the path elements should be scaled in order to fit into viewport.
final
svgStr → String
XML-like SVG string.
final
underlayStrokes → bool?
Specifies if a semi-transparent skeleton of the character should be displayed under the drawing character Should be gray, for now.
final
width → double?
When width is specified parent constraints are ignored. When only width or height is specified the original aspect ratio is preserved.
final

Methods

assertAnimationParameters() → void
createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → AbstractAnimatedDrawingState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited