flutter_mapbox_navigation
flutter_mapbox_navigation copied to clipboard
Route is not being created but the users location is being
I am using android sdk version 33 and the mapbox navigation is creating the map but there is no route being created.
here is my code `import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_mapbox_navigation/flutter_mapbox_navigation.dart'; import 'package:mapbox_gl/mapbox_gl.dart';
class TurnByTurn extends StatefulWidget { const TurnByTurn({Key? key}) : super(key: key);
@override State<TurnByTurn> createState() => _TurnByTurnState(); }
class _TurnByTurnState extends State<TurnByTurn> { // Waypoints to mark trip start and end // final _origin = WayPoint( // name: "Way Point 1", // latitude: 27.747837, // longitude: 85.305898); // final _stop1 = WayPoint( // name: "Way Point 2", // latitude: 38.91113678979344, // longitude: -77.03847169876099); // final _stop2 = WayPoint( // name: "Way Point 3", // latitude: 38.91040213277608, // longitude: -77.03848242759705); // final _stop3 = WayPoint( // name: "Way Point 4", // latitude: 38.909650771013034, // longitude: -77.03850388526917); // final _destination = WayPoint( // name: "Way Point 5", // latitude: 38.90894949285854, // longitude: -77.03651905059814);
final _home = WayPoint(name: "Home", latitude: 27.6771826, longitude: 85.3177465);
final _store = WayPoint(name: "Store", latitude: 27.6767664, longitude: 85.3191614); late WayPoint sourceWaypoint, destinationWaypoint; var wayPoints = <WayPoint>[];
// Config variables for Mapbox Navigation late MapBoxNavigation directions; late MapBoxOptions _options; late double distanceRemaining, durationRemaining; late MapBoxNavigationViewController _controller; final bool isMultipleStop = false; String instruction = ""; bool arrived = false; bool routeBuilt = false; bool isNavigating = false;
@override void initState() { super.initState(); initialize(); }
Future
directions = MapBoxNavigation(onRouteEvent: _onRouteEvent);
_options = MapBoxOptions(
//initialLatitude: 36.1175275,
//initialLongitude: -115.1839524,
zoom: 15.0,
tilt: 0.0,
bearing: 0.0,
enableRefresh: false,
alternatives: true,
enableFreeDriveMode: false,
voiceInstructionsEnabled: true,
bannerInstructionsEnabled: true,
allowsUTurnAtWayPoints: true,
mode: MapBoxNavigationMode.drivingWithTraffic,
units: VoiceUnits.imperial,
simulateRoute: false,
animateBuildRoute: true,
longPressDestinationEnabled: true,
language: "en");
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
platformVersion = await directions.platformVersion;
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
setState(() {
platformVersion = platformVersion;
});
}
@override Widget build(BuildContext context) { return Scaffold( floatingActionButton: FloatingActionButton( onPressed: () async { var wayPoints = <WayPoint>[]; wayPoints.add(_home); wayPoints.add(_store); print(wayPoints);
await directions.startNavigation(
wayPoints: wayPoints, options: _options);
},
child: Text("Start")),
);
}
Future
I have the same issue
same here
Got the same issue, any update yet?
got the same issue waiting for update
Hi, Got the same issue, have anybody find a solution?
Any solution ?
Stale issue message