otp_resend_timer 1.0.0
otp_resend_timer: ^1.0.0 copied to clipboard
Flutter widget that handle OTP resend functionality with customizable UI, animations, and callback support.
๐ฅ OTP Resend Timer ๐ฅ #
Preview #
โจ Super Flexible OTP Resend Timer for Flutter! #
Tired of building OTP verification screens from scratch? Say goodbye to that frustration! OTP Resend Timer is here to make your life easier! ๐
๐ Features #
- โฑ๏ธ Flexible Timer - Fully customizable countdown timer
- ๐ฎ Full Control - Start and reset functionality with dedicated UI controls
- ๐จ Beautiful UI - Customizable styles and animations
- โจ Smooth Animations - Elegant transitions between timer states
- ๐งฉ Easy Integration - Simple to implement in your Flutter apps
- ๐งช Well Tested - Comprehensive test coverage for reliability
๐ฆ Installation #
Add this to your package's pubspec.yaml
file:
dependencies:
otp_resend_timer: ^1.0.0
Then run:
flutter pub get
๐ Usage #
Using OTP Resend Timer is super simple! Just import the package and add the widget to your build method:
import 'package:otp_resend_timer/otp_resend_timer.dart';
// Create a controller
final controller = OtpResendTimerController(initialTime: 30);
// Add the widget to your UI
OtpResendTimer(
controller: controller,
autoStart: true,
timerMessage: "Resend OTP in ",
readyMessage: "You can now resend the code",
onFinish: () {},
onResendClicked: () {},
onStart: () {}
)
๐ฎ Controller Features #
The OtpResendTimerController
gives you full control over the timer:
// Start the timer
controller.start();
// restart the timer
controller.reset();
// Always dispose when done
@override
void dispose() {
controller.dispose();
super.dispose();
}
๐จ Customization #
Make it your own! The OTP Resend Timer is fully customizable:
OtpResendTimer(
controller: controller,
// Messages
timerMessage: "Resend in",
readyMessage: "Ready to resend!",
// would never show in case autoplay is true
holdMessage: "Timer paused",
resendMessage: "RESEND",
// Styles
timerMessageStyle: TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
readyMessageStyle: TextStyle(color: Colors.green),
holdMessageStyle: TextStyle(color: Colors.orange),
resendMessageStyle: TextStyle(color: Colors.purple, decoration: TextDecoration.underline),
resendMessageDisabledStyle: TextStyle(color: Colors.grey),
// Callbacks
onStart: () => print("Timer started"),
onFinish: () => print("Timer finished"),
onResendClicked: () => print("Resend clicked"),
// Auto-start the timer
autoStart: true,
)
๐ฑ Examples #
Check out the example folder for a complete working example:
โค๏ธ Contributing #
Contributions are always welcome! Please feel free to submit a PR.
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.
๐จ๐ปโ๐ป Author #
Emad Beltaje #
๐งก Support #
Don't forget to like the package ๐๐ป and star the repo โญ๏ธ