cedarmaps 0.9.0 copy "cedarmaps: ^0.9.0" to clipboard
cedarmaps: ^0.9.0 copied to clipboard

A Flutter plugin for integrating Cedarmaps inside a Flutter application on Android, iOS and web platfroms.

example/lib/main.dart

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:location/location.dart';
import 'package:mapbox_gl_example/full_map.dart';

import 'animate_camera.dart';
import 'full_map.dart';
import 'line.dart';
import 'map_ui.dart';
import 'move_camera.dart';
import 'page.dart';
import 'place_circle.dart';
import 'place_source.dart';
import 'place_symbol.dart';
import 'place_fill.dart';
import 'scrolling_map.dart';

final List<ExamplePage> _allPages = <ExamplePage>[
  MapUiPage(),
  FullMapPage(),
  AnimateCameraPage(),
  MoveCameraPage(),
  PlaceSymbolPage(),
  PlaceSourcePage(),
  LinePage(),
  PlaceCirclePage(),
  PlaceFillPage(),
  ScrollingMapPage(),
];

class MapsDemo extends StatelessWidget {
  //FIXME: Add your Cedarmaps credentials here
  static const String CLIENT_ID = "CLIENT_ID";
  static const String CLIENT_SECRET = "CLIENT_SECRET";

  void _pushPage(BuildContext context, ExamplePage page) async {
    if (!kIsWeb) {
      final location = Location();
      final hasPermissions = await location.hasPermission();
      if (hasPermissions != PermissionStatus.GRANTED) {
        await location.requestPermission();
      }
    }
    Navigator.of(context).push(MaterialPageRoute<void>(
        builder: (_) => Scaffold(
              appBar: AppBar(title: Text(page.title)),
              body: page,
            )));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Cedarmaps examples')),
      body: ListView.builder(
        itemCount: _allPages.length,
        itemBuilder: (_, int index) => ListTile(
          leading: _allPages[index].leading,
          title: Text(_allPages[index].title),
          onTap: () => _pushPage(context, _allPages[index]),
        ),
      ),
    );
  }
}

void main() {
  runApp(MaterialApp(home: MapsDemo()));
}
3
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A Flutter plugin for integrating Cedarmaps inside a Flutter application on Android, iOS and web platfroms.

Repository (GitHub)
View/report issues
Contributing

License

BSD-2-Clause (LICENSE)

Dependencies

flutter, http, mapbox_gl_platform_interface, mapbox_gl_web

More

Packages that depend on cedarmaps