feduke-nukem / flutter_captcha

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flutter Captcha

2 3

Features

Provide any widget, and it will be automatically divided into parts that can be rotated and positioned. At any point, you can check the solution status to confirm if the user has successfully passed the captcha test.

Getting started

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _controller = FlutterCaptchaController(
    random: Random.secure(),
  )..init();

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        body: Center(
          child: FlutterCaptcha(
            controller: _controller,
            crossLine: (color: Colors.white, width: 10),
            fit: BoxFit.cover,
            draggingBuilder: (_, child) => Opacity(opacity: 0.5, child: child),
            child: Image.network(
              'https://upload.wikimedia.org/wikipedia/commons/4/4f/Dash%2C_the_mascot_of_the_Dart_programming_language.png',
            ),
          ),
        ),
      ),
    );
  }
}

Try it out by link

About

License:MIT License


Languages

Language:Dart 45.6%Language:C++ 26.5%Language:CMake 21.8%Language:HTML 2.1%Language:Swift 2.0%Language:C 1.7%Language:Kotlin 0.1%Language:Objective-C 0.0%