-
Such as the direction from which the InfoBar will be shown.
var direction by remember { mutableStateOf((SSComposeInfoBarDirection.Top)) } SSComposeInfoHost( modifier = Modifier .fillMaxSize(), composeHostState = composeInfoHostState, direction = direction )
-
Whether we want to show a default info bar when there is no internet connection.
SSComposeInfoHost( modifier = Modifier .fillMaxSize(), composeHostState = composeInfoHostState, enableNetworkMonitoring = true, )
-
To show a custom ComposeInfoBar we can pass our own Composable in the parameter.
SSComposeInfoHost( modifier = Modifier .fillMaxSize(), composeHostState = composeInfoHostState, composeInfoBar = { content -> SSComposeInfoBar( title = content.title, description = content.description ) } )
-
If you want to have a functionality where the info bar gets dismissed when user starts scrolling some content downwards and it should be visible only if user scrolls slightly upwards.
val lazyListState = rememberLazyListState() SSComposeInfoHost( modifier = Modifier .fillMaxSize(), composeHostState = composeInfoHostState, contentScrollState = lazyListState )
-
If you want a callback when the info bar is dismissed successfully then we can set an onDismissListener to ComposeInfoHostState
val composeInfoHostState by remember { mutableStateOf(SSComposeInfoHostState()) } composeInfoHostState.setOnInfoBarDismiss { Toast.makeText( context, context.getString(R.string.info_bar_dismissed_successfully), Toast.LENGTH_SHORT ).show() } SSComposeInfoHost( modifier = Modifier .fillMaxSize(), composeHostState = composeInfoHostState )