How to create timer picker in flutter?

5,933

There is a CupertinoTimePicker widget that does just this

Check this out

class Cupert extends StatefulWidget {

  @override
  _CupertState createState() => _CupertState();
}

class _CupertState extends State<Cupert> {
  var value = "";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: SafeArea(
        child: Column(
          children: <Widget>[
            Expanded(
              child: Center(
                child: Text(
                  "$value"
                ),
              ),
            ),
            CupertinoTimerPicker(
              mode: CupertinoTimerPickerMode.hm,
              onTimerDurationChanged: (value){
                setState(() {
                  this.value = value.toString();
                });
              },
            ),
          ],
        ),
      ),
    );
  }
}
Share:
5,933
Tree
Author by

Tree

Updated on December 04, 2022

Comments

  • Tree
    Tree over 1 year

    Is it possible to create duration timer, like in iOS in flutter?

    example duration picker