flutter_places 1.0.0+4 copy "flutter_places: ^1.0.0+4" to clipboard
flutter_places: ^1.0.0+4 copied to clipboard

discontinued

Flutter places fully customizable widget for autocomplete, compatible with Light and Dark mode, based on https://pub.dartlang.org/packages/google_maps_webservice

example/lib/main.dart

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

import 'environment.dart';

String apiKey;

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

  apiKey = await Environment.getKey();

  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  Place _selectedPlace;

  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(
          title: Text('Flutter places'),
        ),
        body: Align(
          alignment: Alignment.center,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text(
                _selectedPlace?.prediction?.description ?? 'Place name',
              ),
              const SizedBox(
                height: 50,
              ),
              RaisedButton(
                onPressed: () async {
                  final place = await FlutterPlaces.show(
                    context: context,
                    apiKey: apiKey,
                  );

                  setState(() {
                    _selectedPlace = place;
                  });
                },
                child: Text('Fullscreen'),
              ),
              const SizedBox(
                height: 20,
              ),
              RaisedButton(
                onPressed: () async {
                  final place = await FlutterPlaces.show(
                    context: context,
                    apiKey: apiKey,
                    modeType: ModeType.OVERLAY,
                  );

                  setState(() {
                    _selectedPlace = place;
                  });
                },
                child: Text('Overlay'),
              ),
              const SizedBox(
                height: 20,
              ),
              RaisedButton(
                onPressed: () async {
                  final place = await FlutterPlaces.show(
                    context: context,
                    apiKey: apiKey,
                    modeType: ModeType.BOTTOM_SHEET,
                  );

                  setState(() {
                    _selectedPlace = place;
                  });
                },
                child: Text('Bottomsheet'),
              ),
            ],
          ),
        ),
      );
}
9
likes
40
pub points
30%
popularity

Publisher

unverified uploader

Flutter places fully customizable widget for autocomplete, compatible with Light and Dark mode, based on https://pub.dartlang.org/packages/google_maps_webservice

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, google_maps_webservice, http

More

Packages that depend on flutter_places