This article explains you how to create scratch card view in flutter applications using scratcher flutter package. You can also check out flutter card view related articles.
Scratch Card is most popular in shopping mobile applications to give some rewards or cashback to users on purchase something. We will display dialog to scratch the area on click of button in this flutter example. Scratcher widget has many different properties.
color property is used to change color of scratcher widget. We can also display image on scratch card UI using image property. accuracy attribute is used to detect progress. Lower accuracy indicates higher performance. child property is used to use other widgets as child of scratcher widget.
We can also set size of brush to scratch the card using brushSize property. threshold attribute is used to set percentage level of scratch area. onChange callback is used to detect new area. onThreshold attribute is used to evoke callback.
To display scratch view in dialog, we will use AnimatedOpacity widget. We will also use duration, opacity parameters of AnimatedOpacity widget to scratch area. We will set width and height of scratch dialog dynamic.