generated from detekt/detekt-custom-rule-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Valentin Gusselnikov edited this page May 28, 2022
·
1 revision
Ensure that Modifier
is used as a last argument:
@Composable
fun MyScreen(
modifier: Modifier,
text: String
) {
Column(
modifier = modifier // ❌ wrong: it's used in the first argument
.background(Color.LightGray)
.border(1.dp, Color.DarkGray)
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(32.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(Icons.Outlined.Face, null)
Text(text)
}
}
Should be replaced with:
@Composable
fun MyScreen(
modifier: Modifier,
text: String
) {
Column(
verticalArrangement = Arrangement.spacedBy(32.dp),
horizontalAlignment = Alignment.CenterHorizontally,
modifier = modifier // ✅ correct: it's the last argument
.background(Color.LightGray)
.border(1.dp, Color.DarkGray)
.padding(16.dp)
) {
Icon(Icons.Outlined.Face, null)
Text(text)
}
}