29 lines
740 B
Dart
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();
|
|
},
|
|
)
|
|
]);
|
|
}
|