widget_marker_google_map
google map with widget markers.
set up
follow the steps on google_maps_flutter document.
usage
same as google_maps_flutter except for widgetmarkers
.
widgetmarkergooglemap(
initialcameraposition: shibuya,
maptype: maptype.normal,
widgetmarkers: [
widgetmarker(
position: cafeposition,
markerid: 'cafe',
widget: container(
color: colors.brown,
padding: const edgeinsets.all(2),
child: const icon(
icons.coffee,
color: colors.white,
size: 64,
),
),
),
widgetmarker(
position: clothesshopposition,
markerid: 'clothes',
widget: container(
color: colors.green,
padding: const edgeinsets.all(4),
child: const text(
'shop',
style: textstyle(
color: colors.white,
fontweight: fontweight.bold,
fontsize: 32,
),
),
),
),
widgetmarker(
position: hamburgershopposition,
markerid: 'hamburger',
widget: container(
color: colors.red,
padding: const edgeinsets.all(2),
child: const icon(
icons.fastfood,
color: colors.yellow,
size: 64,
),
),
),
],
),
widgetmarker
you need to insert the list of widgetmarker
to use widget markers.
make sure that you still need to use ontap
method when you use gestures.
class widgetmarker {
widgetmarker({
required this.position,
required this.markerid,
required this.widget,
this.ontap,
}) : assert(markerid.isnotempty);
final latlng position;
/// keep this unique, otherwise it will not appear.
final string markerid;
/// gestures of widget is disabled.
/// use this callback instead.
final voidcallback? ontap;
final widget widget;
}
if you have any requests or questions, feel free to ask on .
Comments are closed.