Loading...
Loading...
Use ShadDatePicker and ShadDatePicker.range for single or range date selection; presets, ShadDatePickerFormField, ShadDateRangePickerFormField. Use when adding date pickers or date range fields in a Flutter shadcn_ui app or ShadForm.
npx skill4agent add serverpod/skills-registry shadcn_ui-date-pickerShadDatePickerShadDatePicker.range()ShadDatePickerFormFieldShadDateRangePickerFormFieldidlabelvalidatorfromValueTransformertoValueTransformerConstrainedBox(
constraints: const BoxConstraints(maxWidth: 600),
child: const ShadDatePicker(),
)ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 600),
child: const ShadDatePicker.range(),
)headerShadSelectgroupIdselectedShadDatePicker(
groupId: groupId,
header: Padding(
padding: const EdgeInsets.only(bottom: 4),
child: ShadSelect<int>(
groupId: groupId,
minWidth: 276,
placeholder: const Text('Select'),
options: presets.entries
.map((e) => ShadOption(value: e.key, child: Text(e.value)))
.toList(),
selectedOptionBuilder: (context, value) => Text(presets[value]!),
onChanged: (value) {
if (value == null) return;
setState(() => selected = today.add(Duration(days: value)));
},
),
),
selected: selected,
calendarDecoration: theme.calendarTheme.decoration,
popoverPadding: const EdgeInsets.all(4),
)ShadDatePickerFormField(
label: const Text('Date of birth'),
onChanged: print,
description: const Text('Your date of birth is used to calculate your age.'),
validator: (v) {
if (v == null) return 'A date of birth is required.';
return null;
},
)
ShadDateRangePickerFormField(
label: const Text('Range of dates'),
onChanged: print,
description: const Text('Select the range of dates you want to search between.'),
validator: (v) {
if (v == null) return 'A range of dates is required.';
if (v.start == null) return 'The start date is required.';
if (v.end == null) return 'The end date is required.';
return null;
},
)'date': '2024-02-01'fromValueTransformertoValueTransformerShadDatePickerFormFieldDateTime