โ๏ธ handwriting_answer_pad
A Flutter handwriting capture pad with a pluggable recognizer
A drawing canvas with undo / redo / clear and a "recognize" action โ bring your own OCR or vision model. The pad never talks to a backend itself, so it stays decoupled and testable.
Great for math answers, signatures, quick sketches, or anything you want to turn into text.
Features
- ๐๏ธ Smooth freehand drawing (built on
scribble) - โฉ๏ธ Undo / โช๏ธ redo / ๐งน clear, with buttons that enable/disable correctly
- โจ "Recognize" action that renders the strokes to a PNG and runs your recognizer
- ๐ No OpenAI/Firebase coupling โ you inject the recognizer
- ๐งช Test-friendly: a
captureseam lets you exercise recognition headlessly - ๐ Errors are caught and shown as a friendly message (raw exceptions never leak)
Install
dependencies:
handwriting_answer_pad: ^0.1.1
or flutter pub add handwriting_answer_pad.
Usage
import 'dart:typed_data';
import 'package:handwriting_answer_pad/handwriting_answer_pad.dart';
HandwritingAnswerPad(
recognizer: (Uint8List pngBytes) async {
// Send the rendered handwriting to your OCR / vision model and return text.
return await myVisionApi.imageToText(pngBytes);
},
onResult: (text) => print('Recognized: $text'),
);
The widget renders the strokes to a PNG and hands the bytes to your recognizer;
the returned text is shown below the pad.
Programmatic control
final controller = HandwritingPadController(strokeWidth: 4);
HandwritingAnswerPad(controller: controller, recognizer: myRecognizer);
controller.undo();
controller.clear();
final png = await controller.renderPng(); // capture the drawing yourself
controller.dispose(); // if you created it
Tips
- Pair with
image_white_backgroundto give vision models an opaque canvas, and withai_rubric_graderto grade the recognized answer. - Run recognition (and any API key) server-side; pass only the image up and the text back.
Part of the Flutter Grading Toolkit.
Contributing
Issues and PRs welcome. Run flutter test before submitting.
License
MIT ยฉ 2026 Muhammad Ali
Libraries
- handwriting_answer_pad
- A handwriting capture pad with a pluggable recognizer.