Package-level declarations
Types
Link copied to clipboard
object Countries
The Countries
object is a singleton that contains a collection of predefined Country
objects. Each Country
object contains information about a specific country, including its name, ISO country code, dialing code, and the associated flag drawable resource.
Functions
Link copied to clipboard
fun CountrySelector(country: Country, onSelection: (Country) -> Unit, pickerRowContent: @Composable (Country) -> Unit = { defaultCountry ->
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Image(
painter = painterResource(resource = defaultCountry.flagImageResource),
contentDescription = defaultCountry.countryName,
modifier = Modifier
.size(24.dp)
.clip(CircleShape)
)
Text(defaultCountry.internationalDialCode)
}
}, searchBarContent: @Composable (searchQuery: String, onQueryChange: (String) -> Unit, hasError: Boolean) -> Unit = { searchQuery, onQueryChange, hasError ->
TextField(
value = searchQuery,
onValueChange = onQueryChange,
modifier = Modifier.fillMaxWidth(),
label = { Text("Search") },
leadingIcon = {
Icon(
imageVector = Icons.Default.Search,
contentDescription = "Search countries"
)
},
isError = hasError,
placeholder = { Text("Enter country name or code") }
)
})
Composable function that displays a country picker button with customizable content.