scratch_to_win 0.2.2 copy "scratch_to_win: ^0.2.2" to clipboard
scratch_to_win: ^0.2.2 copied to clipboard

Scratchable overlay to reveal hidden widgets with gestures and callbacks.

scratch_to_win #

CI style: flutter lints

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).

Install #

dependencies:
  scratch_to_win: ^0.2.2

(Not yet on pub.dev — use a git dependency until you publish.)

Quick start #

ScratchToWin(
  child: Center(child: Text('You won!')),
  onRevealProgress: (f) => debugPrint('cleared: $f'),
  onThresholdReached: (f) => debugPrint('threshold at $f'),
)

API overview #

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.

Example #

git clone https://github.com/Dev-Muhammad-Junaid/scratch_to_win.git
cd scratch_to_win/example
flutter pub get
flutter run

Development #

flutter pub get
flutter analyze
flutter test

Publish checks: dart pub publish --dry-run. See pub.dev scoring for documentation and analysis expectations.

License #

MIT. See LICENSE.

2
likes
0
points
244
downloads

Publisher

unverified uploader

Weekly Downloads

Scratchable overlay to reveal hidden widgets with gestures and callbacks.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

audioplayers, flutter

More

Packages that depend on scratch_to_win