flutter how to make a dynamic multi-column cupertinoPicker?

9k Views Asked by At

enter image description here

In the gallery of flutter, there is a CupertinoDatePicker which can select multi-column, how to make a custom multi-column CupertinoPicker?

And is it possible make the CupertinoPicker be dynamic. For example, there are cities 2-D data(no need for async data, just an 2-D array). If I select a state, then the sub-column shows the cities in this state.

Thank you.

2

There are 2 best solutions below

4
On BEST ANSWER

Here is Github repo which contains basic Cupertino Widgets. It contains the MultiSelect Cupertino Picker and also with the action.

Direct link of Cupertino Picker widget: https://github.com/dhuma1981/Flutter_Cupertino_Demo/blob/master/lib/ui/pages/picker_page.dart

0
On

Since I ran into the same problem and had to interpret the working answer... it is basically just encase all the picker parts in the StatefulBuilder() (e.g.)

return StatefulBuilder
(
  builder: (BuildContext context, StateSetter setState) => Row
  (...)
)