0 purchases
clean captcha
Captcha #
A Flutter package for generating random strings of characters for user verification, also known as a Captcha.
Getting started #
To get started, add captcha as a dependency in your pubspec.yaml file:
dependencies:
captcha: ^0.0.2
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"),
),
],
),
);
}
}
copied to clipboard
Widgets:
Captcha
The Captcha widget displays the random string of characters generated by the CaptchaController.
Captcha(
fontSize: 32,
controller: _captchaController,
)
copied to clipboard
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();
copied to clipboard
Parameters:
Captcha
Parameter: fontSize, Type: double, DefaultValue: 32, Description: Font size of the displayed Captcha text.
Parameter: controller, Type: CaptchaController, DefaultValue: required, Description: Controller for generating Captcha string.
CaptchaController
Parameter: length, Type: int, Default Value: 5, Description: Length of the generated Captcha string.
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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.