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

reflect click event of checkbox on search filter #859

Merged
merged 1 commit into from
Oct 6, 2022
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.IconButton
Expand All @@ -20,6 +21,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalViewConfiguration
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -85,7 +87,9 @@ fun FilterDaySheet(

Checkbox(
checked = selectedDays.contains(kaigiDay),
onCheckedChange = {},
onCheckedChange = null,
modifier = Modifier
.size(LocalViewConfiguration.current.minimumTouchTargetSize),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When onCheckedChange is null, Checkbox will not be padded. (ref: link)
So this will be displayed as following.
Screen Shot 2022-10-06 at 18 27 22

And Modifier.minimumTouchTargetSize() is a internal function of material3.
Because of this, I add Modifier and set size by using same size parameter (ref: link)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about LocalViewConfiguration! Thanks

colors = CheckboxDefaults.colors(
checkedColor = MaterialTheme.colorScheme.primary,
uncheckedColor = MaterialTheme.colorScheme.primary
Expand Down Expand Up @@ -139,7 +143,9 @@ fun FilterCategoriesSheet(
) {
Checkbox(
checked = selectedCategories.contains(category),
onCheckedChange = {},
onCheckedChange = null,
modifier = Modifier
.size(LocalViewConfiguration.current.minimumTouchTargetSize),
colors = CheckboxDefaults.colors(
checkedColor = MaterialTheme.colorScheme.primary,
uncheckedColor = MaterialTheme.colorScheme.primary
Expand Down