这是indexloc提供的服务,不要输入任何密码

resend_timer_button 1.0.1 copy "resend_timer_button: ^1.0.1" to clipboard
resend_timer_button: ^1.0.1 copied to clipboard

A customizable Flutter countdown button used for OTP or resend flows.

resend_timer_button #

Pub Version License: MIT Flutter Likes Pub Points Popularity

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:ss or 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 #

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.

1
likes
160
points
183
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable Flutter countdown button used for OTP or resend flows.

Repository (GitHub)
View/report issues

Topics

#otp #timer #resend #countdown #button

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on resend_timer_button