Skip to content

Instantly share code, notes, and snippets.

View CostaFot's full-sized avatar
🍦

Costa Fotiadis CostaFot

🍦
View GitHub Profile
@Composable
fun FirstScreen(
navigate: () -> Unit,
firstContainer: FirstContainer = rememberFirstContainer(),
firstViewModel: FirstViewModel = viewModel(factory = firstContainer.viewModelFactory)
) {
// content...
}
@Composable
private fun MainContent(
changeSystemBarStyle: (SystemBarStyle) -> Unit
) {
Scaffold(
modifier = Modifier.fillMaxSize(),
containerColor = Color.Black
) { paddingValues ->
LaunchedEffect(Unit) {
@Composable
fun BoxWithConstraintsScope.draggableBox() {
Box(
modifier = Modifier
.fillMaxWidth()
.height(boxHeight)
.background(Color.White)
.align(Alignment.BottomCenter)
.pointerInput(Unit) {
detectVerticalDragGestures { change, dragAmount ->
@Composable
fun MainContent() {
Scaffold { paddingValues ->
// ....
val layoutDirection = LocalLayoutDirection.current
Box(
modifier = Modifier
.fillMaxSize()
.padding(
start = paddingValues.calculateStartPadding(layoutDirection),
@Composable
private fun MainContent(
changeSystemBarStyle: (SystemBarStyle) -> Unit // pass function from top level to change the SystemBarStyle
) {
Scaffold(
modifier = Modifier.fillMaxSize(),
containerColor = Color.Black
) { paddingValues ->
LaunchedEffect(Unit) {
val minimumBoxHeight = 200.dp
val maximumBoxHeight = maxHeight - statusBarHeight // stop before covering the status bar
var boxHeight by remember {
mutableStateOf(minimumBoxHeight)
}
Box(
modifier = Modifier
.fillMaxWidth()
.height(boxHeight)
.background(Color.White)
val layoutDirection = LocalLayoutDirection.current
Box(
modifier = Modifier
.fillMaxSize()
.padding(
start = paddingValues.calculateStartPadding(layoutDirection),
end = paddingValues.calculateEndPadding(layoutDirection),
bottom = paddingValues.calculateBottomPadding(),
)
) {
Scaffold(
modifier = Modifier.fillMaxSize(),
containerColor = Color.Black
) { paddingValues ->
val layoutDirection = LocalLayoutDirection.current
Box(
modifier = Modifier
.fillMaxSize()
.padding(
start = paddingValues.calculateStartPadding(layoutDirection),
Scaffold(
modifier = Modifier.fillMaxSize(),
containerColor = Color.Black
) { paddingValues ->
Box(modifier = Modifier.fillMaxSize().padding(paddingValues).background(Color.White))
}
Surface(
modifier = Modifier.fillMaxSize(),
color = Color.Blue
) { }