0

I'm implementing a simple Cupertino TimerPicker widget on a Flutter app and, for some reason, the values displayed on the picker for the minutes get trimmed once they go above 20:

https://www.dropbox.com/s/jqu45skpjob4it0/Screenshot%202019-11-01%2013.51.29.png

Originally I had the widget inside a showModalBottomSheet widget with some customization, but the problem persists even after trying to display the simplest implementation of the timer picker within a column widget.

When I spin the picker, I can get the correct values. For example, if I select 22 minutes, onTimerDurationChanged passes a Duration value of 22 minutes, even if the picker displays only "2" in the UI (as seen in the screenshot). So it looks like the problem is in how the widget displays the values.

Here's the code for the Timer Picker child in its containing Column widget:

          Expanded(
            child: Container(
              height: 200,
              child: CupertinoTimerPicker(
                mode: CupertinoTimerPickerMode.hm,
                initialTimerDuration: Duration(minutes: 20),
                onTimerDurationChanged: (Duration value) {},
              ),
            ),
          ),

Further details:

1) The bug is present only when setting

mode: CupertinoTimerPickerMode.hm

The issue goes away if mode is set to .ms or to .hms. Unfortunately, I need to use the .hm mode.

2) The issue appears when running the app on iOS (both in the simulator and on a physical device). Ironically, it works just fine on Android.

--

I'm not getting any kind of error in the console or within the Android Studio editor. I'm not sure where else to look for troubleshooting.

  • I have the same problem here! Did you find something to fix this? – testerino Dec 03 '19 at 17:10
  • @testerino I didn't find a solution. I suspect this might be a bug in the Cupertino package itself, but I was too lazy to report it to the Flutter team. I ended up settling for the .hms mode. Setting the seconds intervals to 10 (so the picker displays as options 0, 10, 20 seconds (etc) made it less painful. – javiernanni Dec 04 '19 at 01:59
  • Oh I see, thanks for answering! Maybe I report it to Flutter team. – testerino Dec 04 '19 at 08:21

0 Answers0