add draft changes
All checks were successful
Release / meta (push) Successful in 8s
Release / linux-build (push) Successful in 6m18s
Release / android-build (push) Successful in 16m30s
Release / release-master (push) Successful in 24s
Release / release-dev (push) Successful in 27s

This commit is contained in:
2025-12-14 23:30:45 +00:00
parent 0288f555f2
commit 603e117af8
5 changed files with 886 additions and 126 deletions

View File

@@ -11,6 +11,7 @@ import 'package:mileograph_flutter/components/pages/legs.dart';
import 'package:mileograph_flutter/services/apiService.dart';
import 'package:mileograph_flutter/services/authservice.dart';
import 'package:mileograph_flutter/services/dataService.dart';
import 'package:mileograph_flutter/services/navigation_guard.dart';
import 'components/login/login.dart';
import 'components/pages/dashboard.dart';
@@ -100,6 +101,14 @@ class MyApp extends StatelessWidget {
),
GoRoute(path: '/trips', builder: (_, __) => TripsPage()),
GoRoute(path: '/add', builder: (_, __) => NewEntryPage()),
GoRoute(
path: '/legs/edit/:id',
builder: (_, state) {
final idParam = state.pathParameters['id'];
final legId = idParam == null ? null : int.tryParse(idParam);
return NewEntryPage(editLegId: legId);
},
),
],
),
GoRoute(path: '/login', builder: (_, __) => const LoginScreen()),
@@ -180,12 +189,14 @@ class _MyHomePageState extends State<MyHomePage> {
return newIndex;
}
void _onItemTapped(int index, int currentIndex) {
Future<void> _onItemTapped(int index, int currentIndex) async {
if (index < 0 || index >= contentPages.length || index == currentIndex) {
return;
}
context.push(contentPages[index]);
_getIndexFromLocation(contentPages[index]);
await NavigationGuard.attemptNavigation(() async {
if (!mounted) return;
context.go(contentPages[index]);
});
}
bool loggedIn = false;