Scratcher
Scratch card widget which temporarily hides content from user.
Install / Use
/learn @vintage/ScratcherREADME
scratcher
Scratch card widget which temporarily hides content from the user.

Features
- Supported platforms:
- Android
- iOS
- Web (CanvasKit only)
- Cover content with full color or custom image
- Track the scratch progress and threshold
- Fully configurable
Getting started
- First thing you need to do is adding the scratcher as a project dependency in
pubspec.yaml:
dependencies:
scratcher: "^2.5.0"
- Now you can install it by running
flutter pub getor through code editor.
Setting up
- Import the library:
import 'package:scratcher/scratcher.dart';
- Cover desired widget with the scratch card:
Scratcher(
brushSize: 30,
threshold: 50,
color: Colors.red,
onChange: (value) => print("Scratch progress: $value%"),
onThreshold: () => print("Threshold reached, you won!"),
child: Container(
height: 300,
width: 300,
color: Colors.blue,
),
)
Properties
Property | Type | Description --- | --- | --- child | Widget | Widget rendered under the scratch area. enabled | bool | Whether new scratches can be applied. threshold | double | Percentage level of scratch area which should be revealed to complete. brushSize | double | Size of the brush. The bigger it is the faster user can scratch the card. accuracy | ScratchAccuracy | Determines how accurate the progress should be reported. Lower accuracy means higher performance. color | Color | Color used to cover the child widget. image | Image | Image widget used to cover the child widget. rebuildOnResize | bool | Determines if the scratcher should rebuild itself when space constraints change (resize). onChange | Function | Callback called when new part of area is revealed (min 0.1% difference). onThreshold | Function | Callback called when threshold is reached (only when defined). onScratchStart | Function | Callback called when scratching starts. onScratchUpdate | Function | Callback called during scratching. onScratchEnd | Function | Callback called when scratching ends.
Programmatic access
You can control the Scratcher programmatically by assigning the GlobalKey to the widget.
final scratchKey = GlobalKey<ScratcherState>();
Scratcher(
key: scratchKey,
// remaining properties
)
After assigning the key, you can call any exposed methods e.g.:
RaisedButton(
child: const Text('Reset'),
onPressed: () {
scratchKey.currentState.reset(duration: Duration(milliseconds: 2000));
},
);
Method | Description --- | --- reset | Resets the scratcher state to the initial values. reveal | Reveals the whole scratcher, so than only original child is displayed.
Example Project
There is a crazy example project in the example folder. Check it out to see most of the available options.
Resources
- https://www.youtube.com/watch?v=EM4D1pUpadA by The CS Guy
Related Skills
qqbot-channel
346.8kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.1k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
346.8kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Design
Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t
