-
-
Save cherifGsoul/e1522fad82eef330599680beed26337f to your computer and use it in GitHub Desktop.
jetpack compose desktop base layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.resound.ui.components | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.border | |
import androidx.compose.foundation.layout.* | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Alignment | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.graphics.Color | |
import androidx.compose.ui.unit.dp | |
@Composable | |
fun baseLayout(sidebar: @Composable () -> Unit, body: @Composable () -> Unit, footer: @Composable () -> Unit) { | |
Column( | |
Modifier | |
.fillMaxSize() | |
.background(Color.Black) | |
.border( | |
width = 2.dp, | |
color = Color.Green | |
) | |
.padding(2.dp) | |
) { | |
Row(Modifier.fillMaxWidth().background(Color.DarkGray).weight(1f)) { | |
Column( | |
Modifier.width(200.dp).background(Color.Gray).border( | |
width = 2.dp, | |
color = Color.Red | |
).fillMaxHeight(), | |
verticalArrangement = Arrangement.SpaceEvenly, | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { | |
sidebar() | |
} | |
Column( | |
Modifier.fillMaxWidth().background(Color.Magenta).border( | |
width = 2.dp, | |
color = Color.White | |
).fillMaxHeight(), | |
verticalArrangement = Arrangement.Center, | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { body() } | |
} | |
Row( | |
Modifier.border(width = 2.dp, color = Color.Yellow).fillMaxWidth().height(128.dp).background(Color.Blue), | |
verticalAlignment = Alignment.CenterVertically, | |
horizontalArrangement = Arrangement.Center | |
) { | |
footer() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment