google_map_place_picker 0.0.4 copy "google_map_place_picker: ^0.0.4" to clipboard
google_map_place_picker: ^0.0.4 copied to clipboard

Flutter Package for Google Map Place Picker

example/main.dart

import 'package:flutter/material.dart';
import 'package:google_map_place_picker/google_map_place_picker.dart';

void main() {
  runApp(
    const MaterialApp(
      home: MyApp(),
      debugShowCheckedModeBanner: false,
    ),
  );
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final TextEditingController _controller = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Google Map Location Picker'),
      ),
      body: Center(
        child: ElevatedButton(
          child: const Text("Pick a location"),
          onPressed: () async {
            LocationResult? result = await Navigator.of(context).push(
                MaterialPageRoute(
                    builder: (context) => MapLocationPicker("ADD-API-KEY-HERE",
                        languageCode: "en_us",
                        autoCompleteRegion: "in",
                        autoCompleteComponents: "country:in",
                        autoTheme: true,
                        pinColor: Colors.amber[900])));

            // Handle the result in your way
            print(result?.formattedAddress);
          },
        ),
      ),
    );
  }
}