Add basic sidemenu

This commit is contained in:
Tibo De Peuter 2023-04-11 22:39:51 +02:00
parent d9a96e92ca
commit 18d8108779
5 changed files with 111 additions and 30 deletions

View file

@ -1,6 +1,7 @@
package be.ugent.sel.studeez
import android.content.res.Resources
import androidx.compose.material.DrawerState
import androidx.compose.material.ScaffoldState
import androidx.compose.runtime.Stable
import androidx.navigation.NavHostController
@ -13,11 +14,14 @@ import kotlinx.coroutines.launch
@Stable
class StudeezAppstate(
val scaffoldState: ScaffoldState,
val drawerState: DrawerState,
val navController: NavHostController,
private val snackbarManager: SnackbarManager,
private val resources: Resources,
coroutineScope: CoroutineScope
) {
val coroutineScope: CoroutineScope = coroutineScope
init {
coroutineScope.launch {
snackbarManager.snackbarMessages.filterNotNull().collect { snackbarMessage ->
@ -48,4 +52,8 @@ class StudeezAppstate(
popUpTo(0) { inclusive = true }
}
}
fun openDrawer() {
coroutineScope.launch { drawerState.open() }
}
}