1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/leanflutter-flutter_aliyun_captcha

Клонировать/Скачать
README.md 5.3 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
gitlife-traslator Отправлено 30.11.2024 19:31 04a64ce

flutter_aliyun_captcha

Плагин для Flutter, обеспечивающий человеко-машинную верификацию.

Поддерживает скользящую верификацию и интеллектуальную верификацию (интеллектуальная верификация в настоящее время не поддерживает формы типа «проведите картой»).

pub version

  • [Скриншоты][screenshots]
  • [Быстрый старт][quickstart]
    • [Установка][installation]
    • [Использование][usage]
      • [Скользящая верификация][slide]
      • [Интеллектуальная верификация][smart]
      • [Получение версии SDK][sdkversion]
  • [Лицензия][license]

Скриншоты

Быстрый старт

Установка

Добавьте это в файл pubspec.yaml пакета:

dependencies:
  flutter_aliyun_captcha: ^1.0.5

Вы можете установить пакет из командной строки:

$ 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: '<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: '<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 <lijy91@foxmail.com>

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

*Примечание: в данном переводе могут быть неточности.*

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/leanflutter-flutter_aliyun_captcha.git
git@api.gitlife.ru:oschina-mirror/leanflutter-flutter_aliyun_captcha.git
oschina-mirror
leanflutter-flutter_aliyun_captcha
leanflutter-flutter_aliyun_captcha
master