flutter_recaptcha 0.0.2 copy "flutter_recaptcha: ^0.0.2" to clipboard
flutter_recaptcha: ^0.0.2 copied to clipboard

A lightweight Flutter widget that generates and validates distorted CAPTCHA images with background noise, to secure forms and authentication flows without any external service.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_recaptcha/flutter_recaptcha.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'flutter_recaptcha example',
      home: const CaptchaExamplePage(),
    );
  }
}

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

  @override
  State<CaptchaExamplePage> createState() => _CaptchaExamplePageState();
}

class _CaptchaExamplePageState extends State<CaptchaExamplePage> {
  final TextEditingController _controller = TextEditingController();

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('flutter_recaptcha example')),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(24.0),
          child: CaptchaWidget(
            textField: TextField(
              controller: _controller,
              decoration: const InputDecoration(
                hintText: 'Enter the code above',
                border: OutlineInputBorder(),
              ),
            ),
            onVerified: (isValid) {
              ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(
                  content: Text(isValid ? 'Verified!' : 'Incorrect code, try again.'),
                ),
              );
              _controller.clear();
            },
          ),
        ),
      ),
    );
  }
}
4
likes
0
points
189
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight Flutter widget that generates and validates distorted CAPTCHA images with background noise, to secure forms and authentication flows without any external service.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_recaptcha