CountryList

fun CountryList(sections: List<CountrySection>, selectedCountries: Set<Country>, onCountryClick: (Country) -> Unit, modifier: Modifier = Modifier, selectionMode: CountrySelectionMode = CountrySelectionMode.Single, disabledCountries: Set<String> = emptySet(), listState: LazyListState = rememberLazyListState(), contentPadding: PaddingValues = PaddingValues(bottom = LIST_BOTTOM_PADDING), leadingContent: LazyListScope.() -> Unit = {}, style: CountryPickerStyle = CountryPickerTheme.style, flagContent: @Composable (Country) -> Unit? = null, listItemContent: @Composable (CountryListItemScope) -> Unit? = null)(source)

The country list, laid out in the style's CountryListStyle.

Item structure

Each titled section contributes exactly one header item followed by one item per country, and nothing else — the A–Z rail (rememberCountryListIndex) maps letters to lazy-list indices by that rule. Content added through leadingContent comes before every section; a caller that adds some offsets the rail's indices by the number of items it added.

Motion

Rows fade in with a short stagger the first time the list appears, and slide rather than jump when a country moves between sections. Both are off when motion is.

Parameters

leadingContent

Items placed before the first section, such as a carousel or a banner.


fun CountryList(state: CountryPickerState, onCountryClick: (Country) -> Unit, modifier: Modifier = Modifier, listState: LazyListState = rememberLazyListState(), contentPadding: PaddingValues = PaddingValues(bottom = LIST_BOTTOM_PADDING), leadingContent: LazyListScope.() -> Unit = {}, style: CountryPickerStyle = CountryPickerTheme.style, flagContent: @Composable (Country) -> Unit? = null, listItemContent: @Composable (CountryListItemScope) -> Unit? = null)(source)

CountryList driven by a CountryPickerState: its sections, selection and disabled countries.