@@ -2,7 +2,9 @@ package io.github.sds100.keymapper.base.utils.ui.compose
22
33import androidx.compose.foundation.clickable
44import androidx.compose.foundation.layout.Row
5+ import androidx.compose.foundation.layout.Spacer
56import androidx.compose.foundation.layout.padding
7+ import androidx.compose.foundation.layout.width
68import androidx.compose.material3.MaterialTheme
79import androidx.compose.material3.Surface
810import androidx.compose.material3.Switch
@@ -25,24 +27,16 @@ fun SwitchText(
2527 Surface (
2628 modifier = modifier,
2729 shape = MaterialTheme .shapes.medium,
28- color = Color .Companion . Transparent ,
30+ color = Color .Transparent ,
2931 ) {
3032 Row (
31- modifier = Modifier . Companion
33+ modifier = Modifier
3234 .clickable(enabled = isEnabled) { onCheckedChange(! isChecked) }
3335 .padding(8 .dp),
34- verticalAlignment = Alignment .Companion . CenterVertically ,
36+ verticalAlignment = Alignment .CenterVertically ,
3537 ) {
36- Switch (
37- enabled = isEnabled,
38- checked = isChecked,
39- // This is null so tapping on the checkbox highlights the whole row.
40- onCheckedChange = null ,
41- )
42-
4338 Text (
44- modifier = Modifier .Companion .padding(horizontal = 12 .dp),
45-
39+ modifier = Modifier .weight(1f ),
4640 text = text,
4741 style = if (isEnabled) {
4842 MaterialTheme .typography.bodyLarge
@@ -54,7 +48,16 @@ fun SwitchText(
5448 )
5549 },
5650 maxLines = 2 ,
57- overflow = TextOverflow .Companion .Ellipsis ,
51+ overflow = TextOverflow .Ellipsis ,
52+ )
53+
54+ Spacer (Modifier .width(16 .dp))
55+
56+ Switch (
57+ enabled = isEnabled,
58+ checked = isChecked,
59+ // This is null so tapping on the checkbox highlights the whole row.
60+ onCheckedChange = null ,
5861 )
5962 }
6063 }
0 commit comments