flutter_kanji_view 1.0.2
flutter_kanji_view: ^1.0.2 copied to clipboard

Flutter Android iOS

A library for drawing SVG kanji paths. It can load data from String, SVG file, or manually crafted Path object list. Manual controls are possible.

flutter_kanji_view Pub #

A Flutter library to draw kanji character with animation.

Introduction #

This library is based on biocarl's drawing_animation, but with some modifications to display kanji SVG from KanjiVG.

Moreover, it exposes a third constructor: .str, to display the kanji SVG data downloaded as a string (very handy if you store those SVG on your server).

1. Add dependency into your ppubspec.yaml #

  flutter_kanji_view: ^1.0.0
  • Download KanjiVG pack from here , get the zip file.

  • Add the path into yml:

  - assets/0ff10.svg

3. Use the widget: Same with drawing_animation, you can use it in two ways: #

  • Without controller: The animation will run once:
  run: this.run,
  duration: new Duration(seconds: 3),
  • With controller: You will have more control over the widget.
class Playground extends StatefulWidget {
  _PlaygroundState createState() {
    return _PlaygroundState();

class _PlaygroundState extends State<Playground>
    with SingleTickerProviderStateMixin {
  var run = true;
  AnimationController _controller;

  void initState() {
    _controller =
        AnimationController(vsync: this, duration: Duration(seconds: 3));

  Widget build(BuildContext context) {
    var char = getKanjiUnicode('雨');

    return Scaffold(
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
            width: 400,
            height: 400,
            alignment: Alignment.center,
            padding: const EdgeInsets.all(6),
            color: Colors.black12,
            child: KanjiViewer.svg("assets/vectors/" + char + ".svg",
                scaleToViewport: true,
                duration: new Duration(seconds: 6)),
              child: Text('Redraw'),
              onPressed: () {

4. Advanced usage: #

There are 3 mores for drawing SVG, mostly from the source they were from.

*** From SVG asset ***: This might be the most common use.

KanjiViewer.svg("<SVG Path>")

*** From SVG string ***

This can be convenient when you store your SVG data somewhere on the remote server, and retrieve via API:

KanjiViewer.str("<SVG string data>")

*** From Path data ***

// Of the List<Path>

You can use some methods in SVGHelper class (such as getCoordinatesGroup and buildPath) for Path parsing. I'm not going to document it any time soon because of lacking time though.


Since the core library borrows a lot from drawing_animation, their TODOs are also considered this lib's TODOs. This lib, however, add some more priority tasks that I can foresee:

  • Expose Paint object so users can customize the stroke color / width.
  • Expose a colorSeed array for distinct strokes. It should be a List of Color object.
pub points

A library for drawing SVG kanji paths. It can load data from String, SVG file, or manually crafted Path object list. Manual controls are possible.



API reference




unknown (LICENSE)


flutter, path_parsing, xml


Packages that depend on flutter_kanji_view