Stroke order animations and quizzes for Chinese characters for use in Flutter apps

Overview

Stroke order animator

Pub

This package implements stroke order animations and quizzes of Chinese characters based on the Make me a Hanzi data. That data is available under the ARPHIC public license.

The package uses a StrokeOrderAnimationController that handles the animation state and serves as an interface between your app and the stroke order animation. The stroke order data has to be passed in as a JSON string. In order to control animations, a TickerProvider must be passed to the controller, for example using a TickerProviderStateMixin. The controller is then passed as an argument to the StrokeOrderAnimator that displays the actual stroke order diagram.

When using the animations in a PageView or ListView, it is recommended to use a unique key for every StrokeOrderAnimator and cancel the animation when the selected page changes in order to avoid broken animation behaviour.

All attributes and actions of the stroke order diagram are controlled via the StrokeOrderAnimationController and can be changed anytime using the respective setter methods.

Attributes

  • Animation speed of stroke animations and hints in quiz mode (3 is pretty fast)
  • Whether to show/hide strokes
  • Whether to show/hide outlines
  • Whether to show/hide medians
  • Whether to show/hide the correct strokes the user writes during a quiz
  • Whether to highlight radicals
  • Stroke color
  • Outline color
  • Median color
  • Radical color
  • Brush color in quiz mode
  • Brush thickness in quiz mode
  • Number of wrong strokes before showing a hint in quiz mode
  • Hint color in quiz mode

Controls

  • Start/stop animation
  • Start/stop quiz
  • Show next/previous stroke
  • Show full character
  • Reset animation/quiz

Callbacks

To better integrate the quizzes, three callbacks can be either passed to the StrokeOrderAnimationController during instantiation or afterwards using the add...Callback method:

  • onWrongStrokeCallback
  • onCorrectStrokeCallback
  • onQuizCompleteCallback

The onQuizCompleteCallback receives a Quizsummary containing the number of mistakes on a per-stroke basis and the paths of the correct strokes (in a 1024x1024 coordinate system). The other two callbacks receive the index of the stroke that was written (in-)correctly. All indices are zero-based.

Example

To run an example showing several stroke order diagrams in a swipeable page view run the following:

git clone https://github.com/Mr-Pepe/stroke-order-animator
cd stroke-order-animator/example/
flutter run

Issues and feature requests

Please file an issue on the project page if something doesn't work as expected or if you have a feature request.

Contribute

Feel free to open a pull request. Just make sure to write extensive tests.

Comments
  • keeping the hand writing of user made

    keeping the hand writing of user made

    Hi, This is a nice to have feature, can Stroke-order-animator keep the correct paths of a user actually draw? this might be used to show to the user his actual hand writing. thanks

    opened by sqllyw 5
  • Pressing blank space should not be counted as mistake

    Pressing blank space should not be counted as mistake

    as the subject line,

    A sample here: https://hanziwriter.org/docs.html go to Integrating Quizzes the testing character is 码, if press blank space, it will not count as mistake

    opened by sqllyw 4
  • Use strokOrder instead of _strokeOrder

    Use strokOrder instead of _strokeOrder

    Line 365 in strokeOrderAnimationController.dart file void setStrokeOrder(String strokeOrder) { final parsedJson = json.decode(_strokeOrder.replaceAll("'", '"')); }

    Could it use strokOrder instead of _strokeOrder? Plz void setStrokeOrder(String strokeOrder) { final parsedJson = json.decode(strokeOrder.replaceAll("'", '"')); }

    I'd like to change strokeOrder after I get data from internet.

    opened by Aaron2464 2
  • mistake count in onQuizCompleteCallback

    mistake count in onQuizCompleteCallback

    hi, if mistake is in the same stroke, should be counted once, the example 永 has five strokes, if i make 10 mistakes in the first stroke, then the summary will show 10 mistakes, could be better to count only 1 stroke mistake. thanks

    opened by sqllyw 1
  • Normalize animation speed

    Normalize animation speed

    Currently all strokes take the same time to animate, which makes short strokes look very slow and long strokes look very fast. The animation speed for each stroke should be scaled according to the stroke length to get the impression of a constant drawing speed.

    opened by Mr-Pepe 1
  • Wrong Strokes highlight

    Wrong Strokes highlight

    i thing there should be the option to show the wrong stroke with hint in quiz portion. Like we can show the wrong stroke with red colour and can also show the hint to user.

    opened by varnica4 2
Owner
Felipe Peter
Felipe Peter
无第三方依赖的公历(阳历)和农历(阴历、老黄历)工具,支持节假日、星座、儒略日、干支、生肖、节气、节日、彭祖百忌、每日宜忌、吉神宜趋凶煞宜忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道黑道日及吉凶等。lunar is a calendar library for Solar and Chinese Lunar.

