calorimeter/lib/utils/router.dart
2024-09-06 13:48:56 +02:00

29 lines
740 B
Dart

import 'package:calodiary/perdate/perdate_widget.dart';
import 'package:calodiary/utils/settings.dart';
import 'package:go_router/go_router.dart';
GoRouter getRouterConfig() {
return GoRouter(initialLocation: '/day', routes: [
GoRoute(
path: '/day',
name: 'perDay',
builder: (context, state) {
DateTime date;
if (state.extra == null || state.extra is! DateTime) {
date = DateTime.now();
} else {
date = state.extra as DateTime;
}
return PerDateWidget(date: date);
}),
GoRoute(
path: '/settings',
name: 'settings',
builder: (context, state) {
return const SettingsWidget();
},
)
]);
}