google_maps_place_search_advance 0.1.3 google_maps_place_search_advance: ^0.1.3 copied to clipboard
Google Maps Place Search Advance provides programmatic access to Google's database for the place autocomplete search and also their landmark images, as well as distance with respect to the device's cu [...]
import 'package:flutter/material.dart';
import 'package:google_maps_place_search_advance/google_maps_place_search_advance.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Example of Google Maps Place Search Advance Package',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
FocusNode? focusNode;
initState() {
super.initState();
focusNode = FocusNode();
}
dispose() {
focusNode!.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Container(
child: SingleChildScrollView(
child: GooglePlaceSearchAdvance(
googleMapsApiKey: "GOOGLE_MAPS_API_KEY",
lightTheme: false,
country: "fr",
iconImagePath: "assets/search.png",
mapimagePath: "assets/not_image_place.png",
onLocationSelected: (double lat, double lng, String address,
String mainText, String imageURL) {
print("Coordinates are $lat,$lng");
print("Address is : $address");
print("Image URL is: $imageURL");
print("Main Text is: $mainText");
},
focusNode: focusNode!,
),
),
),
),
);
}
}