29 lines
744 B
Dart
29 lines
744 B
Dart
import 'package:calorimeter/perdate/perdate_widget.dart';
|
|
import 'package:calorimeter/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();
|
|
},
|
|
)
|
|
]);
|
|
}
|