Provide Top App Bar Overrides
fun UiTreeBuilder.ProvideTopAppBarOverrides(overrides: TopAppBarOverrides, content: UiTreeBuilder.() -> Unit)(source)
Merges sparse TopAppBar overrides for content.
Nested scopes merge field by field and a TopAppBar instance retains the highest precedence. Child IconButton instances may still override the bar-provided navigation or action color.
Receiver
active tree builder receiving the scoped content
Parameters
overrides
sparse appearance patch applied to descendant top app bars
content
subtree built synchronously with the merged patch
Samples
val overlayStore = OverlayRequestStore()
OverlayRequestContext.withStore(overlayStore) {
buildVNodeTree {
ProvideFloatingActionButtonOverrides(
FloatingActionButtonOverrides(containerColor = 0xFF0055AA.toInt()),
) {
FloatingActionButton(onClick = {}) {
Text("+")
}
}
ProvideExtendedFloatingActionButtonOverrides(
ExtendedFloatingActionButtonOverrides(contentColor = 0xFFFFFFFF.toInt()),
) {
ExtendedFloatingActionButton(text = "Create", onClick = {})
}
ProvideTopAppBarOverrides(
TopAppBarOverrides(actionIconColor = 0xFF0055AA.toInt()),
) {
TopAppBar(title = "Library")
}
ProvideBottomAppBarOverrides(
BottomAppBarOverrides(contentColor = 0xFF0055AA.toInt()),
) {
BottomAppBar { Text("Actions") }
}
ProvideBadgeOverrides(BadgeOverrides(containerColor = 0xFFB3261E.toInt())) {
Badge(count = 3)
}
ProvideAlertDialogOverrides(
AlertDialogOverrides(containerColor = 0xFFF7F2FA.toInt()),
) {
AlertDialog(
visible = true,
title = "Discard draft?",
text = "This action cannot be undone.",
confirmButtonText = "Discard",
onConfirm = {},
)
}
}
}
check(overlayStore.currentRequests().size == 1)Content copied to clipboard