Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
n-bernat committed Nov 29, 2023
1 parent 1e30491 commit d43ee94
Showing 1 changed file with 83 additions and 12 deletions.
95 changes: 83 additions & 12 deletions flutter_kanjivg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,100 @@ and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
# flutter_kanjivg

## Features
[![Package](https://img.shields.io/pub/v/flutter_kanjivg.svg)](https://pub.dev/packages/flutter_kanjivg) [![Publisher](https://img.shields.io/pub/publisher/flutter_kanjivg.svg)](https://pub.dev/packages/flutter_kanjivg/publisher) [![flutter_kanjivg - Checks](https://github.com/n-bernat/kanjivg/actions/workflows/flutter_checks.yaml/badge.svg)](https://github.com/n-bernat/kanjivg/actions/workflows/flutter_checks.yaml) [![MIT License](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT)

TODO: List what your package can do. Maybe include images, gifs, or videos.
`flutter_kanjivg` provides a simple way of interacting with data from the [KanjiVG (Kanji Vector Graphics) project](https://kanjivg.tagaini.net). This package contains a parser for SVG files with extensions added by the maintainers of KanjiVG and Flutter widgets that simplify displaying animated kanji. It also provides metadata like stroke count, original radical forms (e.g. 人 for 亻), position of radicals and more.

> This package is neither supported nor related to the creators of the KanjiVG project.
## Getting started

TODO: List prerequisites and provide or point to information on how to
start using the package.
1. Add this package to your dependencies.

```yaml
dependencies:
flutter_kanjivg: ^0.0.1
```
2. Get the dependencies.
```sh
flutter pub get
```

When using `flutter_kanjivg` there is no need to add `kanjivg` to your dependencies as `flutter_kanjivg` imports it itself.

## Usage

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
The library doesn't include kanji data as there are over 10,000 files and it would be quite wasteful if you want to fetch them at runtime.
You can either:

1. download SVG files from [project's GitHub page](https://github.com/KanjiVG/kanjivg/releases),
2. self-host them and get SVG data from your server.

```dart
const like = 'sample';
import 'package:flutter/material.dart';
import 'package:flutter_kanjivg/flutter_kanjivg.dart';
class KanjiPage extends StatefulWidget {
const KanjiPage({super.key});
@override
State<KanjiPage> createState() => _KanjiPageState();
}
class _KanjiPageState extends State<KanjiPage> with TickerProviderStateMixin {
late final KanjiController controller;
@override
void initState() {
super.initState();
const source = '<?xml version="1.0" encoding="UTF-8"?> ... </svg>';
const parser = KanjiParser();
// Returns an instance of `KvgData` with `id`, `character`, `radicals` and `strokes`.
final data = parser.parse(source);
controller = KanjiController(
vsync: this,
duration: const Duration(seconds: 5),
)
..load(data)
..forward();
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: KanjiCanvas(
controller: controller,
size: 260,
thickness: 6,
color: Colors.red,
hintColor: Colors.red.withOpacity(0.33),
),
),
);
}
}
```

## Additional information

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
- This package requires at least Flutter 3.10 to work.
- If there are any issues feel free to go to [GitHub Issues](https://github.com/n-bernat/kanjivg/issues) and report a bug.

## Maintainers

- [Nikodem Bernat](https://nikodembernat.com)

0 comments on commit d43ee94

Please sign in to comment.