timeScrollPicker method
Widget
timeScrollPicker(
- BuildContext context,
- List<
TimeOfDay> times, { - required dynamic onTimeSelected(
- TimeOfDay timeSelected
- double pickerHeight = 180,
Implementation
Widget timeScrollPicker(BuildContext context, List<TimeOfDay> times,
{required Function(TimeOfDay timeSelected) onTimeSelected,
double pickerHeight = 180}) {
return SizedBox(
height: pickerHeight,
child: Row(children: [
Expanded(
child: CupertinoPicker(
onSelectedItemChanged: (int value) {
onTimeSelected(times[value]);
},
itemExtent: 48,
children: List.generate(times.length, (index) {
return SizedBox(
height: 48,
child: Center(
child: DUI.text
.title3(context, '${times[index].format(context)} h'),
),
);
}),
))
]));
}