Beginning to use different contexts
Some checks failed
Build and push docker image / Build (pull_request) Failing after 2m49s
Build and release APK / Build APK (pull_request) Successful in 5m48s
Build web / Build Web (pull_request) Successful in 1m32s

This commit is contained in:
2024-06-03 13:51:01 +02:00
parent ebaec40d6b
commit d5e0b7d51a
14 changed files with 271 additions and 42 deletions

View File

@@ -19,8 +19,8 @@ Widget Greeter (ThemeData theme, {bool full = false}) {
if (full) {
bottomGreeter = Text(
"Busy day ahead? Here is how to make the most of it!",
style: TextStyle(color: Colors.black, fontSize: 18.0),
maxLines: 1,
style: TextStyle(color: Colors.black, fontSize: 18),
textAlign: TextAlign.center,
);
}
Widget greeter = Center(

View File

@@ -40,7 +40,7 @@ class _loadLandmarksOverviewState extends State<loadLandmarksOverview> {
),
];
} else {
children = [LandmarkCard(Landmark(name: "loading", location: [0,0], type: LandmarkType(name: "loading")))];
children = [Center(child: CircularProgressIndicator())];
}
return Center(
child: Column(

View File

@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:fast_network_navigation/layout.dart';
import 'package:fast_network_navigation/structs/trip.dart';
import 'package:fast_network_navigation/utils/get_trips.dart';
class TripsOverview extends StatefulWidget {
const TripsOverview({super.key});
@override
State<TripsOverview> createState() => _TripsOverviewState();
}
class _TripsOverviewState extends State<TripsOverview> {
final Future<List<Trip>> _trips = loadTrips();
Widget listBuild (BuildContext context, AsyncSnapshot<List<Trip>> snapshot) {
List<Widget> children;
if (snapshot.hasData) {
children = List<Widget>.generate(snapshot.data!.length, (index) {
Trip trip = snapshot.data![index];
return ListTile(
title: Text("Trip to ${trip.cityName} (${trip.landmarks.length} stops)"),
leading: Icon(Icons.pin_drop),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => BasePage(mainScreen: "map") //, trip: trip)
)
);
},
);
});
} else if (snapshot.hasError) {
children = [
const Icon(
Icons.error_outline,
color: Colors.red,
size: 60,
),
Padding(
padding: const EdgeInsets.only(top: 16),
child: Text('Error: ${snapshot.error}'),
),
];
} else {
children = [Center(child: CircularProgressIndicator())];
}
return ListView(
children: children,
);
}
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: _trips,
builder: listBuild,
);
}
}