kartoffelsup
03/21/2020, 4:15 PMAdam Powell
03/21/2020, 6:29 PMColumn {
val padding = LayoutPadding(...)
MyChild1(modifier = padding)
MyChild2(modifier = padding)
// ...
}
Adam Powell
03/21/2020, 6:30 PMkartoffelsup
03/21/2020, 6:36 PMAdam Powell
03/21/2020, 6:39 PMRow
or Column
using the Layout()
composable, but short of that, nokartoffelsup
03/21/2020, 6:39 PMAdam Powell
03/21/2020, 6:40 PMkartoffelsup
03/21/2020, 6:41 PMCenteredRow {
Button(modifier = LayoutPadding(end = 5.dp), onClick = { navigateTo(Screen.Login) }) {
Text(text = "Click Me!")
}
if (user != null) {
Button(modifier = LayoutPadding(end = 5.dp), onClick = {
GlobalScope.launch {
val result = MessageService.send(user.userId, "Hello There!", user)
withContext(Dispatchers.Main) {
messageHolder.message = result.fold({ it }, { it.messageId })
}
}
})
{
Text(text = "Send Test Message")
}
Button(onClick = { UserService.logout() }) {
Text(text = stringResource(R.string.logout_buton_text))
}
}
}
Adam Powell
03/21/2020, 6:42 PMPadding {}
composable that applies the padding to each child regardless of the parent layout into the explorations that became modifiersAdam Powell
03/21/2020, 6:43 PMval
and reusing is probably your best bet, or having a custom layout for that CenteredRow
kartoffelsup
03/21/2020, 6:45 PMval
for now 🙂