resend_timer_button 1.0.1
SDKflutter
Platformandroidioswindowslinuxmacosweb
A customizable Flutter countdown button used for OTP or resend flows.
resend_timer_button
A customizable Flutter button widget with a built-in countdown timer. Commonly used in OTP, verification, or password reset flows where users need to wait before resending a code or performing an action again.
✨ Features
- Countdown timer with two formats:
mm:ssor raw seconds - Three button styles: Elevated, Text, Outlined
- Custom loading state with optional controller
- Easy integration with GetX, BLoC, or plain Flutter
🚀 Installation
Add this to your pubspec.yaml:
dependencies:
resend_timer_button: ^1.0.0
Install it You can install packages from the command line: with Flutter:
flutter pub get
🔧 Usage
Basic Example
import 'package:resend_timer_button/resend_timer_button.dart';
ResendTimerButton(
onPressed: () {
// trigger resend logic here
},
text: const Text("Resend in"),
duration: 60, // in seconds
)
With Countdown Format
ResendTimerButton(
onPressed: () => print("Tapped"),
text: const Text("Resend in"),
duration: 60,
format: ResendTimeFormat.time, // or ResendTimeFormat.number
)
With Controller
final controller = ResendTimerButtonController();
ResendTimerButton(
controller: controller,
onPressed: () async {
controller.loading();
await Future.delayed(Duration(seconds: 2));
controller.startTimer();
},
text: Text("Resend"),
duration: 120,
)
📱 Demo

🎨 Parameters
| Property | Type | Description |
|---|---|---|
onPressed | VoidCallback? | Called when the button is tapped |
text | Text | Text widget to show |
duration | int | Countdown duration in seconds |
format | ResendTimeFormat | time (mm:ss) or number (seconds) |
buttonType | ButtonType | Elevated, Text, or Outlined button style |
controller | ResendTimerButtonController? | Optional external controller |
loadingIndicator | ProgressIndicator? | Custom loading indicator |
textColor | Color? | Color of the text |
backgroundColor | Color? | Button background color |
loadingIndicatorColor | Color? | Color of loading spinner |
radius | double? | Border radius |
height | double? | Height of the button |
🛠 Maintainer
Maintained by Abdulmajeed Altwaireb
Feel free to open an issue or submit a pull request.
🤝 Contributing
Contributions are welcome and appreciated!
Please open issues for bugs, suggestions, or enhancements.
Pull requests should follow Flutter's style guide.
📄 License
This project is licensed under the MIT License.