vintage / scratcher

Scratch card widget which temporarily hides content from user.
https://pub.dev/packages/scratcher
MIT License
572 stars 67 forks source link

unable to use on website using flutter #56

Closed ysumiit005 closed 1 month ago

ysumiit005 commented 7 months ago

I have a website which need this scratch package but i am unable to do it here is my full code


import 'package:flutter/material.dart';

import 'package:scratcher/scratcher.dart';

// import 'advanced.dart';
// import 'basic.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        body: SafeArea(
          child: Container(
            height: 800,
            width: 800,
            color: Colors.amber,
            child: 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,
              ),
            ),
          ),
        ),
      ),
    );
  }
}
vintage commented 1 month ago

Supported platforms: Android iOS Web (CanvasKit only)