Skip to content

Commit

Permalink
ANDROAPP-5747-radio-buttons-and-text-are-not-vertically-aligned (#163)
Browse files Browse the repository at this point in the history
* Center vertical align radio button and text

* Apply text style to radio button text

* Fix input checkbox text alignment

Same issue as the radio button, so fixing it in the same PR
  • Loading branch information
msasikanth authored Dec 7, 2023
1 parent 87f7b79 commit dd4346e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CheckboxDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand Down Expand Up @@ -49,7 +50,7 @@ fun CheckBox(

Row(
horizontalArrangement = Arrangement.spacedBy(Spacing.Spacing0, Alignment.Start),
verticalAlignment = Alignment.Top,
verticalAlignment = Alignment.CenterVertically,
modifier = modifier
.clickable(
interactionSource = interactionSource,
Expand Down Expand Up @@ -91,6 +92,7 @@ fun CheckBox(
.hoverPointerIcon(checkBoxData.enabled),
text = it,
color = textColor,
style = MaterialTheme.typography.bodyLarge,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.RadioButton
import androidx.compose.material3.RadioButtonDefaults
import androidx.compose.material3.Text
Expand Down Expand Up @@ -42,7 +43,7 @@ fun RadioButton(
val interactionSource = if (radioButtonData.enabled) remember { MutableInteractionSource() } else MutableInteractionSource()
Row(
horizontalArrangement = Arrangement.spacedBy(Spacing.Spacing0, Alignment.Start),
verticalAlignment = Alignment.Top,
verticalAlignment = Alignment.CenterVertically,
modifier = modifier
.clickable(
interactionSource = interactionSource,
Expand Down Expand Up @@ -88,6 +89,7 @@ fun RadioButton(
} else {
TextColor.OnDisabledSurface
},
style = MaterialTheme.typography.bodyLarge,
)
}
}
Expand Down

0 comments on commit dd4346e

Please sign in to comment.