โœ๏ธ 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.

pub package pub points likes CI license: MIT


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 capture seam 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_background to give vision models an opaque canvas, and with ai_rubric_grader to 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.