flutter_scratch_card 2.0.0
flutter_scratch_card: ^2.0.0 copied to clipboard
A production-ready, highly customizable Flutter scratch card SDK with ImageProvider overlays, themes, brushes, haptics, multi-area scratching, persistence, and accessibility.
Changelog #
2.0.0 #
Breaking changes #
overlayImageis nowImageProvider?instead ofui.Image?.- Pass a decoded
ui.Imagevia the newoverlayUiImageparameter. - Prefer
overlayImage: AssetImage(...)—overlayImageAssetis deprecated.
Architecture #
- Introduced
ScratchEngine/DefaultScratchEngineseparating logic from presentation. - Added multi-area support via
ScratchAreaandonAreaComplete. - Added
ScratchReward/ScratchRewardConfigfor multi and async rewards. - Added accessibility semantics (
semanticLabel,semanticHint, reveal action). - Added
ScratchPerformanceConfigfor grid resolution, point caps, throttling. - Added pluggable
ScratchStateStorage+MemoryScratchStateStorageandstateKey. - Controller:
pause(),resume(),setProgress(),isComplete,isPaused.
Migration #
- See MIGRATION.md.
1.2.0 #
- Added
ScratchCardThemewith classic / metallic / golden / premium / neon / minimal. - Added brush shapes: circle, square, rounded rectangle, custom.
- Added
ScratchRevealShape(rectangle, circle, rounded rectangle, custom). - Added
ScratchCompletionConfig/ effects: none, fade, scale, glow, confetti, shake. - Added optional
ScratchSoundConfigwithScratchSoundPlayeradapter (no audio dependency). - Added
ScratchAnimationConfigfor reveal / reset / completion timing.
1.1.0 #
- Added
ImageProvideroverlay support (network / asset / memory) via Flutter image cache. - Expanded callbacks:
onScratchStart,onScratch,onScratchEnd,onMilestone,onComplete,onReset. - Added
ScratchBrushwith size, softness, hardness, spacing, and presets. - Dedicated
onComplete(fires once until reset; works with auto-reveal and controller reveal). - Added
ScratchHapticConfigwith throttled scratch feedback. - Improved reset:
controller.reset(animated: true)+ScratchResetConfig. - Documentation and example updates.
1.0.0 #
- Initial release of
flutter_scratch_card. - Support for solid color, gradient, and image asset overlays.
- Grid-based progress tracking for high performance.
- Milestone triggers (
progressTriggers) to fire events during scratching. - Animated background support (Lottie and GIF) with lifecycle management.
- Celebration animations play on top of the reward layer.
- Integrated haptic feedback support.
- Production-ready
ScratchControllerfor programmatic control. - Optimized rendering using
RepaintBoundary.