Skip to content
Snippets Groups Projects
Commit 94b78117 authored by alper-savas's avatar alper-savas
Browse files

Add config, delete unnecessary code

parent 1cc8488c
No related branches found
No related tags found
1 merge request!6final project merge into main
class Config {
final String GOOGLE_API = '';
final String WEATHER_API = '';
final String OSM_API = '';
final String GOOGLE_API = 'AIzaSyAzedQacDEZmyxAOUEEeocvehT8MEdMWys';
final String WEATHER_API = '07cd339d66d846c7b33192823232003';
final String OSM_API =
'5b3ce3597851110001cf6248c6ba0beaf1a7480ba9f460646ae0c47b';
}
This diff is collapsed.
// // ignore_for_file: import_of_legacy_library_into_null_safe
// import 'package:flutter_polyline_points/flutter_polyline_points.dart';
// import 'package:google_maps_flutter/google_maps_flutter.dart';
// class Directions {
// final LatLngBounds bounds;
// final List<PointLatLng> polylinePoints;
// final String totalDistance;
// final String totalDuration;
// const Directions({
// required this.bounds,
// required this.polylinePoints,
// required this.totalDistance,
// required this.totalDuration,
// });
// factory Directions.fromMap(Map<String, dynamic> map) {
// // Get route information
// final data = Map<String, dynamic>.from(map['routes'][0]);
// // Bounds
// final northeast = data['bounds']['northeast'];
// final southwest = data['bounds']['southwest'];
// final bounds = LatLngBounds(
// northeast: LatLng(northeast['lat'], northeast['lng']),
// southwest: LatLng(southwest['lat'], southwest['lng']),
// );
// // Distance and Duration
// String distance = '';
// String duration = '';
// if ((data['legs'] as List).isNotEmpty) {
// final leg = data['legs'][0];
// distance = leg['distance']['text'];
// duration = leg['duration']['text'];
// }
// return Directions(
// bounds: bounds,
// polylinePoints:
// PolylinePoints().decodePolyline(data['overview_polyline']['points']),
// totalDistance: distance,
// totalDuration: duration,
// );
// }
// }
// ignore_for_file: file_names
// // import 'package:google_maps_flutter/google_maps_flutter.dart';
// import '../config/config.dart';
// import 'package:latlong/latlong.dart' as latlng;
// import 'package:http/http.dart' as http;
// class DirectionsRepo {
// Config config = Config();
// latlng.LatLng origin;
// latlng.LatLng destination;
// DirectionsRepo(this.origin, this.destination);
// Future<http.Response> getDirections() async {
// var originlat = origin.latitude;
// var originlon = origin.longitude;
// var destlat = destination.latitude;
// var destlon = destination.longitude;
// final response = await http.get(
// Uri.parse(
// 'https://api.openrouteservice.org/v2/directions/driving-car?api_key=${config.OSM_API}&start=$originlon,$originlat&end=$destlon,$destlat',
// ),
// );
// // Check if response is successful
// return response;
// }
// }
......@@ -28,7 +28,7 @@ class _GetStreetNumberState extends State<GetStreetNumber> {
);
var jsonData = jsonDecode(response.body);
suggestions = [];
for (int i = 0; i < jsonData['predictions'][i].length; i++) {
for (int i = 0; i < jsonData['predictions'].length; i++) {
suggestions.add(jsonData['predictions'][i]['description'].toString());
}
return suggestions;
......
......@@ -27,7 +27,7 @@ class _ReturnDestinationState extends State<ReturnDestination> {
);
var jsonData = jsonDecode(response.body);
suggestions = [];
for (int i = 0; i < jsonData['predictions'][i].length; i++) {
for (int i = 0; i < jsonData['predictions'].length; i++) {
suggestions.add(jsonData['predictions'][i]['description'].toString());
}
return suggestions;
......
......@@ -27,7 +27,7 @@ class _ReturnOriginState extends State<ReturnOrigin> {
);
var jsonData = jsonDecode(response.body);
suggestions = [];
for (int i = 0; i < jsonData['predictions'][i].length; i++) {
for (int i = 0; i < jsonData['predictions'].length; i++) {
suggestions.add(jsonData['predictions'][i]['description'].toString());
}
return suggestions;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment