Hey all, I am trying to provide a local padding via
ModifierLocal
but the padding does not seem to apply. I could not find much documentation on
ModifierLocal
or any tutorials, hope you can point me in the right direction, code in đź§µ
Alex
09/06/2022, 6:42 AM
Copy code
public data class SafeAreaInsets(
val top: Dp = 80.dp,
)
public val ModifierLocalSafeArea: ProvidableModifierLocal<SafeAreaInsets> = modifierLocalOf { SafeAreaInsets() }
public fun Modifier.safeAreaPadding(): Modifier = modifierLocalConsumer {
val safeArea = ModifierLocalSafeArea.current
padding(
top = <http://safeArea.top|safeArea.top>,
)
}
Alex
09/06/2022, 6:43 AM
I am trying to pass a safe-area and set the current value as top-padding but it doesn’t render the padding when I use the code above.
When I set the padding manually it works though, so something must be wrong with my