ソースコード
birthday.dart
void showCupertinoDatePicker(BuildContext context) {
showCupertinoModalPopup(
context: context,
builder: (context) {
final now = DateTime.now();
return Container(
height: MediaQuery.of(context).size.height * 0.3,
child: CupertinoDatePicker(
backgroundColor: Theme.of(context).focusColor,
initialDateTime: DateTime(now.year - 18,12,31),
minimumDate: DateTime(1900,12,31),
maximumDate: DateTime(now.year - 6,12,31),
mode: CupertinoDatePickerMode.date,
onDateTimeChanged: (value){
birthDay = value;
}
),
);
}
);
}