google_map_location_picker 0.2.0 google_map_location_picker: ^0.2.0 copied to clipboard
🌍 Map location picker for flutter Based on google_maps_flutter
import 'package:flutter/material.dart';
import 'package:google_map_location_picker/google_map_location_picker.dart';
import 'package:google_map_location_picker/model/location_result.dart';
import 'package:google_map_location_picker_example/keys.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
LocationResult _pickedLocation;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('location picker'),
),
body: Builder(builder: (context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
onPressed: () async {
LocationResult result = await LocationPicker.pickLocation(
context,
apiKey,
);
print("result = ${result}");
setState(() {
_pickedLocation = result;
});
},
child: Text('Pick location'),
),
Text(_pickedLocation.toString()),
],
),
);
}),
),
);
}
}