https://kotlinlang.org logo
#compose
Title
# compose
f

Frank van der Laan

05/31/2022, 6:47 AM
On compose naming conventions: what would be the best name for the below method?
Copy code
@Composable
fun ConfigureSystemBars(
    isContentDark: Boolean = defaultIsContentDark,
) {
    val systemUiController = rememberSystemUiController()
    val isDarkTheme = isSystemInDarkTheme()
    LaunchedEffect(isContentDark) {
        systemUiController.setSystemBarsColor(
            color = Color.Transparent,
            darkIcons = isContentDark && !isDarkTheme,
            isNavigationBarContrastEnforced = false,
        )
    }
}
It sort of feels (when using it in a component), like it’s displaying a component now. It’s not returning anything, so it cannot be called
configureSystemBars
(lower case).
👀 1
f

Filip Wiesner

05/31/2022, 7:15 AM
I don't know about official conventions but I would call it something like
SystemBarConfigurator
or
SystemBarColorController
. In activity compose artifact there is
BackHandler
so I would think that this should be similar.
👍 3
2 Views