Giter Club home page Giter Club logo

animated_location_indicator's Introduction

Animated Location Indicator

A simple yet customizable plugin for Flutter Map to display the current user location, accuracy and orientation along with automatically animating changes of these properties.

preview.mp4

Features

  • Location, accuracy and orientation indicator can be replaced by custom widgets
  • Customizable default indicators
  • Define custom animation curves and durations

Getting started

This plugin requires the location permission. Since the plugin uses geolocator you can find more information there.

Note: If the location permission isn't granted on widget build the location indicator will be hidden/disabled. Once the permission is granted you have to call animatedLocationController.activate() to activate it.

Android

In order to use this plugin on Android, you have to add the following permission in the AndroidManifest.xml file:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Make sure that the compileSdkVersion version in android/app/build.gradle is set to compileSdkVersion 31 or higher.

iOS

In order to use this plugin on iOS, you have to add the following permission in the Info.plist file:

<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location when open.</string>

Usage

Add animated_location_indicator to your pubspec:

dependencies:
  animated_location_indicator:
    git:
      url: https://github.com/OPENER-next/animated_location_indicator.git

Import the package.

import 'package:animated_location_indicator/animated_location_indicator.dart';

Sample code

Add the the AnimatedLocationLayerWidget to the children of the FlutterMap widget.

FlutterMap(
  children: [
    TileLayerWidget(
      options: TileLayerOptions(
        urlTemplate: 'https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png',
        tileProvider: NetworkTileProvider(),
      ),
    ),
    AnimatedLocationLayerWidget(
      options: AnimatedLocationOptions(
        // adjust appearance and behavior here
      ),
    )
  ],
)

Adjust the appearance of the default indicators.

AnimatedLocationLayerWidget(
  options: AnimatedLocationOptions(
    accuracyIndicator: const AccuracyIndicator(
      color: Colors.red,
      strokeColor: Colors.black,
      strokeWidth: 4,
    ),
    orientationIndicator: const OrientationIndicator(
      color: Colors.red,
      sectorSize: 2,
    ),
    locationIndicator: const LocationIndicator(
      color: Colors.red,
      strokeColor: Colors.black,
      strokeWidth: 4,
    )
  ),
)

Use custom indicator widgets.

AnimatedLocationLayerWidget(
  options: AnimatedLocationOptions(
    accuracyIndicator: MyCustomWidget(),
    orientationIndicator: MyCustomWidget(),
    locationIndicator: MyCustomWidget()
  ),
)

For a complete working example app visit the /example folder.

animated_location_indicator's People

Contributors

robbendebiene avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

animated_location_indicator's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.