chiq
11/14/2022, 8:26 PMTextButton(onClick = { /*TODO*/ },
elevation = null,
modifier = Modifier.indication(
interactionSource = MutableInteractionSource(),
indication = null
),
) {
Text(text = "Default")
}
Casey Brooks
11/14/2022, 8:39 PMSurface
with styling around Text()
, so you might just want to set your text style/color and use Modifier.clickable
on a Text()
instead of TextButton()
.
You can see the source of Button and TextButton, which may help you in getting the right fonts/sizing to create your own custom text button with only the things you wantCasey Brooks
11/14/2022, 8:42 PMChris Fillmore
11/14/2022, 8:51 PMbuttonColors
?
Iâm not actually sure this solves the problem of background color in pressed state, but take a look.
https://developer.android.com/reference/kotlin/androidx/compose/material/ButtonColorschiq
11/14/2022, 8:57 PMChris Fillmore
11/14/2022, 8:58 PMChris Fillmore
11/14/2022, 8:59 PMchiq
11/14/2022, 8:59 PMChris Fillmore
11/14/2022, 9:00 PMChris Fillmore
11/14/2022, 9:00 PMChris Fillmore
11/14/2022, 9:00 PMpressed state not have backgroundMaybe I misunderstood
Chris Fillmore
11/14/2022, 9:01 PMColor.Transparent
. And I think you can do this via a local themechiq
11/14/2022, 9:03 PMTextButton
and make a custom one đ But thanks y'allChris Fillmore
11/14/2022, 9:05 PMChris Fillmore
11/14/2022, 9:05 PMChris Fillmore
11/14/2022, 9:07 PM@Composable
fun ProvideSecondaryRippleTheme(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalRippleTheme provides SecondaryRippleTheme,
content = content,
)
}
@Immutable
private object SecondaryRippleTheme : RippleTheme {
@Composable
override fun defaultColor(): Color {
return RippleTheme.defaultRippleColor(
// Use whatever colors you want here
contentColor = MaterialTheme.colors.onSurface,
lightTheme = MaterialTheme.colors.isLight,
)
}
@Composable
override fun rippleAlpha(): RippleAlpha {
return RippleTheme.defaultRippleAlpha(
// Use whatever colors you want here
contentColor = MaterialTheme.colors.onSurface,
lightTheme = MaterialTheme.colors.isLight,
)
}
}
And use it like this:
@Composable
fun SecondaryTextButton(
onClick: () -> Unit,
content: @Composable RowScope.() -> Unit,
) {
ProvideSecondaryRippleTheme {
TextButton(
...
)
}
}