scribe_canvas 0.3.0
scribe_canvas: ^0.3.0 copied to clipboard
A high-performance Flutter multi-page canvas library for handwriting, drawing, and annotation with customizable tools and PDF export.
Scribe #
A powerful, high-performance Flutter multi-page canvas library for handwriting, drawing, and annotation. Scribe is designed to handle multiple A4-sized pages with smooth strokes, customizable tools, and seamless PDF export.
Features #
- 📄 Multi-page Canvas: Work with multiple A4-sized pages in a single scrollable view.
- 🖋️ Smooth Drawing: High-performance drawing engine using the Ramer-Douglas-Peucker algorithm for stroke simplification.
- 🛠️ Customizable Tools:
- Multiple pen stroke sizes (user-definable cycling).
- Multiple eraser sizes (user-definable cycling).
- Toggle between pen and eraser directly from the integrated Page Header.
- 📑 Templates & Backgrounds:
- Load local or network images as backgrounds.
- Load PDF documents as background templates for each page.
- Add global headers and footers to every page.
- 🔄 Interactive Navigation:
- Support for pinch-to-zoom and pan.
- Full Undo/Redo stack (global and per-page).
- Page management: add, insert, or delete pages with ease.
- 💾 Persistence: Save and load drawing data in a compact, efficient encoded format.
- 📤 PDF Export: Export your entire creation to a high-quality PDF to share or print.
Getting Started #
Add scribe to your pubspec.yaml:
dependencies:
scribe: ^0.0.1 # or use a git/pub version
Usage #
A simple way to integrate ScribeCanvas into your application:
import 'package:scribe/scribe.dart';
// ... inside your build method
ScribeCanvas(
color: Colors.blueAccent,
strokeWidth: 4.0, // Initial pen width
strokeSizes: [2, 4, 8, 16], // Predefined sizes for cycling
eraserWidth: 30.0, // Initial eraser width
eraserSizes: [20, 30, 60], // Predefined sizes for cycling
isEraser: _isEraser,
onStrokeEnd: () {
// Canvas data changed!
},
onStrokeWidthChanged: (width) {
setState(() => _strokeWidth = width);
},
onToggleEraser: (isEraser) {
setState(() => _isEraser = isEraser);
},
)
Additional Information #
Scribe uses InteractiveViewer for navigation and CustomPainter for drawing. It leverages pdf and printing packages for high-quality cross-platform PDF generation.
Feel free to contribute by opening issues or submitting pull requests!