28 lines
824 B
Dart
28 lines
824 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
class CalendarFloatingButton extends StatelessWidget {
|
|
final DateTime date;
|
|
|
|
const CalendarFloatingButton({super.key, required this.date});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FloatingActionButton(
|
|
onPressed: () async {
|
|
var router = GoRouter.of(context);
|
|
var datePicked = await showDatePicker(
|
|
locale: const Locale('de'),
|
|
context: context,
|
|
initialDate: date,
|
|
currentDate: DateTime.now(),
|
|
firstDate: DateTime.now().subtract(const Duration(days: 365 * 10)),
|
|
lastDate: DateTime.now(),
|
|
);
|
|
|
|
router.goNamed('perDay', extra: datePicked);
|
|
},
|
|
child: const Icon(Icons.today));
|
|
}
|
|
}
|