Skip to content

Instantly share code, notes, and snippets.

@moho12n
Last active June 14, 2020 20:23
Show Gist options
  • Save moho12n/b1b89a16bae09a6c4e02e7616854ae05 to your computer and use it in GitHub Desktop.
Save moho12n/b1b89a16bae09a6c4e02e7616854ae05 to your computer and use it in GitHub Desktop.
MediumArticle
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
//Global Variables
const LatLng _center = const LatLng(36.737232, 3.086472);
Set<Marker> markers = {};
class MainMapScreen extends StatefulWidget {
@override
_MainScreenState createState() => _MainScreenState();
}
class _MainScreenState extends State<MainMapScreen> {
//******** Map variables */
Completer<GoogleMapController> _controller = Completer();
GoogleMapController mapController;
//******** OnMapCreated */
void _onMapCreated(GoogleMapController controller) {
mapController = controller;
_controller.complete(controller);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Stack(
children: <Widget>[
Positioned.fill(
child: GoogleMap(
markers: markers,
myLocationEnabled: true,
myLocationButtonEnabled: false,
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
)
)
),
//PageView.Builder here
]
)
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment