v4_navigation_engine 0.1.37

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

v4_navigation_engine #

A new Flutter plugin.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

0.1.37 #

  • TODO: Describe initial release.

example/lib/main.dart

import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'package:v4_navigation_engine/v4_navigation_lib.dart';
import 'package:v4_navigation_engine_example/about.dart';
import 'package:v4_navigation_engine_example/navigation_download.dart';
import 'package:v4_navigation_engine_example/navigation_offline.dart';
import 'package:v4_navigation_engine_example/navigation_v4.dart';
import 'package:v4_navigation_engine_example/navigation_white_label.dart';

import 'modal.dart';

void main() {
  runApp(
      MaterialApp(
        initialRoute: MyApp.routeName,
        routes: {
          MyApp.routeName : (context) => MyApp(),
          About.routeName : (context) => About(),
        },
      )
  );
}

class MyApp extends StatefulWidget {
  static String routeName = "/";
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  //For iOS ONLY
  static const platform = const MethodChannel('com.mile.v4_navigation_engine_example/view_controller');

  OfflineDatas offlineDatas;

  @override
  void initState() {
    SharedPreferences.getInstance().then((prefs) {
      if(prefs.containsKey("ID_OF_ROUTE")) {
        setState(() {
          offlineDatas = OfflineDatas.fromDynamicData(json.decode(prefs.getString("ID_OF_ROUTE")));
        });
      }
    });
    super.initState();
  }

  runDownload() {
    Navigator.of(context).push(PageRouteBuilder(
        opaque: false,
        pageBuilder: (BuildContext context, _, __) {
          return NavigationDownload(mode: NavigationMode.NAVIGATE_IN_ROUTE, onDownloadFinished: onDownloadFinished,);
        }
    ));
  }

  void onDownloadFinished() {
    SharedPreferences.getInstance().then((prefs) {
      if(prefs.containsKey("ID_OF_ROUTE")) {
        setState(() {
          offlineDatas = OfflineDatas.fromDynamicData(json.decode(prefs.getString("ID_OF_ROUTE")));
        });
      }
    });
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(
        appBar: AppBar(
          title: const Text('Mile Navigation Plugin'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            InkWell(
                onTap: () {
                  Navigator.push(context,
                    MaterialPageRoute(
                      builder: (context) => NavigationV4(mode: NavigationMode.NAVIGATE_IN_ROUTE),
                    ),
                  );
                },
                child: Container(
                  height: 36,
                  width: 200,
                  color: Colors.blue,
                  child: Center(
                    child: Text(
                      "NAVIGATION V4",
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                )
            ),
            Container(height: 20,),
            InkWell(
                onTap: () {
                  Navigator.push(context,
                    MaterialPageRoute(
                      builder: (context) => NavigationWhiteLabel(mode: NavigationMode.NAVIGATE_IN_ROUTE),
                    ),
                  );
                },
                child: Container(
                  height: 36,
                  width: 200,
                  color: Colors.blue,
                  child: Center(
                    child: Text(
                      "NAVIGATOR WHITELABEL",
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                )
            ),

            Container(height: 40,),
            InkWell(
                onTap: () {
                  Modal.show(context, null, "Download the map", null, "to run the route while offline", "DOWNLOAD", runDownload, "NOT NOW", null);
                },
                child: Container(
                  height: 36,
                  width: 200,
                  color: Colors.blue,
                  child: Center(
                    child: Text(
                      "DOWNLOAD MAP",
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                )
            ),
            Container(height: 20,),
            InkWell(
                onTap: () {
                  if(offlineDatas != null) {
                    Navigator.push(context,
                      MaterialPageRoute(
                        builder: (context) => NavigationOffline(mode: NavigationMode.NAVIGATE_IN_ROUTE, offlineDatas: this.offlineDatas,),
                      ),
                    );
                  }
                },
                child: Container(
                  height: 36,
                  width: 200,
                  color: offlineDatas == null ? Colors.grey : Colors.blue,
                  child: Center(
                    child: Text(
                      "START OFFLINE NAVIGATION",
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                )
            ),
            Container(height: 5,),
            InkWell(
                onTap: () {
                  setState(() {
                    offlineDatas = null;
                    SharedPreferences.getInstance().then((prefs) {
                      prefs.remove("ID_OF_ROUTE");
                    });
                  });
                },
                child: Container(
                  height: 36,
                  width: 200,
                  color: offlineDatas == null ? Colors.grey : Colors.red,
                  child: Center(
                    child: Text(
                      "REMOVE ROUTE IN CACHE",
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                )
            ),
          ],
        ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  v4_navigation_engine: ^0.1.37

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:v4_navigation_engine/v4_navigation_engine.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:v4_navigation_engine/v4_navigation_engine.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:v4_navigation_engine/v4_navigation_engine.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:v4_navigation_engine/v4_navigation_engine.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:v4_navigation_engine/v4_navigation_engine.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • v4_navigation_engine that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.37 points)

91 out of 93 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/v4_navigation_controller.dart. (-2.48 points)

Analysis of lib/v4_navigation_controller.dart reported 5 hints:

line 3 col 35: Name non-constant identifiers using lowerCamelCase.

line 4 col 26: Name non-constant identifiers using lowerCamelCase.

line 9 col 29: Name non-constant identifiers using lowerCamelCase.

line 10 col 40: Name non-constant identifiers using lowerCamelCase.

line 27 col 13: The value of the field '_id' isn't used.

Fix lib/navigation_mode.dart. (-1.49 points)

Analysis of lib/navigation_mode.dart reported 3 hints:

line 4 col 23: Name non-constant identifiers using lowerCamelCase.

line 5 col 23: Name non-constant identifiers using lowerCamelCase.

line 6 col 23: Name non-constant identifiers using lowerCamelCase.

Fix lib/v4_navigation_engine.dart. (-0.50 points)

Analysis of lib/v4_navigation_engine.dart reported 1 hint:

line 197 col 10: This function has a return type of 'Widget', but doesn't end with a return statement.

Fix additional 5 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/ActivePOI.dart (Run flutter format to format lib/ActivePOI.dart.)
  • lib/OfflineDatas.dart (Run flutter format to format lib/OfflineDatas.dart.)
  • lib/RouteFinished.dart (Run flutter format to format lib/RouteFinished.dart.)
  • lib/WhiteLabel.dart (Run flutter format to format lib/WhiteLabel.dart.)
  • lib/v4_navigation_lib.dart (Run flutter format to format lib/v4_navigation_lib.dart.)

Maintenance issues and suggestions

Repository URL doesn't exist. (-10 points)

At the time of the analysis the repository field https://github.com/MapleNoise/v4_navigation_engine.git was unreachable.

The package description is too short. (-10 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test