handwriting_answer_pad 0.1.0
handwriting_answer_pad: ^0.1.0 copied to clipboard
A Flutter handwriting capture pad (scribble-based) with undo/redo, clear, render-to-image, and a pluggable recognizer hook — bring your own OCR / vision model. No backend coupling.
handwriting_answer_pad #
A Flutter handwriting capture pad — a drawing canvas with undo / redo / clear and a "recognize" action — backed by a pluggable recognizer so you 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.
Install #
dependencies:
handwriting_answer_pad: ^0.1.0
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. Errors are caught and
shown as a friendly message (the raw exception is never leaked to the user).
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 the output 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.