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

A simple to use "Captcha" widget for Flutter Apps with custom textStyle and length.

Captcha #

A Flutter package for generating random strings of characters for user verification, also known as a Captcha.

Getting started #

  1. To get started, add captcha as a dependency in your pubspec.yaml file:

dependencies: captcha: ^0.0.2

  1. Import the package and use it in your flutter app.

import 'package:captcha/captcha.dart';

Features #

This Captcha widget generates random text (min 4 chars to max 10 chars). along with random fonts and style.

Usage #

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

class MyHomePage extends StatelessWidget {
  final CaptchaController _captchaController = CaptchaController(length: 6);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Captcha Example"),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Captcha(
            fontSize: 24,
            controller: _captchaController,
          ),
          ElevatedButton(
            onPressed: () {
              _captchaController.changeCaptcha();
            },
            child: Text("Refresh"),
          ),
        ],
      ),
    );
  }
}

Widgets:

Captcha The Captcha widget displays the random string of characters generated by the CaptchaController.

Captcha(
  fontSize: 32,
  controller: _captchaController,
)

Controller:

CaptchaController The CaptchaController generates a random string of characters and can apply text decorations to it.

CaptchaController _captchaController = CaptchaController(length: 6);

// Get the current value of the controller
print(_captchaController.value);

// Generate a new random string
_captchaController.changeCaptcha();

Parameters:

Captcha

  1. Parameter: fontSize, Type: double, DefaultValue: 32, Description: Font size of the displayed Captcha text.
  2. Parameter: controller, Type: CaptchaController, DefaultValue: required, Description: Controller for generating Captcha string.

CaptchaController

  1. Parameter: length, Type: int, Default Value: 5, Description: Length of the generated Captcha string.
  2. Parameter: textStyle, Type: List<TextStyle>, Default Value: Google Fonts, Description: List of text styles to apply to the Captcha string.

That's all for now.

2
likes
110
pub points
62%
popularity

Publisher

unverified uploader

A simple to use "Captcha" widget for Flutter Apps with custom textStyle and length.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, google_fonts

More

Packages that depend on clean_captcha