pickDOB static method
Future<DateTime?>
pickDOB({
- required BuildContext context,
- PickerStyle style = PickerStyle.platform,
- String doneLabel = 'Done',
- String cancelLabel = 'Cancel',
- Locale? locale,
- Color? backgroundColor,
- Color? accentColor,
Date picker preset for Date of Birth (max = today, default 18 yrs ago).
Implementation
static Future<DateTime?> pickDOB({
required BuildContext context,
PickerStyle style = PickerStyle.platform,
String doneLabel = 'Done',
String cancelLabel = 'Cancel',
Locale? locale,
Color? backgroundColor,
Color? accentColor,
}) {
final DateTime now = DateTime.now();
return pickDate(
context: context,
initialDate: DateTime(now.year - 18, now.month, now.day),
firstDate: DateTime(now.year - 120),
lastDate: now,
style: style,
doneLabel: doneLabel,
cancelLabel: cancelLabel,
locale: locale,
backgroundColor: backgroundColor,
accentColor: accentColor,
);
}