mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.7 KiB
63 lines
1.7 KiB
2 years ago
|
/*
|
||
|
* Copyright 2019 Google LLC
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||
|
|
||
|
void main() => runApp(const MyApp());
|
||
|
|
||
|
class MyApp extends StatefulWidget {
|
||
|
const MyApp({super.key});
|
||
|
|
||
|
@override
|
||
|
State<MyApp> createState() => _MyAppState();
|
||
|
}
|
||
|
|
||
|
class _MyAppState extends State<MyApp> {
|
||
|
late GoogleMapController mapController;
|
||
|
|
||
|
final LatLng _center = const LatLng(-33.86, 151.20);
|
||
|
|
||
|
void _onMapCreated(GoogleMapController controller) {
|
||
|
mapController = controller;
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return MaterialApp(
|
||
|
home: Scaffold(
|
||
|
appBar: AppBar(
|
||
|
title: const Text('Sydney'),
|
||
|
backgroundColor: Colors.green[700],
|
||
|
),
|
||
|
body: GoogleMap(
|
||
|
onMapCreated: _onMapCreated,
|
||
|
initialCameraPosition: CameraPosition(
|
||
|
target: _center,
|
||
|
zoom: 11.0,
|
||
|
),
|
||
|
markers: {
|
||
|
// ignore: prefer_const_constructors
|
||
|
Marker(
|
||
|
markerId: const MarkerId('Sydney'),
|
||
|
position: const LatLng(-33.86, 151.20),
|
||
|
)
|
||
|
}),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|