working save and load functionality with custom datastructures
Some checks failed
Build and push docker image / Build (pull_request) Failing after 2m8s
Build and release APK / Build APK (pull_request) Successful in 5m15s
Build web / Build Web (pull_request) Successful in 1m13s

This commit is contained in:
2024-06-23 21:19:06 +02:00
parent db41528702
commit eede94add4
10 changed files with 279 additions and 108 deletions

View File

@@ -12,7 +12,7 @@ import 'package:fast_network_navigation/pages/profile.dart';
// A side drawer is used to switch between pages
class BasePage extends StatefulWidget {
final String mainScreen;
final Trip? trip;
final Future<Trip>? trip;
const BasePage({
super.key,
@@ -30,11 +30,10 @@ class _BasePageState extends State<BasePage> {
Widget build(BuildContext context) {
Widget currentView = const Text("loading...");
Future<List<Trip>> trips = loadTrips();
Future<Trip> firstTrip = getFirstTrip(trips);
// Future<Trip> trip = Future(trips[0]);
if (widget.mainScreen == "map") {
currentView = NavigationOverview(trip: firstTrip);
currentView = NavigationOverview(trip: widget.trip ?? getFirstTrip(trips));
} else if (widget.mainScreen == "tutorial") {
currentView = TutorialPage();
} else if (widget.mainScreen == "profile") {
@@ -88,12 +87,8 @@ class _BasePageState extends State<BasePage> {
child: TripsOverview(trips: trips),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const NewTripPage()
)
);
onPressed: () async {
removeAllTripsFromPrefs();
},
child: const Text('Clear trips'),
),