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
Minor Change.
  • Loading branch information
cp-luzi-p committed Apr 8, 2022
commit 5b19e87e1e4d4f9a65bf455ce0104392ca7bc3e7
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fun CountryPickerBottomSheet(

Column {
if (dialogSearch) {
searchValue = countrySearchView()
searchValue = countrySearchView(modalBottomSheetState)
}
LazyColumn(
contentPadding = PaddingValues(16.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun countrySearchView(): String {
fun countrySearchView(state: ModalBottomSheetState): String {

var searchValue: String by rememberSaveable { mutableStateOf("") }
var showClearIcon by rememberSaveable { mutableStateOf(false) }
Expand All @@ -27,6 +28,10 @@ fun countrySearchView(): String {
showClearIcon = true
}

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

Row {
Box(
modifier = Modifier
Expand Down Expand Up @@ -89,8 +94,9 @@ fun countrySearchView(): String {
}


@OptIn(ExperimentalMaterialApi::class)
@Preview(showBackground = true)
@Composable
fun PreviewSearchView() {
countrySearchView()
countrySearchView(rememberModalBottomSheetState(ModalBottomSheetValue.Hidden))
}