calorimeter/lib/utils/router.dart

29 lines
744 B
Dart
Raw Normal View History

2024-09-06 17:00:25 +00:00
import 'package:calorimeter/perdate/perdate_widget.dart';
import 'package:calorimeter/utils/settings.dart';
2024-09-06 11:48:56 +00:00
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();
},
)
]);
}