Hanggi
Hanggi

Reputation: 715

flutter how to make a dynamic multi-column cupertinoPicker?

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.

Upvotes: 4

Views: 9623

Answers (2)

esSarah
esSarah

Reputation: 1

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
  (...)
)

Upvotes: 0

Dhrumil Shah - dhuma1981
Dhrumil Shah - dhuma1981

Reputation: 15799

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

Upvotes: 9

Related Questions