适用于 Flutter 的阿里云滑动验证插件

Overview

flutter_aliyun_captcha

适用于 Flutter 的阿里云人机验证插件

支持滑动验证、智能验证(智能验证暂不支持刮刮卡等形式)。

pub version

屏幕截图

快速开始

安装

将此添加到包的 pubspec.yaml 文件中:

dependencies:
  flutter_aliyun_captcha: ^1.0.4

您可以从命令行安装软件包:

$ flutter packages get

用法

导入 flutter_aliyun_captcha

import 'package:flutter_aliyun_captcha/flutter_aliyun_captcha.dart';

滑动验证

AliyunCaptchaButton 会根据其上层小部件的尺寸自适应,务必在上层小部件设置宽度和高度。

Container(
  width: double.infinity,
  height: 48,
  margin: EdgeInsets.only(
    top: 10,
    bottom: 10,
    left: 16,
    right: 16,
  ),
  child: AliyunCaptchaButton(
    controller: _captchaController,
    type: AliyunCaptchaType.slide, // 重要:请设置正确的类型
    option: AliyunCaptchaOption(
      appKey: '
   
    '
   ,
      scene: 'scene',
      language: 'cn',
      // 更多参数请参见:https://help.aliyun.com/document_detail/193141.html
    ),
    customStyle: '''
      .nc_scale {
        background: #eeeeee !important;
        /* 默认背景色 */
      }

      .nc_scale div.nc_bg {
        background: #4696ec !important;
        /* 滑过时的背景色 */
      }

      .nc_scale .scale_text2 {
        color: #fff !important;
        /* 滑过时的字体颜色 */
      }

      .errloading {
        border: #ff0000 1px solid !important;
        color: #ef9f06 !important;
      }
    ''',
    onSuccess: (dynamic data) {
      // {"sig": "...", "token": "..."}
      _addLog('onSuccess', data);
    },
    onFailure: (String failCode) {
      _addLog('onFailure', 'failCode: $failCode');
    },
    onError: (String errorCode) {
      _addLog('onError', 'errorCode: $errorCode');
    },
  ),
)

智能验证

AliyunCaptchaButton(
    controller: _captchaController,
    type: AliyunCaptchaType.smart, // 重要:请设置正确的类型
    option: AliyunCaptchaOption(
      appKey: '
   
    '
   ,
      scene: 'scene',
      language: 'cn',
      // 更多参数请参见:https://help.aliyun.com/document_detail/193144.html
    ),
    onSuccess: (dynamic data) {
      // {"sig": "...", "token": "..."}
      _addLog('onSuccess', data);
    },
    onFailure: (String failCode) {
      _addLog('onFailure', 'failCode: $failCode');
    },
    onError: (String errorCode) {
      _addLog('onError', 'errorCode: $errorCode');
    },
  ),
)

获取 SDK 版本

String sdkVersion = await AliyunCaptcha.sdkVersion;

许可证

MIT License

Copyright (c) 2021 LiJianying 
   
    

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

   
You might also like...

A credit card widget for Flutter application.

A credit card widget for Flutter application.

A credit card widget for Flutter application.

Dec 27, 2022

Code generation for Flutter Padding widgets based on your constants

Code generation for Flutter Padding widgets based on your constants

Oct 20, 2022

A simple Flutter widget library that helps us to select days in a week.

A simple Flutter widget library that helps us to select days in a week.

A simple Flutter widget library that helps us to select days in a week.

Oct 9, 2022

Flutter debug helper widget with common and custom actions

Flutter debug helper widget with common and custom actions

Flutter debug helper widget with common and custom actions

Dec 7, 2022

A flutter plugin which provides Crop Widget for cropping images.

A flutter plugin which provides Crop Widget for cropping images.

A flutter plugin which provides Crop Widget for cropping images.

Jan 5, 2023

Flutter Easy Getx Implementations .

Flutter Easy Getx Implementations .

People ask me how I manage state,dependency,routes etc when I work with flutter,Here is the Simple Brief About GetX which I used for Dummy Basic Ecommerce Concept based flutter app development .

Oct 18, 2022

The Chicago widget set for Flutter

The Chicago widget set for Flutter

Chicago widget library The Chicago widget set is a retro 32-bit desktop design language for Flutter. It was discussed in the Building a desktop design

Dec 26, 2022

A draggable Flutter widget that makes implementing a Sliding up and fully-stretchable much easier.

A draggable Flutter widget that makes implementing a Sliding up and fully-stretchable much easier.

Draggable Home A draggable Flutter widget that makes implementing a Sliding up and fully-stretchable much easier! Based on the Scaffold and Sliver. Us

Dec 12, 2022

Flutter | Snap physics for your scrollview

Flutter | Snap physics for your scrollview

Snap Scroll Physics When building scrollable views, sometimes you would prefer that the scroll stopped at a given offset, or that it avoids to stop in

Nov 21, 2022
Comments
  • 工程Andoid跑不起来

    工程Andoid跑不起来

    • What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

    java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $

    opened by wenjiang 0
Owner
LeanFlutter
To make the flutter even simpler
LeanFlutter
Flutter Carousel Pro - A Flutter Carousel widget

Carousel Extended A Flutter Carousel widget. Usage As simple as using any flutter Widget. Based on Carousel Pro but extended to be able to navigate be

omid habibi 3 Dec 7, 2020
Flutter-useful-widgets - Flutter Useful Widgets

useful_widgets This package makes it easy to build apps by providing a list of simple and useful widgets. import 'package:useful_widgets/useful_widget

Ricardo Crescenti 6 Jun 20, 2022
Flutter Duration Button - Create auto-click button likes Netflix's Skip Intro button in Flutter

Flutter Duration Button - Create auto-click button likes Netflix's Skip Intro button in Flutter

Kim Seung Hwan 7 Dec 7, 2022
Various Flutter widgets that are developed by Google but not by the core Flutter team

Flutter widgets This repository contains the source code for various Flutter widgets that are developed by Google but not by the core Flutter team. Is

Google 1.1k Jan 7, 2023
🟥 A flutter widget that flashes when flutter fails to render a frame in a certain timeframe

?? A flutter widget that flashes when flutter fails to render a frame in a certain timeframe

Andrei Lesnitsky 32 Oct 8, 2022
A Flutter plugin that makes it easier to make floating/overlay windows for Android with pure Flutter

flutter_floatwing A Flutter plugin that makes it easier to make floating/overlay windows for Android with pure Flutter. Android only Features Pure Flu

Zoe 116 Dec 21, 2022
Flutter Application to test basic flutter understanding

Flutter Application to test basic flutter understanding Getting Started Before you start with the application have a look at what

null 0 Apr 16, 2022
Flutter UI Widgets Flutter Package

Flutter UI Widgets Flutter Package This package makes different Flutter UI widgets implementation easy for you. Flutter UI Widgets The list of widgets

Hassan Ur Rahman 0 May 6, 2022
React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.

English | Português Flutter Hooks A Flutter implementation of React hooks: https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889 Ho

Remi Rousselet 2.6k Dec 29, 2022
Simple form maker for Flutter Framework

Flutter FormBuilder - flutter_form_builder This package helps in creation of data collection forms in Flutter by removing the boilerplate needed to bu

Danvick Miller 1.2k Jan 3, 2023