flutter_yandex_smartcaptcha 0.0.1 copy "flutter_yandex_smartcaptcha: ^0.0.1" to clipboard
flutter_yandex_smartcaptcha: ^0.0.1 copied to clipboard

outdated

Flutter Yandex SmartCaptcha

Flutter Yandex SmartCaptcha #

Example: #

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


// Get you key from admin panel yandex cloud
String siteKey = const String.fromEnvironment('SITE_KEY');

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Yandex SmartCaptcha',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  late final CaptchaConfig captchaConfig;

  @override
  void initState() {
    captchaConfig = CaptchaConfig(
      siteKey: siteKey,
      testMode: false,
    );
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Expanded(
              child: YandexSmartCaptcha(
            captchaConfig: captchaConfig,
            challengeViewCloseCallback: () {
              debugPrint('call: challengeViewCloseCallback');
            },
            challengeViewOpenCallback: () {
              debugPrint('call: challengeViewOpenCallback');
            },
            networkErrorCallback: () {
              debugPrint('call: networkErrorCallback');
            },
            tokenResultCallback: (String token) {
              debugPrint('call: tokenResultCallback $token');
            },
            shouldOpenPolicy: (Uri uriPolicy) {
              return true;
            },
          )),
        ],
      ),
    );
  }
}


4
likes
0
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter Yandex SmartCaptcha

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_inappwebview

More

Packages that depend on flutter_yandex_smartcaptcha