ciscorucinski
11/17/2020, 12:39 PMOutlinedButton
we can no longer set backgroundColor
or contentColor
and I am no sure of how to do this.
I also noticed that verticalGravity
is gone, but it has been replaced with verticalAlignment
. While that was slightly obvious using auto-completion, I can't find the color properties. Or how I might navigate how to find these changed properties in the future. It seems colors
is something I have to look at, but I am not sure how to execute this in code yetciscorucinski
11/17/2020, 12:42 PMfun AppBar() {
Surface(color = MaterialTheme.colors.primary) {
TopAppBar(modifier = Modifier.fillMaxWidth()) {
Row(
modifier = Modifier
.fillMaxWidth().fillMaxHeight()
.padding(8.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Icon(asset = Icons.Filled.ArrowBack)
OutlinedButton(
onClick = {},
// backgroundColor = Color.Transparent,
shape = CircleShape,
// contentColor = Color.White
border = BorderStroke(1.dp, color = Color.White)
) {
Text(text = "Follow")
}
}
}
}
Saurabh Thorat
11/17/2020, 12:50 PMOutlinedButton
to change its colors:
colors = ButtonConstants.defaultOutlinedButtonColors(
backgroundColor = Color.Transparent,
contentColor = Color.White
)
ciscorucinski
11/17/2020, 1:11 PMBorderStroke
uses a data class that is really easy to setup, where as ButtonColors
uses an interface instead and you need to search for the correct defaultX
function to callciscorucinski
11/17/2020, 1:15 PMcolors = ButtonConstants.defaultButtonColors(...)
works just as well. Is there a reason not to use that when just setting these basic properties?Louis Pullen-Freilich [G]
11/17/2020, 1:32 PMIt appears likeThat's the default for aworks just as well. Is there a reason not to use that when just setting these basic properties?colors = ButtonConstants.defaultButtonColors(...)
Button
, not an OutlinedButton
- so the colors won't match the styling for the rest of the buttonSaurabh Thorat
11/17/2020, 1:32 PMdefaultButtonColors()
will use different background colors for enabled and disabled states, whereas using defaultOutlinedButtonColors()
, will use the same background color when enabled or disabled.