duration_spinbox 0.1.1 copy "duration_spinbox: ^0.1.1" to clipboard
duration_spinbox: ^0.1.1 copied to clipboard

A duration widget for Flutter, heavily inspired by flutter_spinbox

Duration Spinbox #

style: very good analysis Powered by Mason License: MIT

A duration widget for Flutter, heavily inspired by flutter_spinbox

Installation 💻 #

❗ In order to start using Duration Spinbox you must have the Flutter SDK installed on your machine.

Install via flutter pub add:

dart pub add duration_spinbox

or just add this line to your pubspec.yaml

duration_spinbox: ^0.1.0

Usage #

Currently this only shows the Duration in the format mm:ss, more customization options to come in the future.

The only required parameter is value which is the initial/current duration.

DurationSpinbox(
  value: Duration(minutes: 1),
),

This is designed to work similar to DropDownButton where you have to update the value when changed. Like this:

var _duration = Duration(minutes: 1);

...

DurationSpinbox(
  value: _duration,
  onChanged: (value){
    setState((){
      _duration = value;
    });
  },
),

You can set a minimum and maximum value. By default minimum is Duration.zero but max is by default null.

DurationSpinbox(
  value: Duration(minutes: 1),
  min: Duration(minutes: 1),
  max: Duration(minutes: 5),
),

You can set the stepValue which is the Duration the value will be increased or decreased. By default it is Duration(minutes: 1).

 DurationSpinbox(
  value: Duration.zero,
  stepValue: Duration(minutes: 5),
),

By default min is equal to Duration.zero, to allow negative values you have to set min to null manually.

 DurationSpinbox(
  value: Duration(minutes: 0),
  min: null,
),

What's next #

  • Formatting options
  • Editing options
  • Customization options

1
likes
160
pub points
15%
popularity

Publisher

unverified uploader

A duration widget for Flutter, heavily inspired by flutter_spinbox

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on duration_spinbox