import 'package:flutter/material.dart'; class CalendarFloatingButton extends StatelessWidget { final DateTime startFromDate; final Function(DateTime?) onDateSelected; const CalendarFloatingButton( {super.key, required this.startFromDate, required this.onDateSelected}); @override Widget build(BuildContext context) { return FloatingActionButton( onPressed: () async { var datePicked = await showDatePicker( locale: const Locale('de'), context: context, initialDate: startFromDate, currentDate: DateTime.now(), firstDate: DateTime.now().subtract(const Duration(days: 365 * 10)), lastDate: DateTime.now().add(const Duration(days: 365 * 10)), ); if (!context.mounted) return; onDateSelected(datePicked); }, heroTag: "calendarFAB", child: const Icon(Icons.today), ); } }