Skip to content

Commit

Permalink
[example] add full page map example (flutter-mapbox-gl#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun authored and Anastasia Chechulina committed Feb 15, 2020
1 parent 1f743c6 commit 26cf2ad
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
40 changes: 40 additions & 0 deletions example/lib/full_map.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:mapbox_gl/mapbox_gl.dart';

import 'page.dart';

class FullMapPage extends Page {
FullMapPage()
: super(const Icon(Icons.map), 'Full screen map');

@override
Widget build(BuildContext context) {
return const FullMap();
}
}

class FullMap extends StatefulWidget {
const FullMap();

@override
State createState() => FullMapState();
}

class FullMapState extends State<FullMap> {
MapboxMapController mapController;

void _onMapCreated(MapboxMapController controller) {
mapController = controller;
}

@override
Widget build(BuildContext context) {
return new Scaffold(
body: MapboxMap(
onMapCreated: _onMapCreated,
initialCameraPosition:
const CameraPosition(target: LatLng(0.0, 0.0)),
)
);
}
}
3 changes: 3 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

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';
Expand All @@ -16,6 +18,7 @@ import 'scrolling_map.dart';

final List<Page> _allPages = <Page>[
MapUiPage(),
FullMapPage(),
AnimateCameraPage(),
MoveCameraPage(),
PlaceSymbolPage(),
Expand Down

0 comments on commit 26cf2ad

Please sign in to comment.