first ui elements using the new structs
Some checks failed
Build and push docker image / Build (pull_request) Failing after 41s
Build and release APK / Build APK (pull_request) Successful in 5m25s
Build web / Build Web (pull_request) Successful in 1m17s

This commit is contained in:
2024-05-31 21:33:04 +02:00
parent 7e4538a1bf
commit 8bc7da0b3e
14 changed files with 336 additions and 226 deletions

View File

@@ -0,0 +1,25 @@
import "package:fast_network_navigation/structs/landmark.dart";
import 'package:http/http.dart' as http;
Future<List<Landmark>> fetchLandmarks() async {
// final response = await http
// .get(Uri.parse('https://nav.kluster.moll.re/v1/destination/1'));
// if (response.statusCode == 200) {
// If the server did return a 200 OK response,
// then parse the JSON.
List<Landmark> landmarks = [
Landmark(name: "Landmark 1", location: [0, 0], type: LandmarkType(name: "Type 1")),
Landmark(name: "Landmark 2", location: [0, 0], type: LandmarkType(name: "Type 2")),
Landmark(name: "Landmark 3", location: [0, 0], type: LandmarkType(name: "Type 3")),
Landmark(name: "Landmark 4", location: [0, 0], type: LandmarkType(name: "Type 4")),
Landmark(name: "Landmark 5", location: [0, 0], type: LandmarkType(name: "Type 5")),
];
return landmarks;
// } else {
// // If the server did not return a 200 OK response,
// // then throw an exception.
// throw Exception('Failed to load destination');
// }
}

View File

@@ -1,18 +0,0 @@
import "package:fast_network_navigation/structs/destination.dart";
import 'package:http/http.dart' as http;
import 'dart:convert';
Future<Destination> fetchDestination() async {
final response = await http
.get(Uri.parse('https://nav.kluster.moll.re/v1/destination/1'));
if (response.statusCode == 200) {
// If the server did return a 200 OK response,
// then parse the JSON.
return Destination.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
} else {
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed to load destination');
}
}