We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to provide transit route (such as bus, subway route ) for user. but, The plugin is not supported select TravelMode for direction
AddDirection function will be can add with TravelMode like option. and provide route of this TravelMode
` @OverRide void addDirection(dynamic origin, dynamic destination, {String startLabel, String startIcon, String startInfo, String endLabel, String endIcon, String endInfo, TravelMode mode}) { assert(() { if (origin == null) { throw ArgumentError.notNull('origin'); }
if (destination == null) { throw ArgumentError.notNull('destination'); } return true; }()); if (mode == null) { mode = TravelMode.DRIVING; } _directions.putIfAbsent( '${origin}_$destination', () { DirectionsRenderer direction = DirectionsRenderer( DirectionsRendererOptions()..suppressMarkers = true); direction.map = _map; final transitMode = TransitOptions(); transitMode.modes = [ TransitMode.RAIL, TransitMode.SUBWAY, TransitMode.TRAIN ]; final request = DirectionsRequest() ..origin = origin is GeoCoord ? LatLng(origin.latitude, origin.longitude) : origin ..destination = destination is GeoCoord ? destination.toLatLng() : destination ..travelMode = mode; if (mode == TravelMode.TRANSIT) { request..transitOptions = transitMode; } directionsService.route( request, (response, status) { if (status == DirectionsStatus.OK) { direction.directions = response; final leg = response?.routes?.firstOrNull?.legs?.firstOrNull; final startLatLng = leg?.startLocation; if (startLatLng != null) { if (startIcon != null || startInfo != null || startLabel != null) { addMarkerRaw( startLatLng.toGeoCoord(), icon: startIcon, info: startInfo ?? leg.startAddress, label: startLabel, ); } else { addMarkerRaw( startLatLng.toGeoCoord(), icon: 'assets/images/marker_a.png', info: leg.startAddress, ); } } final endLatLng = leg?.endLocation; if (endLatLng != null) { if (endIcon != null || endInfo != null || endLabel != null) { addMarkerRaw( endLatLng.toGeoCoord(), icon: endIcon, info: endInfo ?? leg.endAddress, label: endLabel, ); } else { addMarkerRaw( endLatLng.toGeoCoord(), icon: 'assets/images/marker_b.png', info: leg.endAddress, ); } } } }, ); return direction; }, );`
The text was updated successfully, but these errors were encountered:
Hello any solutions to this problem
Sorry, something went wrong.
No branches or pull requests
Use case
I want to provide transit route (such as bus, subway route ) for user.
but, The plugin is not supported select TravelMode for direction
Proposal
AddDirection function will be can add with TravelMode like option.
and provide route of this TravelMode
`
@OverRide
void addDirection(dynamic origin, dynamic destination,
{String startLabel,
String startIcon,
String startInfo,
String endLabel,
String endIcon,
String endInfo,
TravelMode mode}) {
assert(() {
if (origin == null) {
throw ArgumentError.notNull('origin');
}
The text was updated successfully, but these errors were encountered: