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

outdated

Google Recaptcha v2 plugin

example/lib/main.dart

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

void main() => runApp(MyApp());

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

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String verifyResult = "";

  RecaptchaV2Controller recaptchaV2Controller = RecaptchaV2Controller();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Stack(
        children: <Widget>[
          Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                RaisedButton(
                  child: Text("SHOW ReCAPTCHA"),
                  onPressed: () {
                    recaptchaV2Controller.show();
                  },
                ),
                Text(verifyResult),
              ],
            ),
          ),
          RecaptchaV2(
            apiKey: "6Lc_erMUAAAAAFnlJh8hYO7Uj9CZW95vTcdzKALA",
            controller: recaptchaV2Controller,
            response: (token){
              setState(() {
                verifyResult = token;
              });
            },
          ),
        ],
      ),
    );
  }
}
2
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Google Recaptcha v2 plugin

Homepage

License

MIT (LICENSE)

Dependencies

flutter, http, webview_flutter

More

Packages that depend on recaptchav2_plugin