-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Labels
triage meI really want to be triaged.I really want to be triaged.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
Is there an existing issue for this?
- I have searched the existing issues
Use case
Marker( markerId: 'custom_marker', options: navigation.MarkerOptions( icon: customDescriptor, infoWindow: navigation.InfoWindow(title: "Custom Marker"), ), ); have this option but im unable to show on map please helppp
Proposal
Future _startCurrentNavigation(context) async {
if (currentWaypointIndex >= waypointsQueue.length) {
log("All waypoints navigated.");
return;
}
var provider = Provider.of(context, listen: false);
if (provider.rideRequest?.rideStatus == "started") {
monitorCurrentWaypointDistance(context, provider.rideRequest!);
}
log("finally starting navigation");
final waypoint = waypointsQueue[currentWaypointIndex];
final destinations = navigation.Destinations(
waypoints: [waypoint],
displayOptions: navigation.NavigationDisplayOptions(
showDestinationMarkers: true,
showStopSigns: true,
showTrafficLights: true,
),
routingOptions: navigation.RoutingOptions(
travelMode: navigation.NavigationTravelMode.driving,
alternateRoutesStrategy:
navigation.NavigationAlternateRoutesStrategy.all,
routingStrategy: navigation.NavigationRoutingStrategy.defaultBest,
),
);
// 👉 Create + set marker before setting destinations
final customDescriptor = await createCustomMarkerDescriptor();
final customMarker = navigation.Marker(
markerId: 'custom_marker',
options: navigation.MarkerOptions(
icon: customDescriptor,
infoWindow: navigation.InfoWindow(title: "Custom Marker"),
),
);
final status = await navigation.GoogleMapsNavigator.setDestinations(
destinations,
);
if (status == navigation.NavigationRouteStatus.statusOk) {
navController?.followMyLocation(navigation.CameraPerspective.tilted);
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Failed to start navigation: $status ${status.name}, '),
),
);
}
}
Future<navigation.ImageDescriptor> createCustomMarkerDescriptor() async {
final ByteData byteData = await loadMarkerImage(
'assets/markers/carIcon.png',
);
final descriptor = await navigation.registerBitmapImage(
bitmap: byteData,
imagePixelRatio: 2.0, // adjust if needed
width: 40, // logical pixels
height: 40,
);
return descriptor;
}
// This will load your PNG from assets
Future loadMarkerImage(String assetPath) async {
return await rootBundle.load(assetPath);
}
Metadata
Metadata
Assignees
Labels
triage meI really want to be triaged.I really want to be triaged.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.