scribe_canvas 0.6.3
scribe_canvas: ^0.6.3 copied to clipboard
A high-performance Flutter multi-page canvas library for handwriting, drawing, and annotation with customizable tools and PDF export.
0.6.3 #
- Discrete Page Navigation:
- Added
ScribeScrollModewithcontinuous(default) anddiscreteoptions. - In discrete mode, vertical scrolling is disabled, and the canvas snaps to a single page at a time.
- Introduced a compact, vertical Navigation Control on the left side of the screen for flipping through pages in discrete mode.
- Automatic Snap: Adding or inserting a page now automatically navigates the viewport to the newly created page.
- Added
- Customization:
- Added
eraserIconsupport toScribeCanvasandPageHeader, allowing users to replace the default tool icon. - Added
eraserIconSize,eraserActiveColor, anderaserInactiveColorfor finer control over tool styling.
- Added
- API Improvements:
- Exported
ScribeScrollModeenum for library consumers. - Added
initialPageIndexandscrollModeparameters toScribeCanvas.
- Exported
- UI/UX:
- Navigation controls now automatically fade when at the start/end of the document.
- Refined the "Add Page" and "Insert Page" flow for a more seamless multi-page experience.
0.6.2 #
- Enhanced PDF Export:
- Optional Sharing: Added a
shareboolean parameter toexportToPdf. Set tofalseto suppress the share sheet and just receive data. - Return PDF Bytes:
exportToPdfnow returnsFuture<Uint8List?>, allowing you to store the generated PDF in a variable for server uploads or local processing. - Custom Filename: Added an optional
fileNameparameter to specify the default name used in the share dialog.
- Optional Sharing: Added a
- Cross-Platform Parity: Ensured consistent behavior for background rendering and byte returns across Mobile, Web, and Desktop.
0.6.1 #
- Intelligent Clear Canvas: Refined the
clear()function with three specialized logic cases for page management:- Case 1 (No Background): Resets the canvas to a single fresh blank page.
- Case 2 (Single background image/1-page PDF): Resets the canvas to exactly one page containing the background template, removing extra pages.
- Case 3 (Multi-page background PDF): Preserves all template pages to maintain document integrity while clearing all drawing data.
- Data Integrity:
clear()now wipes both global and page-specific undo/redo stacks to ensure a total reset of the drawing session. clearBackgrounds(): Added a dedicated method toScribeCanvasControllerandScribeCanvasStateto allow removing background images or PDF templates without affecting user drawings.- Viewport UX:
clear()automatically triggers aresetView()call, snapping the camera back to the top of Page 1 for immediate visual confirmation of the fresh start.
0.6.0 #
- O(1) Vector Caching: Introduced a sophisticated
ui.Picturecaching system that "bakes" committed strokes into a single vector snapshot. This resolves performance lag by shifting rendering costs from O(N) to O(1) per frame. - Smart Stroke Eraser: Replaced pixel-based erasing with an intelligent object-based eraser.
- Live Highlighting: Strokes turning transparent instantly when touched by the eraser for real-time feedback.
- Selection Logic: Entire strokes are removed on contact, mimicking professional note-taking apps.
- Accuracy: High-precision Point-to-Segment intersection math for pixel-perfect hit-testing.
- Performance Optimizations:
- Removed expensive
saveLayer()andBlendMode.clearfrom the active-drawing path. - Eliminated redundant multi-pass smoothing during live drags to ensure absolute minimum latency.
- Removed expensive
- Documentation: Updated README with Performance Architecture details and version 0.6.0 features.
0.5.0 #
- Controller Pattern: Introduced
ScribeCanvasController— the standard Flutter controller pattern for all imperative canvas operations.GlobalKey<ScribeCanvasState>is no longer needed andScribeCanvasStateis no longer exported from the public API. - Variable-Width Strokes: High-density sampling with central difference tangents, Catmull-Rom splines, and multi-pass smoothing filters for authentic ink-like drawing.
- Zoom Improvements: Dynamic zoom constraints prevent infinite zoom-out. Pages snap to top-center alignment. Unified focus-based keyboard input.
- Network Image Error Handling: Robust error handling for
setNetworkBackgroundImage,setNetworkHeaderImage, andsetNetworkFooterImage. - Full variable-width data preservation across all serialization formats and PDF exports.
0.4.0 #
- Fixed Initial Visibility: Resolved a race condition where the canvas remained invisible until manual interaction on certain devices. Initialization now correctly waits for valid layout constraints via
LayoutBuilder. - Matrix4 Modernization: Replaced deprecated
Matrix4methods withtranslateByDoubleandscaleByDoubleto ensure long-term stability and pass modern static analysis. - Inversion Safety: Fixed a critical
ArgumentError(Matrix cannot be inverted) by ensuring correct homogeneous coordinates in transformation matrices. - Dependency Upgrades:
file_pickerupgraded to^10.3.10,pdfxupgraded to^2.9.2. - Code cleanup and removal of unused internal imports.
0.3.0 #
- Initial release of the Scribe library.
- Support for a multi-page A4 canvas with zooming, panning, and background templates.
- Customizable pen and eraser tools with an integrated
PageHeadertool switcher and size cycling. - Serialization and deserialization for saving and loading drawing strokes.
- PDF export functionality using the
pdfandprintingpackages.