CupertinoPicker is an iOS feature that is used to pick and item from a list. It provides a function similar to the dropdown feature in Android.
Flutter Code for CupertinoPicker
const List<String> currenciesList = [ 'AUD', 'BRL', 'CAD', 'CNY', 'EUR', 'GBP', 'HKD', 'IDR', 'ILS', 'INR', 'JPY', 'MXN', 'NOK', 'NZD', 'PLN', 'RON', 'RUB', 'SEK', 'SGD', 'USD', 'ZAR' ];
CupertinoPicker iOSPicker(){
List<Text> pickerItems = [];
for(String currency in currenciesList){
pickerItems.add((Text(currency)));
}
return CupertinoPicker(
backgroundColor: Colors.lightBlue,
itemExtent: 32.0,
onSelectedItemChanged: (selectedIndex){
print(selectedIndex);
},
children: pickerItems,
);
}
Container(
height: 150.0,
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: 30.0),
color: Colors.lightBlue,
child: iOSPicker(),
),