WindowScopeのWindowDraggableAreaコンポーザブル関数を使用すると、ウィンドウをドラッグして移動できるようになります。
サンプルプログラム
以下のプログラムはウィンドウ全体をドラッグして移動できます。
import androidx.compose.foundation.window.WindowDraggableArea
@Composable
@Preview
fun App(windowScope: WindowScope) {
MaterialTheme {
windowScope.WindowDraggableArea(modifier = Modifier.fillMaxSize()) {
}
}
}
fun main() = application {
Window(onCloseRequest = ::exitApplication) {
App(this)
}
}