Add basic sidemenu
This commit is contained in:
parent
d9a96e92ca
commit
18d8108779
5 changed files with 111 additions and 30 deletions
|
@ -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() }
|
||||
}
|
||||
}
|
Reference in a new issue