Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search option #2

Merged
merged 6 commits into from
Apr 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MR Change
  • Loading branch information
cp-luzi-p committed Apr 9, 2022
commit 0c42395609a466a8020b74d62cc1d71ae8acd5c5
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ fun SampleCountryPicker() {
selectedCountry = it
expanded = false
focusManager.clearFocus()
},
dialogSearch = true
}
) {
CountryTextField(
label = "Select country",
cp-luzi-p marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ fun CountryPickerBottomSheet(
show: Boolean,
onItemSelected: (country: Country) -> Unit,
onDismissRequest: () -> Unit,
dialogSearch: Boolean = true,
content: @Composable () -> Unit
) {
val context = LocalContext.current
Expand Down Expand Up @@ -65,9 +64,8 @@ fun CountryPickerBottomSheet(
title()

Column {
if (dialogSearch) {
searchValue = countrySearchView(modalBottomSheetState)
}
searchValue = countrySearchView(modalBottomSheetState)

LazyColumn(
contentPadding = PaddingValues(16.dp)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ fun countrySearchView(state: ModalBottomSheetState): String {
var searchValue: String by rememberSaveable { mutableStateOf("") }
var showClearIcon by rememberSaveable { mutableStateOf(false) }

if (searchValue.isEmpty()) {
showClearIcon = false
} else if (searchValue.isNotEmpty()) {
showClearIcon = true
}
showClearIcon = searchValue.isNotEmpty()

if (!state.isVisible){
if (!state.isVisible) {
searchValue = ""
}

Expand Down