timeRangeScrollPicker method
Implementation
Widget timeRangeScrollPicker(BuildContext context, List<TimeOfDay> times,
{Duration timeRange = const Duration(minutes: 60),
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) {
var secondRange = times[index].plusMinutes(timeRange.inMinutes);
return SizedBox(
height: 48,
child: Center(
child: DUI.text.title3(context,
'${times[index].format(context)} - ${secondRange.format(context)} h'),
),
);
}),
))
]));
}