diff --git a/app/lib/ui/flow/geofence/add/addnew/add_new_place_view.dart b/app/lib/ui/flow/geofence/add/addnew/add_new_place_view.dart index 2f6fa5de..d4036af5 100644 --- a/app/lib/ui/flow/geofence/add/addnew/add_new_place_view.dart +++ b/app/lib/ui/flow/geofence/add/addnew/add_new_place_view.dart @@ -146,39 +146,44 @@ class _AddNewPlaceViewState extends ConsumerState { Widget _placesItemView(ApiNearbyPlace place, bool isLast) { return Column( children: [ - Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.only(top: 2), - child: Icon( - Icons.location_on_outlined, - size: 24, - color: context.colorScheme.textPrimary, - ), - ), - const SizedBox(width: 8), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - place.name, - maxLines: 1, - style: AppTextStyle.subtitle2.copyWith( - color: context.colorScheme.textPrimary, - ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 4), + child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: const EdgeInsets.only(top: 2), + child: SvgPicture.asset( + Assets.images.icLocation, + colorFilter: ColorFilter.mode( + context.colorScheme.textPrimary, + BlendMode.srcATop, ), - const SizedBox(height: 4), - Text( - place.formatted_address, - style: AppTextStyle.caption - .copyWith(color: context.colorScheme.textSecondary), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ) - ], + ), ), - ) - ]), + const SizedBox(width: 8), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + place.name, + maxLines: 1, + style: AppTextStyle.subtitle2.copyWith( + color: context.colorScheme.textPrimary, + ), + ), + const SizedBox(height: 4), + Text( + place.formatted_address, + style: AppTextStyle.caption + .copyWith(color: context.colorScheme.textSecondary), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ) + ], + ), + ) + ]), + ), Visibility( visible: !isLast, child: Padding( diff --git a/app/lib/ui/flow/geofence/add/addnew/add_new_place_view_model.dart b/app/lib/ui/flow/geofence/add/addnew/add_new_place_view_model.dart index 10f47b5b..3521ba33 100644 --- a/app/lib/ui/flow/geofence/add/addnew/add_new_place_view_model.dart +++ b/app/lib/ui/flow/geofence/add/addnew/add_new_place_view_model.dart @@ -35,7 +35,6 @@ class AddNewPlaceViewNotifier extends StateNotifier { value, '', // put user latitude coordinates here. '', // put user longitude coordinates here. - 'AIzaSyDbaJSVGU4Jkhd_V_e9esorzh_8yykh160', ); state = state.copyWith(places: places, loading: false); diff --git a/data/.gitignore b/data/.gitignore index ac5aa989..49b80dca 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -22,6 +22,8 @@ migrate_working_dir/ #.vscode/ # Flutter/Dart/Pub related +**/config.dart + # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. /pubspec.lock **/doc/api/ diff --git a/data/lib/config.dart b/data/lib/config.dart new file mode 100644 index 00000000..ad0e1076 --- /dev/null +++ b/data/lib/config.dart @@ -0,0 +1,4 @@ +class AppConfig { + static const String placeBaseUrl = 'https://maps.googleapis.com/maps/api/place/textsearch/json'; + static const String mapApiKey = 'AIzaSyDbaJSVGU4Jkhd_V_e9esorzh_8yykh160'; +} diff --git a/data/lib/service/place_service.dart b/data/lib/service/place_service.dart index 9d7c63c2..6ea52ab4 100644 --- a/data/lib/service/place_service.dart +++ b/data/lib/service/place_service.dart @@ -6,8 +6,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:http/http.dart' as http; import '../api/network/client.dart'; +import '../config.dart'; -const baseUrl = 'https://maps.googleapis.com/maps/api/place/textsearch/json'; const defaultRadius = 1500; final placeServiceProvider = Provider( @@ -86,11 +86,10 @@ class PlaceService { String query, String? lat, String? lng, - String apiKey, ) async { final placeRadius = (lat != null && lng != null) ? defaultRadius : ''; final String url = - '$baseUrl?query=$query&location=$lat,$lng&radius=$placeRadius&key=$apiKey'; + '${AppConfig.placeBaseUrl}?query=$query&location=$lat,$lng&radius=$placeRadius&key=${AppConfig.mapApiKey}'; final response = await http.get(Uri.parse(url));