Pick Value onTap in CupertinoPicker and CupertinoDatePicker

544

Unfortunately, the gesture detection inside CupertinoPicker/CupertinoDatePicker is not supported for now. When you trace the code inside CupertinoPicker, it leads to use ListWheelScrollView at the end and it does not respond to the tap event.

Discussion thread on GitHub:

There is a workaround solution by using package clickable_list_wheel_view (fixed height for the child widget, mentioned here)

Share:
544
SardorbekR
Author by

SardorbekR

Mobile (iOS/Flutter) Developer

Updated on December 27, 2022

Comments

  • SardorbekR
    SardorbekR over 1 year

    onSelectedItemChanged is working perfectly in CupertinoPicker/CupertinoDatePicker

    But I also want to pick value when user clicked the value.

    Currently, user must scroll in order to pick the value, and as far as I know CupertinoPicker/CupertinoDatePicker doesn't have onTap, onPressed functions

    How can I solve this issue

    enter image description here

    • meditat
      meditat over 3 years
      if you tap on an item, it will lead to scroll to that position, so the onSelectedItemChanged will be invoked.
    • SardorbekR
      SardorbekR over 3 years
      @meditat Please, could you clarify your answer? (tapping on an item is not invoking onSelectedItemChanged function)
  • Iván Yoed
    Iván Yoed about 3 years
    It is indeed not working. Me as well tried to figure out a way, but the furthest I got to, was to that github issue.