CI / Pages badges reflect the latest GitHub Actions run; if they look wrong on pub.dev, wait a few minutes and hard-refresh — image caches can lag.
Flutter widget: a scratch-off layer on top of any child. Drag to reveal what is underneath. Pointer lifecycle callbacks and an optional grid-based estimate of cleared area (for thresholds and win logic).
dependencies:
scratch_to_win: ^0.2.4- Live (web): GitHub Pages demo — enable Settings → Pages → GitHub Actions in this repo on first use; the Deploy example (web) workflow must succeed once.
- In the package: the published tarball includes the
example/Flutter project (interactive “lab” for every API option). - On pub.dev, open the package’s repository link to browse
example/online, or use your pub cache afterdart pub get.
ScratchToWin(
child: Center(child: Text('You won!')),
onRevealProgress: (f) => debugPrint('cleared: $f'),
onThresholdReached: (f) => debugPrint('threshold at $f'),
)| Area | Details |
|---|---|
| Callbacks | onScratchStart, onScratchUpdate, onScratchEnd, onScratchCancel, onRevealProgress, onThresholdReached |
| Brush | Round stroke: brushRadius; optional brushTexture (ImageProvider) |
| Progress | trackRevealProgress, progressGridResolution (see class docs), revealThreshold |
| Control | ScratchToWinController.reset(), revealAll(), enabled |
| Surface | overlayColor, overlayGradient, overlayImage, overlayImageFit, borderRadius |
| Completion | playConfettiOnThreshold, confettiParticleCount, confettiDuration, confettiMinChipSize, confettiMaxChipSize; optional sound |
| Accessibility | showRevealAssistButton, revealAssistButtonLabel ('' hides if switch on), revealAssistPadding |
Pure Flutter drawing for the scratch layer; built-in full-card confetti (no extra package). Optional audioplayers for completion SFX. Optional haptics on start and when the threshold is crossed.
git clone https://github.com/Dev-Muhammad-Junaid/scratch_to_win.git
cd scratch_to_win/example
flutter pub get
flutter runSee example/README.md for the lab app, web build, and pub.dev layout.
flutter pub get
flutter analyze
flutter testPublish checks: dart pub publish --dry-run. See pub.dev scoring for documentation and analysis expectations.
MIT. See LICENSE.