package com.example.kmptpc_compose_sample.demos.material

import androidx.compose.ui.Modifier
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.foundation.layout.*
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch

@Composable
internal fun DrawerSamples() {
    val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
    val scope = rememberCoroutineScope()

    ModalDrawer(
        drawerState = drawerState,
        drawerContent = {
            Column(Modifier.padding(12.dp)) {
                Text("Drawer 内容")
                Button(onClick = { scope.launch { drawerState.close() } }) { Text("关闭") }
            }
        }
    ) {
        Column(Modifier.padding(12.dp)) {
            Button(onClick = { scope.launch { drawerState.open() } }) { Text("打开 Drawer") }
        }
    }
}
