Last active
November 27, 2020 23:15
-
-
Save JosLuna98/80250c589b136c3e497978cf43688969 to your computer and use it in GitHub Desktop.
custom implementation of address search field plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:address_search_field/address_search_field.dart'; | |
class Example extends StatelessWidget { | |
final _geoMethods = GeoMethods( | |
googleApiKey: 'GOOGLE_API_KEY', | |
language: 'es-419', | |
countryCode: 'ec', | |
country: 'Ecuador', | |
city: 'Esmeraldas', | |
); | |
final _controller = TextEditingController(); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
child: Center( | |
child: TextField( | |
controller: _controller, | |
onTap: () => showDialog( | |
context: context, | |
builder: (_) => AddressSearchBuilder( | |
geoMethods: _geoMethods, | |
controller: _controller, | |
builder: (context, snapshot, {controller, getGeometry, searchAddress}) => | |
CustomSearchDialog( | |
snapshot: snapshot, | |
controller: controller, | |
searchAddress: searchAddress, | |
getGeometry: getGeometry, | |
onDone: (address) { | |
print(address); | |
}, | |
), | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment