google_atlas 0.3.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 90

google_atlas #

CircleCI codecov

Google Maps Atlas Provider that is built to work with atlas.

Quick Start #

Setup #

import 'package:flutter/material.dart';
import 'package:atlas/atlas.dart';
import 'package:google_atlas/google_atlas.dart';

void main() {
  AtlasProvider.instance = GoogleAtlas();
  runApp(MyApp());
}
Additional setup for Android: #
  • Specify your Google Maps API key in the application manifest android/app/src/main/AndroidManifest.xml:
<manifest ...
  <application ...
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="YOUR KEY HERE"/>
Additional setup for iOS: #
  • Specify your Google Maps API key in the application delegate ios/Runner/AppDelegate.swift:
import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
  	GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}
  • Enable io.flutter.embedded_views_preview in ios/Runner/Info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    ...
    <key>io.flutter.embedded_views_preview</key>
    <true/>
    ...
</dict>
</plist>

Usage #

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Atlas Sample Demo',
      home: AtlasSample(),
    );
  }
}

class AtlasSample extends StatelessWidget {
  final CameraPosition initialCameraPosition = CameraPosition(
    target: LatLng(
      latitude: 37.42796133580664,
      longitude: -122.085749655962,
    ),
    zoom: 12,
  );
  final Set<Marker> _markers = Set<Marker>.from([
    Marker(
      id: 'marker-1',
      position: LatLng(
        latitude: 37.42796133580664,
        longitude: -122.085749655962,
      ),
      onTap: () {
        print('tapped marker-1');
      },
    )
  ]);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Atlas(
        initialCameraPosition: initialCameraPosition,
        markers: _markers,
      ),
    );
  }
}

Maintainers #

Project Lead(s):

Main Maintainer(s):

License #

MIT License

Copyright (c) 2019 BMW Technology Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

google_atlas #

v0.3.0 (2019-10-17) #

  • Google Maps Provider supports onLongPress (atlas v0.2.0)

v0.2.1 (2019-9-19) #

  • Fix myLocationButton bug in iOS

v0.2.0 (2019-8-22) #

  • Update to use atlas v0.0.8

v0.1.2 (2019-8-20) #

  • Only update camera position on position changes

v0.1.1 (2019-8-16) #

  • Update default zoom level

v0.1.0 (2019-8-8) #

  • Optional Marker Icon

v0.0.9 (2019-8-5) #

  • Additional Map Bounding Improvements

v0.0.8 (2019-7-30) #

  • Remove CameraPosition
  • Map Bounding Improvements

v0.0.7 (2019-6-25) #

  • Set camera bounds based on markers

v0.0.6 (2019-6-25) #

  • Changed GoogleAtlas to StatefulWidget in order to track position and provide map position updates when camera position changes
  • FakeMapController added to assist with testing GoogleAtlas map more accurately
  • Transitioned GoogleAtlas unit tests to widget tests to better evaluate functionality

v0.0.5 (2019-6-19) #

  • showMyLocationButton added to GoogleAtlas
  • initialCameraPosition renamed to cameraPosition

v0.0.4 (2019-5-22) #

  • Google Maps Provider supports showMyLocation (atlas v0.0.4)

v0.0.3 (2019-5-20) #

  • Google Maps Provider supports onTap (atlas v0.0.3)

v0.0.2 (2019-5-20) #

  • Google Maps Provider supports Markers (atlas v0.0.2)

v0.0.1 (2019-5-16) #

  • Google Maps Provider which conforms to the initial Api Definition (atlas v0.0.1)

v0.0.0 (2019-5-16) #

  • Project was created

example/main.dart

import 'package:flutter/material.dart';
import 'package:atlas/atlas.dart';
import 'package:google_atlas/google_atlas.dart';

void main() {
  AtlasProvider.instance = GoogleAtlas();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Atlas Sample Demo',
      home: AtlasSample(),
    );
  }
}

class AtlasSample extends StatelessWidget {
  final CameraPosition initialCameraPosition = CameraPosition(
    target: LatLng(
      latitude: 37.42796133580664,
      longitude: -122.085749655962,
    ),
    zoom: 12,
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Atlas(
        initialCameraPosition: initialCameraPosition,
        markers: Set<Marker>.from(
          [
            Marker(
              id: 'marker-1',
              position: LatLng(
                latitude: 41.878113,
                longitude: -87.629799,
              ),
              onTap: () {
                print('tapped marker-1');
              },
            ),
            Marker(
              id: 'marker-3',
              position: LatLng(
                latitude: 40.878113,
                longitude: -100.629799,
              ),
              onTap: () {
                print('tapped marker-3');
              },
              icon: MarkerIcon(
                assetName: 'assets/mario.png',
              ),
            )
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  google_atlas: ^0.3.0

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:google_atlas/google_atlas.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
81
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
90
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
atlas ^0.2.0 0.2.0
flutter 0.0.0
google_maps_flutter ^0.5.21+3 0.5.21+8
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
mockito ^4.0.0