All Projects → vintage → Scratcher

vintage / Scratcher

Licence: mit
Scratch card widget which temporarily hides content from user.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Scratcher

Gsy flutter demo
Flutter 不同于 GSYGithubAppFlutter 完整项目,本项目将逐步完善各种 Flutter 独立例子,方便新手学习上手和小问题方案解决。 目前开始逐步补全完善,主要提供一些有用或者有趣的例子,如果你也有好例子,欢迎提交 PR 。
Stars: ✭ 2,140 (+919.05%)
Mutual labels:  flutter-plugin
Camera awesome
A flutter plugin to handle Android / iOS camera
Stars: ✭ 186 (-11.43%)
Mutual labels:  flutter-plugin
Geolocation
Flutter geolocation plugin for Android and iOS.
Stars: ✭ 205 (-2.38%)
Mutual labels:  flutter-plugin
Flutter socket io
Socket IO supprt for flutter. Looking for contributors Swift and Java.
Stars: ✭ 170 (-19.05%)
Mutual labels:  flutter-plugin
R upgrade
🆙🚀 Flutter application upgrade / download Plug-in (with notice bar progress), supports full upgrade, hot update and incremental upgrade
Stars: ✭ 177 (-15.71%)
Mutual labels:  flutter-plugin
Android Studio Plugins
This is a list of all awesome and useful android studio plugins.
Stars: ✭ 2,186 (+940.95%)
Mutual labels:  flutter-plugin
Flutter wordpress
Flutter WordPress API
Stars: ✭ 155 (-26.19%)
Mutual labels:  flutter-plugin
Awesome Fluttercn
一份 Flutter 优秀中文资源列表,在这里能找到优质的Flutter库、工具,教程,文章等。
Stars: ✭ 208 (-0.95%)
Mutual labels:  flutter-plugin
Flutter Native State
Flutter plugin to help restoring state after the app process was killed
Stars: ✭ 185 (-11.9%)
Mutual labels:  flutter-plugin
Flutter statusbarcolor
A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.
Stars: ✭ 203 (-3.33%)
Mutual labels:  flutter-plugin
Countrycodepicker
A flutter package for showing a country code selector.
Stars: ✭ 170 (-19.05%)
Mutual labels:  flutter-plugin
Packages.flutter
👨‍💻 Plugins and packages for Flutter framework
Stars: ✭ 173 (-17.62%)
Mutual labels:  flutter-plugin
Flutter crashlytics
📦 Flutter plugin for Crashlytics integration
Stars: ✭ 193 (-8.1%)
Mutual labels:  flutter-plugin
Background locator
A Flutter plugin for updating location in background.
Stars: ✭ 162 (-22.86%)
Mutual labels:  flutter-plugin
Plugins
Plugins for Flutter maintained by the Flutter team
Stars: ✭ 14,956 (+7021.9%)
Mutual labels:  flutter-plugin
Flutter vpn
Plugin to access VPN service for Flutter | Flutter 的 VPN 插件
Stars: ✭ 158 (-24.76%)
Mutual labels:  flutter-plugin
Flutter spinkit
✨ A collection of loading indicators animated with flutter. Heavily Inspired by http://tobiasahlin.com/spinkit.
Stars: ✭ 2,411 (+1048.1%)
Mutual labels:  flutter-plugin
Flutter speed dial
Flutter plugin to implement a Material Design Speed Dial
Stars: ✭ 206 (-1.9%)
Mutual labels:  flutter-plugin
Flutterexampleapps
[Example APPS] Basic Flutter apps, for flutter devs.
Stars: ✭ 15,950 (+7495.24%)
Mutual labels:  flutter-plugin
Flutter Credit Card Input Form
Flutter Credit Card Input form
Stars: ✭ 201 (-4.29%)
Mutual labels:  flutter-plugin

scratcher

Scratch card widget which temporarily hides content from user.

Version

Demo

Features

  • Android and iOS support
  • Cover content with full color or custom image
  • Track the scratch progress and threshold
  • Fully configurable

Getting started

  1. First thing you need to do is adding the scratcher as a project dependency in pubspec.yaml:
dependencies:
 scratcher: "^1.6.0"
  1. Now you can install it by running flutter pub get or through code editor.

Setting up

  1. Import the library:
import 'package:scratcher/scratcher.dart';
  1. 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.
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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].