From f23d71daad17988f871ee9551778a925b7a14c56 Mon Sep 17 00:00:00 2001 From: Ayush Dubey Date: Wed, 21 Jul 2021 11:28:30 +0530 Subject: [PATCH] lib: fetch distance and duration properly *change direction API's Signed-off-by: Ayush Dubey --- android/app/src/main/AndroidManifest.xml | 33 +++++------------------- lib/.env.dart | 2 +- lib/direction_model.dart | 2 +- lib/main.dart | 2 +- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8d6c73b..63ad7e3 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,32 +1,17 @@ - - - + + + - + - + @@ -34,11 +19,7 @@ - - + + diff --git a/lib/.env.dart b/lib/.env.dart index 58c1bf4..58dded0 100644 --- a/lib/.env.dart +++ b/lib/.env.dart @@ -1 +1 @@ -const String googleAPIkey = 'AIzaSyBlefMmsxW3lz0_wlTrCKAFZLsHXtgFufI'; +const String googleAPIkey = 'AIzaSyBmPdAZ84TD-qNoGXyd9RnarWPR1i6QBi8'; diff --git a/lib/direction_model.dart b/lib/direction_model.dart index 8c63b59..b53fdbe 100644 --- a/lib/direction_model.dart +++ b/lib/direction_model.dart @@ -27,7 +27,7 @@ class Directions { String distance = ''; String duration = ''; - if (data['legs' as List].isEmpty) { + if ((data['legs'] as List).isNotEmpty) { final leg = data['legs'][0]; distance = leg['distance']['text']; duration = leg['duration']['text']; diff --git a/lib/main.dart b/lib/main.dart index 9c23809..9288759 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -173,7 +173,7 @@ class _MapScreenState extends State { } }); final directions = await DirectionsRepository() - .getDirections(origin: pos, destination: pos); + .getDirections(origin: _origin!.position, destination: pos); setState(() { _info = directions; });