搜尋套件、儲存庫與 APP 分類

omjo_captcha 封面
套件詳情v0.0.10

omjo_captcha

一個可自定義的基於文字的驗證碼小部件,包含隨機彩色字元和線條。無需後端支援。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
21
喜歡數
2
Pub 分數
160

安裝套件

flutter pub add omjo_captcha

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

omjo_captcha 是一個 Flutter 小部件,提供不需要後端的可自訂文字型 CAPTCHA。它會產生隨機的彩色字元與裝飾性線條,以幫助防止機器人自動提交表單。設計簡單且易於整合,能順暢地融入需要使用者驗證的表單中。此套件支援多種平台,包括 Android、iOS、Web、macOS、Windows 與 Linux,適用於跨平台應用程式。

適用情境

  • 表單垃圾訊息防護
  • 登入/註冊流程中的使用者驗證
  • Web和移動應用中的機器人檢測
  • 簡單的僅前端驗證碼解決方案
  • 增強面向公眾的表單安全性

主要特色

  • 可自定的角色顏色和樣式
  • 隨機文字和行模式
  • 無後端依賴
  • 跨平台相容性
  • 與 Flutter 表單輕鬆整合
  • 可設定的難度等級

適合對象

  • 需要輕量級驗證碼的開發者
  • 具有嚴格隱私要求的項目
  • 僅前端的安全實作
  • 移動和網路應用
  • 需要快速設置驗證碼的原型或MVP

使用建議

  • 不適用於高安全性環境
  • 僅限視覺模式識別
  • 可能需要進行無障礙調整
  • 依賴客戶端隨機性
  • 不支援音訊或圖像驗證碼

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

omjo_captcha

pub package

A customizable, client-side CAPTCHA widget for Flutter with randomized colorful characters and noise lines.
No backend required — perfect for login forms, guestbooks, or simple human verification needs.


Captcha Screenshot


✨ Features

  • 🎨 Randomized colored characters
  • 🔀 Noise/disturbance lines for bot resistance
  • 🔄 Easy CAPTCHA refresh
  • ✅ Custom validation logic
  • 🚫 Works entirely offline (no server needed)

🌐 Live Demo

🧪 Try it directly in your browser (no installation needed):
👉 https://omjocaptcha.netlify.app


📦 Installation

Add this to your pubspec.yaml:

dependencies:
  omjo_captcha: ^0.0.1

Then run:

flutter pub get

🚀 Usage

Here's a simple example:

import 'package:flutter/material.dart';
import 'package:omjo_captcha/omjo_captcha.dart';
import 'dart:math';

class CaptchaPreview extends StatefulWidget {
  const CaptchaPreview({super.key});

  @override
  State<CaptchaPreview> createState() => _CaptchaPreviewState();
}

class _CaptchaPreviewState extends State<CaptchaPreview> {
  late List<CaptchaChar> characters;
  late List<CaptchaLine> lines;

  @override
  void initState() {
    super.initState();
    _generateCaptcha();
  }

  void _generateCaptcha() {
    final random = Random();
    const text = 'A7B2X';

    characters = text.split('').map((char) {
      return CaptchaChar(
        char: char,
        color: _randomColor(random),
        yOffset: 10 + random.nextDouble() * 10,
        rotation: (random.nextDouble() - 0.5) * 0.3,
      );
    }).toList();

    lines = List.generate(5, (_) {
      return CaptchaLine(
        start: Offset(random.nextDouble() * 120, random.nextDouble() * 50),
        end: Offset(random.nextDouble() * 120, random.nextDouble() * 50),
        color: _randomColor(random),
      );
    });

    setState(() {});
  }

  Color _randomColor(Random random) {
    return Color.fromARGB(
      255,
      100 + random.nextInt(156),
      100 + random.nextInt(156),
      100 + random.nextInt(156),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        CustomPaint(
          size: const Size(150, 50),
          painter: CaptchaPainter(characters, lines),
        ),
        const SizedBox(height: 10),
        ElevatedButton(
          onPressed: _generateCaptcha,
          child: const Text('Refresh Captcha'),
        ),
      ],
    );
  }
}

📁 Folder Structure

lib/
├── omjo_captcha.dart
└── src/
    ├── captcha_painter.dart
    ├── models/
    │   ├── captcha_char.dart
    │   └── captcha_line.dart

🧪 Example App

Clone this repo and run the example:

cd example
flutter run

💡 Tips

  • You can wrap this CAPTCHA in a TextFormField widget for login forms.
  • Combine with your auth logic to validate user input against captchaText.

🛠️ Contributing

Contributions are welcome!
If you found a bug or want a new feature, please open an issue or submit a pull request.


Support the Project

If you find this plugin helpful, consider supporting its development:

  • Buy Me a Coffee

Your support is greatly appreciated!


📄 License

MIT © Abu Khoerul Iskandar Ali (Omjo)
See LICENSE for details.


🙌 Credits

Built with 💙 using Flutter.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。