google_places_autocomplete_text_field 0.0.3
google_places_autocomplete_text_field: ^0.0.3 copied to clipboard
A fully customizable Google Places autocomplete text form field for Flutter iOS and Android.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:google_places_autocomplete_text_field/google_places_autocomplete_text_field.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Google Places Autocomplete Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Google Places Autocomplete Demo'),
);
}
}
class MyHomePage extends StatelessWidget {
MyHomePage({super.key, required this.title});
final String title;
final _yourGoogleAPIKey = 'foo-bar-baz';
final _textController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: Center(
child: GooglePlacesAutoCompleteTextFormField(
textEditingController: _textController,
googleAPIKey: _yourGoogleAPIKey,
maxLines: 1,
overlayContainer: (child) => Material(
elevation: 1.0,
color: Colors.green,
borderRadius: BorderRadius.circular(12),
child: child,
),
),
),
);
}
}