dp_stopwatch 0.0.3 dp_stopwatch: ^0.0.3 copied to clipboard
The default widget Stopwatch() class has no method to get the values as a stream. This repo brings a better version of stopwatch
The default widget Stopwatch() class has no method to get the values as a stream. It only outputs a single value whenever one of its methods is called. This repo brings a better version of stopwatch
Features #
Getting started #
The project shall migrate to null safety
Usage #
- Create viewmodel
final stopwatchViewModel = DPStopwatchViewModel(
clockTextStyle: const TextStyle(
color: Colors.black,
fontSize: 32,
),
);
- Bind the viewmodel to widget
...
DPStopWatchWidget(
stopwatchViewModel,
),
...
- Control the widget via viewmodel, e.x. when user clicks a button
...
TextButton(
style: TextButton.styleFrom(
textStyle: const TextStyle(fontSize: 20),
),
onPressed: () {
stopwatchViewModel.pause?.call();
},
child: const Text('pause'),
),
...