Skip to content

Commit

Permalink
Semantics clear for radio
Browse files Browse the repository at this point in the history
  • Loading branch information
alorma committed Jan 28, 2025
1 parent ebfe566 commit ef465f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ private fun SettingsCheckboxSampleSection(showIcon: Boolean) {
icon = iconSampleOrNull(showIcon),
onCheckedChange = { state.value = it },
)
SettingsCheckbox(
state = state.value,
title = { Text(text = "Checkbox 2") },
subtitle = { Text(text = "Checkbox subtitle 2") },
icon = iconSampleOrNull(showIcon),
onCheckedChange = { state.value = it },
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import androidx.compose.material3.RadioButtonDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.SemanticsPropertyReceiver
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.Dp
import com.alorma.compose.settings.ui.base.internal.LocalSettingsGroupEnabled
import com.alorma.compose.settings.ui.base.internal.SettingsTileColors
Expand All @@ -29,16 +32,16 @@ fun SettingsRadioButton(
),
tonalElevation: Dp = SettingsTileDefaults.Elevation,
shadowElevation: Dp = SettingsTileDefaults.Elevation,
semanticProperties: (SemanticsPropertyReceiver.() -> Unit) = {},
onClick: () -> Unit,
) {
SettingsTileScaffold(
modifier =
Modifier.toggleable(
enabled = enabled,
value = state,
role = Role.RadioButton,
onValueChange = { onClick() },
).then(modifier),
modifier = Modifier.toggleable(

Check failure on line 39 in ui-tiles/src/commonMain/kotlin/com/alorma/compose/settings/ui/SettingsRadioButton.kt

View workflow job for this annotation

GitHub Actions / Ktlint - Main

standard:multiline-expression-wrapping

A multiline expression should start on a new line
enabled = enabled,
value = state,
role = Role.RadioButton,
onValueChange = { onClick() },
).semantics(properties = semanticProperties).then(modifier),
enabled = enabled,
title = title,
subtitle = subtitle,
Expand All @@ -48,6 +51,7 @@ fun SettingsRadioButton(
shadowElevation = shadowElevation,
) {
RadioButton(
modifier = Modifier.clearAndSetSemantics { },

Check failure on line 54 in ui-tiles/src/commonMain/kotlin/com/alorma/compose/settings/ui/SettingsRadioButton.kt

View workflow job for this annotation

GitHub Actions / Ktlint - Main

standard:no-multi-spaces

Unnecessary long whitespace
enabled = enabled,
selected = state,
onClick = onClick,
Expand Down

0 comments on commit ef465f7

Please sign in to comment.