showDatePicker function

Future<DateTime?> showDatePicker(
  1. BuildContext context, {
  2. DateTime? initialDate,
  3. DateTime? firstDate,
  4. DateTime? lastDate,
  5. String title = 'Select Date',
  6. String? locale,
})

Shows a rich, modern modal bottom sheet date picker styled with Nash UI tokens.

final date = await showDatePicker(context);

Implementation

Future<DateTime?> showDatePicker(
  BuildContext context, {
  DateTime? initialDate,
  DateTime? firstDate,
  DateTime? lastDate,
  String title = 'Select Date',
  String? locale,
}) =>
    showModalBottomSheet<DateTime>(
      context: context,
      isScrollControlled: true,
      backgroundColor: Colors.transparent,
      builder: (ctx) => _DatePickerBottomSheet(
        initialDate: initialDate ?? DateTime.now(),
        firstDate: firstDate ?? DateTime(1900),
        lastDate: lastDate ?? DateTime(2100),
        title: title,
        locale: locale,
      ),
    );