lunar lunar是一款无第三方依赖的公历(阳历)和农历(阴历、老黄历)工具,支持星座、儒略日、干支、生肖、节气、节日、彭祖百忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道日及吉凶、法定节假日及调休等。 Eng

6tail 63 Dec 27, 2022
A flutter application that allows users to test their knowledge through quizzes made for specific topics.

Quiz_App A flutter application that allows users to test their knowledge through quizzes made for specific topics. Setup The application consists of a

null 0 Dec 29, 2021
Multi-platform application to practice quizzes from the course Operations Research M.

Multi-platform application to practice quizzes from the course Operations Research M.

Michele Righi 37 Dec 26, 2022
This application displays the characters of the series Breaking Bad, has been used Cubit state and API .

breaking_bad A new Flutter project using bloc. Getting Started This project is a starting point for bloc state_management. A few resources to get you

null 1 Dec 24, 2021
Example de layout in Flutter inspiration in Netflix App + Woody Woodpecker Characters

PicFlix Example de layout in Flutter inspiration in Netflix App + Woody Woodpecker Characters Cover extracted of https://twitter.com/winemcbride/statu

Tiago Danin 3 May 17, 2021
Dart / Flutter package, which replaces characters in strings that are illegal/unsafe for filenames.

Dart package, which is a clone of the popular sanitize-filename npm module by Parsha Pourkhomami. Usage import 'package:sanitize_filename/sanitize_fil

e.GO Mobile 2 Jun 21, 2022
Redditech: use the Reddit API in order to build a mobile app

Redditech Introduction Redditech is an IT project in which we had to use the Reddit API (https://www.reddit.com/dev/api/) in order to build a mobile a

KylianGERMAIN 1 Nov 15, 2022
A customizable carousel slider for Flutter. Supports infinite sliding, custom indicators, and custom animations with many pre-built indicators and animations.

Flutter Carousel Slider A customizable carousel slider for flutter Screenshots Installing dependencies: flutter_carousel_slider: ^1.0.8 Demo Demo a

Udara Wanasinghe 23 Nov 6, 2022
🚗 Apple CarPlay for Flutter Apps. Aims to make it safe to use apps made with Flutter in the car by integrating with CarPlay.

CarPlay with Flutter ?? Flutter Apps now on Apple CarPlay! flutter_carplay aims to make it safe to use iPhone apps made with Flutter in the car by int

Oğuzhan Atalay 156 Dec 26, 2022
Face Mask Detection mobile application built with Flutter and TensorFlow lite in order to detect face masks using images and live camera.

Face Mask Detector App Face Mask Detection mobile application built with Flutter and TensorFlow lite in order to detect face masks using images and li

Yousef Shaban 3 Aug 15, 2022
A flutter list view which can drag & move item to change order.

draggable_flutter_list A flutter list view which can drag & move item to change order. some codes come from flutter_list_drag_and_drop fix flutter_lis

刘彦博 40 Sep 22, 2022
My flutter (android, ios) UI design examples 🎈 - user profile UIs, food order ui, splashscreen, mask widget usage, settings page ui

Flutter UI Design Examples ?? This repository contains the flutter ui designs I designed while learning. Doctor Appointment App UI Packages in use: fl

Aleyna Eser 23 Nov 14, 2022
Csv to list for web - Convert a CSV into a list in order to populate a firebase database

My goal is to convert a CSV into a list in order to populate a firebase database

null 0 Jan 26, 2022
Practice building basic animations in apps along with managing app state by BLoC State Management, Flutter Slider.

Practice building basic animations in apps along with managing app state by BLoC State Management including: Cubit & Animation Widget, Flutter Slider.

TAD 1 Jun 8, 2022
Github-apps-flutter - Github Apps Build Using bloc 8.0 and Github API

Github_apps Inspiration This app is made to build using bloc 8.0 and github API.

Irvan Lutfi Gunawan 18 Apr 14, 2022
[Example APPS] Basic Flutter apps, for flutter devs.

Show some ❤️ and star the repo to support the project This repository containing links of all the example apps demonstrating features/functionality/in

Pawan Kumar 17.9k Jan 2, 2023
Flutter-Apps-Collection: a collection of apps made in flutter for learning purpose

Flutter-Apps-Collection This is a repository of a collection of apps made in flutter for learning purpose Some Screenshots . . . Apps build in Flutter

Himanshu Singh 96 May 27, 2022
Projeto do curso Criação de Apps Android e iOS com Flutter 2021-Crie 14 Apps. Professor: Daniel Ciolfi

agenda_contatos Projeto do curso de Flutter Getting Started This project is a starting point for a Flutter application. A few resources to get you sta

Waldir Tiago Dias 0 Nov 27, 2021
Projeto do curso Criação de Apps Android e iOS com Flutter 2021-Crie 14 Apps. Professor: Daniel Ciolfi

busca_gifs A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if th

Waldir Tiago Dias 0 Nov 25, 2021