navigation_with_mapbox 0.0.1 copy "navigation_with_mapbox: ^0.0.1" to clipboard
navigation_with_mapbox: ^0.0.1 copied to clipboard

outdated

Add Turn By Turn Navigation to Your Flutter Application Using MapBox.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:navigation_with_mapbox/navigation_with_mapbox.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _navigationWithMapboxPlugin = NavigationWithMapbox();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () async {
                  await _navigationWithMapboxPlugin.startNavigation(
                      origin:
                          WayPoint(latitude: 4.809432, longitude: -75.700660),
                      destination:
                          WayPoint(latitude: 4.759335, longitude: -75.923914),
                      setDestinationWithLongTap: false,
                      simulateRoute: false,
                      msg: '¡Buen viaje, disfruta de tu recorrido!',
                      voiceUnits: 'imperial',
                      language: 'es',
                      alternativeRoute: true,
                      style: 'traffic_night');
                },
                child: const Text('Iniciar Navegacion'),
              ),
              ElevatedButton(
                onPressed: () async {
                  await _navigationWithMapboxPlugin.startNavigation(
                      origin:
                          WayPoint(latitude: 4.809432, longitude: -75.700660),
                      destination:
                          WayPoint(latitude: 4.750128, longitude: -75.912423),
                      setDestinationWithLongTap: true,
                      simulateRoute: false,
                      language: 'es',
                      msg: '¡Buen viaje, disfruta de tu recorrido!',
                      style: 'satellite_streets');
                },
                child: const Text('Iniciar Navegacion 2'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
16
likes
0
points
36
downloads

Publisher

unverified uploader

Weekly Downloads

Add Turn By Turn Navigation to Your Flutter Application Using MapBox.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on navigation_with_mapbox