import 'dart:convert';
import 'package:http/http.dart' as http;
const GOOGLE_API_KEY = 'AIzaSyAF_OALgqN2fqN-yS-3HzruUfPPAODKQ1Q';
class LocationHelper {
static String generateLocationPreview({required double latitude, required double longitude}) {
return "https://maps.googleapis.com/maps/api/staticmap?center=$latitude,$longitude&zoom=19&size=600x300&maptype=roadmap&markers=color:red%7Clabel:%7C$latitude,$longitude&key=$GOOGLE_API_KEY";
}
static Future<String> getPlaceAddress({required double latitude, required double longitude}) async {
final url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=$latitude,$longitude&key=$GOOGLE_API_KEY';
final response = await http.get(Uri.parse(url));
return json.decode(response.body)['results'][0]['formatted_address'];
}
}