StatusBarSuppression

Functions summary

Unit

Suppresses the system status bar for full-screen or overlay components.

Functions

StatusBarSuppression

@Composable
fun StatusBarSuppression(): Unit

Suppresses the system status bar for full-screen or overlay components.

This is intended for rare situations where it is undesirable for a full-screen component (such as a full-screen progress indicator or edge-to-edge overlay) to overlap with the status bar.

Inside an AppScaffold, coordinates with ScaffoldState.screenContent to suppress the status bar and seamlessly coordinate with underlying screens. Outside an AppScaffold, hides the status bar directly on the current window and restores the initial visibility state when leaving composition.

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.ui.Modifier
import androidx.wear.compose.material3.CircularProgressIndicator
import androidx.wear.compose.material3.CircularProgressIndicatorDefaults
import androidx.wear.compose.material3.MaterialTheme
import androidx.wear.compose.material3.StatusBarSuppression

// Suppress the status bar to avoid overlapping with the full-screen circular progress
// indicator.
StatusBarSuppression()

Box(
    modifier =
        Modifier.background(MaterialTheme.colorScheme.background)
            .padding(CircularProgressIndicatorDefaults.FullScreenPadding)
            .fillMaxSize()
) {
    CircularProgressIndicator(progress = { 0.75f }, startAngle = 120f, endAngle = 60f)
}