clear_package 1.0.0 clear_package: ^1.0.0 copied to clipboard
A Flutter package for generating clear and customizable CAPTCHA images to enhance security in applications.
Clear Captcha #
A Flutter package to generate and display CAPTCHA images in your application. This package allows for customizable CAPTCHA images with different settings for dimensions, colors, and text.
Features #
- Generate random CAPTCHA images with customizable length, width, height, background color, and text color.
- Option to refresh the CAPTCHA image with an icon.
- Simple integration into your Flutter application.
Installation #
To use this package, add clear_captcha
to your pubspec.yaml
file:
dependencies:
clear_captcha: ^1.0.0
Then run:
flutter pub get
Usage #
Import the package in your Dart file:
import 'package:clear_captcha/clear_captcha.dart';
Example #
Here is a basic example of how to use the ClearCaptcha
widget:
import 'package:flutter/material.dart';
import 'package:clear_captcha/clear_captcha.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Clear Captcha Example'),
),
body: Center(
child: ClearCaptcha(
captchaLenght: 6, // Length of the CAPTCHA
captchaWidth: 300, // Width of the CAPTCHA image
captchaHeight: 100, // Height of the CAPTCHA image
backgroundColor: Colors.lightBlueAccent, // Background color
captchaTextColor: Colors.white, // CAPTCHA text color
cornerRadius: 15.0, // Corner radius for the CAPTCHA background
iconColor: Colors.red, // Icon color for refresh button
iconSize: 30.0, // Size of the refresh icon
refreshIcon: Icons.refresh, // Icon for refreshing CAPTCHA
onCaptchValue: (value) {
// Handle the generated CAPTCHA value
print('Generated CAPTCHA: $value');
},
),
),
),
);
}
}
CAPTCHA Example Images #
Here are some example CAPTCHA images generated by the package:
Parameters #
- captchaLenght:
int?
- Length of the generated CAPTCHA string. Default is5
. - captchaWidth:
int?
- Width of the CAPTCHA image. Default is200
. - captchaHeight:
int?
- Height of the CAPTCHA image. Default is100
. - backgroundColor:
Color?
- Background color of the CAPTCHA image. Default isColors.white
. - captchaTextColor:
Color?
- Color of the CAPTCHA text. Default isColors.black
. - cornerRadius:
double?
- Corner radius for the CAPTCHA background. Default is20.0
. - iconColor:
Color?
- Color of the refresh icon. Default isColors.black
. - iconSize:
double?
- Size of the refresh icon. Default is40.0
. - refreshIcon:
IconData?
- Icon data for the refresh button. Default isIcons.autorenew
. - isIcon:
bool?
- Whether to show the refresh icon. Default istrue
. - onCaptchValue:
Function(String)?
- Callback function that returns the generated CAPTCHA string.
Contribution #
Contributions are welcome! Please feel free to contact this mubeenofficial01@gmail.com
License #
This project is licensed under the MIT License. See the LICENSE file for details.