casablancais
09/08/2020, 11:10 AMNote : 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 ?
@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
) {...}
Mark Murphy
09/08/2020, 11:13 AMmodifier
is the first parameter in the parameter list with a default value. That fits with the TopAppBar()
code that you pasted in, as title
does not offer a default value.casablancais
09/08/2020, 8:14 PM