selectDate method
Implementation
Future<DateTime?> selectDate({DateTime? initialDate, DateTime? startDate, DateTime? endDate,}) async {
return await showDatePicker(
context: Get.context!,
initialDate: initialDate,
firstDate: DateTime.now().add(const Duration(days: -(365 * 90))),
lastDate: startDate ?? DateTime.now().add(const Duration(days: -(365 * 8))),
initialEntryMode: DatePickerEntryMode.calendarOnly,
builder: (BuildContext context, Widget? child) {
return Theme(
data: Theme.of(context).copyWith(
colorScheme: ColorScheme.light(
primary: AppTheme.themeColors.primary, // Header background color
onPrimary: AppTheme.themeColors.themeBlue, // Header text color
onSurface: AppTheme.themeColors.themeBlue, // Body text color
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: AppTheme.themeColors.primary, // Button text color
),
), dialogTheme: const DialogThemeData(backgroundColor: Colors.grey),
),
child: child!,
);
},
);
}