import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:google_maps_flutter/google_maps_flutter.dart'
;
class
HomePage extends StatefulWidget {
const
HomePage({Key? key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
class
_HomePageState extends State<HomePage> {
Completer<GoogleMapController> _controller = Completer();
static
final CameraPosition _kGoogle =
const
CameraPosition(
target: LatLng(37.42796133580664, -122.885749655962),
zoom: 14.4746,
);
List<Marker> _marker = [];
final List<Marker> _list =
const
[
Marker(
markerId: MarkerId(
'1'
),
position: LatLng(20.42796133580664, 80.885749655962),
infoWindow: InfoWindow(
title:
'My Position'
,
)
),
Marker(
markerId: MarkerId(
'2'
),
position: LatLng(25.42796133580664, 80.885749655962),
infoWindow: InfoWindow(
title:
'Location 1'
,
)
),
Marker(
markerId: MarkerId(
'3'
),
position: LatLng(20.42796133580664, 73.885749655962),
infoWindow: InfoWindow(
title:
'Location 2'
,
)
),
];
@override
void
initState() {
super.initState();
_marker.addAll(_list);
}
@override
Widget build(BuildContext context) {
return
Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFF0F9D58),
title: Text(
"GFG"
),
),
body: Container(
child: GoogleMap(
initialCameraPosition: _kGoogle,
mapType: MapType.normal,
myLocationEnabled:
true
,
compassEnabled:
true
,
onMapCreated: (GoogleMapController controller){
_controller.complete(controller);
},
),
)
);
}
}