在Flutter上添加圆形照片标记到Google Maps可以通过以下步骤实现:
import 'package:google_maps_flutter/google_maps_flutter.dart';
GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.0,
),
)
Marker(
markerId: MarkerId('marker_1'),
position: LatLng(37.42796133580664, -122.085749655962),
icon: BitmapDescriptor.defaultMarker,
)
BitmapDescriptor.fromAssetImage(
ImageConfiguration(size: Size(48, 48)),
'assets/circle_photo.png',
)
Set<Marker> _markers = {};
_markers.add(
Marker(
markerId: MarkerId('marker_1'),
position: LatLng(37.42796133580664, -122.085749655962),
icon: BitmapDescriptor.fromAssetImage(
ImageConfiguration(size: Size(48, 48)),
'assets/circle_photo.png',
),
),
);
GoogleMap(
initialCameraPosition: CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.0,
),
markers: _markers,
)
这样,你就成功地在Flutter上添加了一个圆形照片标记到Google Maps。请注意,你需要将圆形照片放置在Flutter项目的assets文件夹中,并在pubspec.yaml文件中进行配置。
推荐的腾讯云相关产品:腾讯位置服务(https://cloud.tencent.com/product/tianditu)
领取专属 10元无门槛券
手把手带您无忧上云