search_map 0.0.5 copy "search_map: ^0.0.5" to clipboard
search_map: ^0.0.5 copied to clipboard

A Flutter package for integrating Google Maps Places API with autocomplete and place details retrieval.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:search_map/search_map.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await EasyLocalization.ensureInitialized();

  runApp(
    EasyLocalization(
      supportedLocales: [Locale('en'), Locale('es'), Locale('ar')],
      path: 'assets/langs',
      fallbackLocale: Locale('en'),
      child: MyApp(),
    ),
  );
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  FocusNode focusNode = FocusNode();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      localizationsDelegates: context.localizationDelegates,
      supportedLocales: context.supportedLocales,
      locale: context.locale,
      home: Scaffold(
        appBar: AppBar(title: const Text('Search Map Example')),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: SearchMap(
            apiKey: 'YOUR_API_KEY',
            focusNode: focusNode,
            decoration: const InputDecoration(
              hintText: 'Search for a location',
            ),
            onClickAddress: (placeDetails) {
              print('Selected Place: ${placeDetails.toJson()}');
              focusNode.unfocus();
            },
          ),
        ),
      ),
    );
  }
}
0
likes
140
points
49
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for integrating Google Maps Places API with autocomplete and place details retrieval.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dartz, easy_localization, flutter, font_awesome_flutter, http, uuid

More

Packages that depend on search_map