Benjamin Deroche
03/14/2022, 4:07 PMobject ButtonActionBar {
@Composable
fun RowScope.CancelButton(onClick: () -> Unit) {
Button(
modifier = Modifier.weight(2f),
onClick = onClick
) {
Text(
text = "Cancel"
)
}
}
}
@Composable
fun RowScope.PublishButton(onClick: () -> Unit) {
Button(
modifier = Modifier.weight(2f),
onClick = onClick
) {
Text(
text = "Publish"
)
}
}
Row(
modifier = Modifier.height(48.dp)
) {
SessionActionBar.CancelButton() {}
PublishButton {}
}
In this example the PublishButton work fine but not the CancelButton, if I remove the RowScope it kinda work (but then I don't have access to weight modifier) or need to move it outside of ButtonActionBar object as the PublishButtonJavier
03/14/2022, 4:10 PMBenjamin Deroche
03/14/2022, 4:12 PMJavier
03/14/2022, 4:14 PMval Int.dp that can only be used in Activity or Fragment, and that example is in the context receivers keep docsnitrog42
03/14/2022, 4:27 PMnitrog42
03/14/2022, 4:28 PMCancelButton { } directly, not ButtonActionBar.CancelButtonnitrog42
03/14/2022, 4:28 PMJavier
03/14/2022, 4:29 PMJavier
03/14/2022, 4:29 PMcontext(RowScope)
object ButtonActionBarJavier
03/14/2022, 4:30 PMButtonActionBar only when the context is a row scopenitrog42
03/14/2022, 4:40 PMModifier.weight(2f) )Benjamin Deroche
03/14/2022, 4:46 PMnitrog42
03/14/2022, 5:09 PMAlbert Chang
03/15/2022, 12:57 AMBenjamin Deroche
03/15/2022, 9:10 AMStylianos Gakis
03/15/2022, 9:59 AMnitrog42
03/15/2022, 10:04 AMStylianos Gakis
03/15/2022, 10:17 AM