0 purchases
count down time
count_down_time #
This widget render a simple count-down time.
Getting Started #
Below the simple example:
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CountDownTime(
timeId: 'simple-timer',
timeStartInSeconds: 30,
onChangeTime: (time) {
setState(() {
timeoutReached = false;
});
},
onTimeOut: () {
setState(() {
timeoutReached = true;
});
},
),
Container(
padding: const EdgeInsets.only(top: 10),
alignment: Alignment.center,
child: ElevatedButton(
child: const Text('Restart count'),
onPressed: () {
CountDownTimeController.pushTimerRenewId(widget.id);
},
)),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Text(timeoutReached ? 'Timeout Reached' : ''))
])
copied to clipboard
For more details see the project demo in the demo
folder.
About the props:
Prop
Type
Description
timeId
String
Define the timer id.
timeStartInSeconds
int
Define the time to start the count-down in seconds.
textStyle (optional)
textStyle
Define the style of timer.
onTimeOut
Function
Define the callback when the count-down is finished.
onChangeTime
Function(int time)
Define the callback when the count-down is changed.
About the factory:
The widget has two factories to work with minutes and hours on count-down start. See the example below:
Minutes:
CountDownTime.minutes(
timeStartInMinutes: 2
)
copied to clipboard
Hours:
CountDownTime.hours(
timeStartInHours: 2
)
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.