Note : By convention, the modifier is specified as the first optional parameter of a function. This enables you to specify a modifier on a composable without having to name all parameters.
Is there a reason why the AppTopBar Modifier was not put as the first parameter in the compose material TopAppBar implementation ?
Copy code
@Composable
fun TopAppBar(
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
navigationIcon: @Composable (() -> Unit)? = null,
actions: @Composable RowScope.() -> Unit = {},
backgroundColor: Color = MaterialTheme.colors.primarySurface,
contentColor: Color = contentColorFor(backgroundColor),
elevation: Dp = TopAppBarElevation
) {...}
m
Mark Murphy
09/08/2020, 11:13 AM
I believe that the convention is that
modifier
is the first parameter in the parameter list with a default value. That fits with the