
Simplifies address, city, and country entry in forms using Google Places API. Integrates with Compose Multiplatform, supporting autocomplete functionality for enhanced user experience.
A simple Compose Multiplatform library to fill addresses, cities and countries in a form, based on Google Places API by Google https://developers.google.com/maps/documentation/places/web-service/autocomplete. For Android and IOS
Please generate a valid Google Places API key and add it to your project. You can find the instructions to generate key on Google docs: https://developers.google.com/maps/documentation/places/web-service/get-api-key Use KMPPlaces.initialize(apiKey) to initialize the library.
android - KMPPlaces.initialize(apiKey) - normally in src/androidMain/MainActivity
ios - KMPPlaces.initialize(apiKey) - normally in src/iosMain/MainViewControllerThen add the dependency to your project:
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.ngallazzi:KMP-Places-Autocomplete:<LAST_VERSION>")
}Just put AddressAutocompleteForm or PlaceAutoCompleteTextField composable within your app theme. Handle state from related lambda
// If you need the complete form
@Composable
fun MyLayout(){
MaterialTheme {
AddressAutocompleteForm(
modifier = Modifier.fillMaxWidth().padding(24.dp),
onSubmit = { state ->
// Handle state changes here
})
}
}
// If you have your own layout and you only need the autocomplete field with its details
@Composable
fun MyLayout(){
MaterialTheme {
Column {
PlaceAutoCompleteTextField(
label = "Please search a place",
modifier = Modifier.fillMaxWidth().padding(24.dp),
onSuggestionSelected = { placeDetails ->
placeDetailsState = placeDetails
})
}
}
}
Please feel free to open an issue if you have any feedback or suggestions. PRs are welcome too!
KMP Places Autocomplete is brought to you by these contributors.
This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE.md file for details
A simple Compose Multiplatform library to fill addresses, cities and countries in a form, based on Google Places API by Google https://developers.google.com/maps/documentation/places/web-service/autocomplete. For Android and IOS
Please generate a valid Google Places API key and add it to your project. You can find the instructions to generate key on Google docs: https://developers.google.com/maps/documentation/places/web-service/get-api-key Use KMPPlaces.initialize(apiKey) to initialize the library.
android - KMPPlaces.initialize(apiKey) - normally in src/androidMain/MainActivity
ios - KMPPlaces.initialize(apiKey) - normally in src/iosMain/MainViewControllerThen add the dependency to your project:
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.ngallazzi:KMP-Places-Autocomplete:<LAST_VERSION>")
}Just put AddressAutocompleteForm or PlaceAutoCompleteTextField composable within your app theme. Handle state from related lambda
// If you need the complete form
@Composable
fun MyLayout(){
MaterialTheme {
AddressAutocompleteForm(
modifier = Modifier.fillMaxWidth().padding(24.dp),
onSubmit = { state ->
// Handle state changes here
})
}
}
// If you have your own layout and you only need the autocomplete field with its details
@Composable
fun MyLayout(){
MaterialTheme {
Column {
PlaceAutoCompleteTextField(
label = "Please search a place",
modifier = Modifier.fillMaxWidth().padding(24.dp),
onSuggestionSelected = { placeDetails ->
placeDetailsState = placeDetails
})
}
}
}
Please feel free to open an issue if you have any feedback or suggestions. PRs are welcome too!
KMP Places Autocomplete is brought to you by these contributors.
This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE.md file for details