dateScrollPicker method
Implementation
Widget dateScrollPicker(BuildContext context, List<DateTime> dates,
{required Function(DateTime dateSelected) onDateSelected,
String todayString = 'Avui',
String tomorrowString = 'Demà ',
double pickerHeight = 180}) {
return SizedBox(
height: pickerHeight,
child: Row(children: [
Expanded(
child: CupertinoPicker(
onSelectedItemChanged: (int value) {
onDateSelected(dates[value]);
},
itemExtent: 48,
children: List.generate(dates.length, (index) {
return SizedBox(
height: 48,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.isToday(dates[index])
? DUI.text.xs(context, todayString,
color: Theme.of(context)
.textTheme
.bodyMedium!
.color!
.withOpacity(0.7))
: Utils.isTomorrow(dates[index])
? DUI.text.xs(context, tomorrowString,
color: Theme.of(context)
.textTheme
.bodyMedium!
.color!
.withOpacity(0.7))
: SizedBox.shrink(),
DUI.text.title3(context, Utils.formatDate(dates[index]))
],
),
),
);
}),
)),
]));
}