Proper drawer styling
This commit is contained in:
parent
064a9d3f31
commit
7c09aac5b3
1 changed files with 52 additions and 35 deletions
|
@ -12,9 +12,13 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.res.vectorResource
|
import androidx.compose.ui.res.vectorResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import be.ugent.sel.studeez.R
|
import be.ugent.sel.studeez.R
|
||||||
import be.ugent.sel.studeez.resources
|
import be.ugent.sel.studeez.resources
|
||||||
|
import be.ugent.sel.studeez.ui.theme.StudeezTheme
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -22,8 +26,12 @@ fun Drawer(
|
||||||
openAndPopUp: (String, String) -> Unit,
|
openAndPopUp: (String, String) -> Unit,
|
||||||
viewModel: DrawerViewModel = hiltViewModel()
|
viewModel: DrawerViewModel = hiltViewModel()
|
||||||
) {
|
) {
|
||||||
|
Column (
|
||||||
Column(modifier = Modifier.fillMaxSize()) {
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Column (
|
||||||
|
modifier = Modifier.fillMaxWidth().weight(1f)
|
||||||
|
) {
|
||||||
DrawerEntry(
|
DrawerEntry(
|
||||||
icon = Icons.Default.Home,
|
icon = Icons.Default.Home,
|
||||||
text = resources().getString(R.string.home)
|
text = resources().getString(R.string.home)
|
||||||
|
@ -48,6 +56,7 @@ fun Drawer(
|
||||||
) {
|
) {
|
||||||
viewModel.onLogoutClick(openAndPopUp)
|
viewModel.onLogoutClick(openAndPopUp)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DrawerEntry(
|
DrawerEntry(
|
||||||
icon = Icons.Outlined.Info,
|
icon = Icons.Outlined.Info,
|
||||||
|
@ -70,21 +79,29 @@ fun DrawerEntry(
|
||||||
.clickable(onClick = { onClick() })
|
.clickable(onClick = { onClick() })
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Box(modifier = Modifier.fillMaxWidth(0.25f)) {
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(vertical = 12.dp)
|
||||||
|
.fillMaxWidth(0.15f)
|
||||||
|
) {
|
||||||
Icon(imageVector = icon, contentDescription = text)
|
Icon(imageVector = icon, contentDescription = text)
|
||||||
}
|
}
|
||||||
Box(modifier = Modifier.fillMaxWidth(0.75f)) {
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(vertical = 12.dp)
|
||||||
|
.fillMaxWidth(0.85f)
|
||||||
|
) {
|
||||||
Text(text = text)
|
Text(text = text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Preview
|
@Preview
|
||||||
//@Composable
|
@Composable
|
||||||
//fun DrawerPreview() {
|
fun DrawerPreview() {
|
||||||
// StudeezTheme {
|
StudeezTheme {
|
||||||
// Drawer(
|
Drawer(
|
||||||
// {}
|
{a, b -> {}}, hiltViewModel()
|
||||||
// )
|
)
|
||||||
// }
|
}
|
||||||
//}
|
}
|
Reference in a new issue