scratch_reveal 1.3.1
scratch_reveal: ^1.3.1 copied to clipboard
Interactive scratch card and scratch-to-reveal canvas widget for Flutter with turnkey RewardScratchCard, celebratory confetti bursts, metallic foil, and coin physics.
scratch_reveal #
An interactive, high-performance scratch-to-reveal card library and turnkey RewardScratchCard for Flutter. Features celebratory confetti bursts, turnkey Google Pay & CRED style voucher rewards, flying metallic foil dust particles, coin serration brushes, and sub-0.1ms spatial bitmask progress calculation.
⚡ Key Features #
| Feature | Description | Real-World Benefit |
|---|---|---|
Turnkey RewardScratchCard |
Complete gamified reward card with metallic foil, coupon code, and claim action | Ready in 3 lines of code |
| Celebratory Confetti Cannon | Physics-based 2D confetti ribbons bursting upwards upon threshold auto-reveal | Delightful reward moment |
| Zero-Latency Touch Punch | Touching or tapping down immediately punches a crisp hole without drag delay | Instant, tactile response |
| Coin & Rough Brushes | Realistic coin edge serration with micro-grooves (ScratchBrushShape.coin) |
Feels like a real coin scratcher |
| Flying Foil Dust Particles | Dynamic metallic shaving flakes and sparkle dust that scatter while scratching | Realistic physical sensation |
| Sub-0.1ms Bitmask Tracking | Zero heavy bitmap reading; pure 64-bit integer grid bitmasks on CPU | Constant 120 FPS on all devices |
🚀 Quick Usage #
1. Turnkey Reward Card (Google Pay / CRED / PhonePe Style) #
RewardScratchCard(
rewardTitle: '₹ 250 Cashback',
rewardSubtitle: 'Credited on orders above ₹499',
couponCode: 'SWIGGY250',
coverTitle: 'Scratch & Win',
coverSubtitle: 'Scratch here to reveal your surprise cashback',
threshold: 0.45, // Auto-reveal at 45% scratched
enableConfetti: true, // Confetti explosion on unlock
onClaimPressed: () {
print('Voucher claimed!');
},
)
2. Lower-Level Custom Scratch Card #
ScratchReveal(
brushSize: 40.0,
brushShape: ScratchBrushShape.coin,
threshold: 0.50,
autoReveal: true,
coverGradient: const LinearGradient(
colors: [Color(0xFFFFD700), Color(0xFFB8860B)],
),
revealedChild: Container(
color: const Color(0xFF1E293B),
child: const Center(
child: Text('🎉 500 COINS WON!', style: TextStyle(color: Colors.white)),
),
),
onThresholdReached: () => print('Unlocked!'),
)
💖 Support the Project #
If you find this project useful, consider supporting its active maintenance and future development:
📄 License #
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Maintained with ❤️ by Govind Tank.