flutter_captcha 1.0.0 copy "flutter_captcha: ^1.0.0" to clipboard
flutter_captcha: ^1.0.0 copied to clipboard

Flutter captcha.

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