slider_captcha 0.0.8 copy "slider_captcha: ^0.0.8" to clipboard
slider_captcha: ^0.0.8 copied to clipboard

outdated

slide captcha the same as binance, allow drag and drop for validation

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:slider_captcha/slider_capchar.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final SliderController controller = SliderController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: SliderCaptcha(
          controller: controller,
          image: Image.asset(
            'assets/image.jpeg',
            fit: BoxFit.fitWidth,
          ),
          onConfirm: (value) {
            debugPrint(value.toString());
            Future.delayed(const Duration(seconds: 1)).then((value) {
              controller.create();
            });
          }),
    ));
  }

  void showMyDialog(BuildContext context) {
    showDialog(
        context: context,
        builder: (context) {
          return AlertDialog(
            title: const Icon(
              Icons.check_circle_outline,
              color: Colors.green,
            ),
            content: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: const [
                Text('Authentication successful!'),
              ],
            ),
          );
        });
  }

  void showCaptcha(BuildContext context) {
    showDialog(
        context: context,
        builder: (context) {
          return Dialog(
            child: Container(
              height: 280,
              width: 280,
              padding: const EdgeInsets.all(8.0),
              child: SliderCaptcha(
                image: Image.asset(
                  'assets/image.jpeg',
                  fit: BoxFit.fitWidth,
                ),
                onConfirm: (bool value) {},
                // onConfirm: () => showMyDialog(context),
              ),
            ),
          );
        });
  }
}
95
likes
0
pub points
92%
popularity

Publisher

verified publisherbrian98.com

slide captcha the same as binance, allow drag and drop for validation

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on slider_captcha