как изменить значок местоположения на картах Google (Флаттер)?

#flutter

#трепетать

Вопрос:

Я использую довольно близкое увеличение на своих картах Google. Так близко, что синий значок местоположения устройства и его «граница» отбрасывают синий оттенок на область. Есть ли способ настроить и удалить это? Спасибо!

Комментарии:

1. можете ли вы показать, что вы делали до сих пор?

2. @AlanBosco я только что назвал виджет карты, я искал, есть ли параметр, с помощью которого я могу удалить маркер местоположения своего устройства круговая «граница» на карте (по умолчанию синяя точка)

Ответ №1:

Пожалуйста, обратитесь к приведенному ниже коду

 class MapDemo extends StatelessWidget {  const MapDemo({Key key}) : super(key: key);   /*Controller*/  GoogleMapController mapController;   /*Variable declaration*/  bool customFlag = false;  BitmapDescriptor customIcon1;    /*Custom Marker for Maps*/  createMarker(context) {  if (customIcon1 == null) {  ImageConfiguration configuration = createLocalImageConfiguration(context);  BitmapDescriptor.fromAssetImage(configuration, ImagePaths.dcGlobe) /* ImagePaths.dcGlobe i san asset image */  .then((icon) {  customIcon1 = icon;  });  }  }      @override  Widget build(BuildContext context) {  createMarker(context);  return Scaffold(  body: Column(  children: [  LocationMaps(  mapController: mapController,  customFlag: customFlag,  customIcon1: customIcon1,  longitudeValues: 85,  latitudeValues: 12.0,  ),    ],  ),  );  } }  class LocationMaps extends StatelessWidget {  GoogleMapController mapController;  bool customFlag;  final BitmapDescriptor customIcon1;  final longitudeValues;  final latitudeValues;   LocationMaps({  Key key,  this.mapController,  this.customFlag,  this.customIcon1,  this.longitudeValues,  this.latitudeValues,  }) : super(key: key);   double locationLatitude = 0.0;  double locationLongitude = 0.0;   LatLng _center;  Listlt;Markergt; _markers = lt;Markergt;[];   void _onMapCreated(GoogleMapController controller) {  mapController = controller;  }   @override  Widget build(BuildContext context) {  locationLatitude = double.parse(latitudeValues);  locationLongitude = double.parse(longitudeValues);  _center = LatLng(locationLatitude, locationLongitude);  _markers.add(Marker(  icon: customFlag == true ? customIcon1 : null,  markerId: MarkerId(''),  position: LatLng(locationLatitude, locationLongitude),  infoWindow: InfoWindow(title: '')));  return ClipRRect(  borderRadius: BorderRadius.circular(8.0),  child: Container(  color: AppColors.creamColor,  width: ScreenUtil().screenWidth,  child: Column(  children: [  ClipRRect(  borderRadius: BorderRadius.circular(8.0),  child: Container(  width: ScreenUtil().screenWidth,  height: ScreenUtil().setHeight(120.0),  decoration: BoxDecoration(  borderRadius: BorderRadius.circular(8.0),  ),  child: GoogleMap(  myLocationButtonEnabled: (Platform.isAndroid) ? true : false,  onMapCreated: _onMapCreated,  initialCameraPosition: CameraPosition(  target: _center,  zoom: 13.0,  ),  mapType: MapType.normal,  markers: Setlt;Markergt;.of(_markers),  ),  ),  ),  ],  ),  ),  );  } }   

Комментарии:

1. Если я правильно понимаю, вы имеете в виду, что замена его пользовательским маркером удалит эту границу?

2. Вместо маркера местоположения вы можете добавлять свои собственные изображения