Installer.kt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package eu.mjdev.desktop.components.installer
  2. import androidx.compose.desktop.ui.tooling.preview.Preview
  3. import androidx.compose.foundation.background
  4. import androidx.compose.foundation.clickable
  5. import androidx.compose.foundation.layout.Box
  6. import androidx.compose.foundation.layout.fillMaxSize
  7. import androidx.compose.foundation.layout.fillMaxWidth
  8. import androidx.compose.foundation.layout.height
  9. import androidx.compose.runtime.Composable
  10. import androidx.compose.ui.Alignment
  11. import androidx.compose.ui.Modifier
  12. import androidx.compose.ui.unit.DpSize
  13. import androidx.compose.ui.unit.dp
  14. import androidx.compose.ui.window.WindowPosition
  15. import eu.mjdev.desktop.components.background.BackgroundImage
  16. import eu.mjdev.desktop.components.sliding.base.VisibilityState
  17. import eu.mjdev.desktop.components.sliding.base.VisibilityState.Companion.rememberVisibilityState
  18. import eu.mjdev.desktop.provider.DesktopScope.Companion.withDesktopScope
  19. import eu.mjdev.desktop.windows.ChromeWindow
  20. @Suppress("FunctionName")
  21. @Composable
  22. fun Installer(
  23. state: VisibilityState = rememberVisibilityState()
  24. ) = withDesktopScope {
  25. ChromeWindow(
  26. visible = state.isVisible,
  27. size = DpSize(808.dp, 608.dp),
  28. position = WindowPosition.Aligned(Alignment.Center)
  29. ) {
  30. Box(
  31. modifier = Modifier.fillMaxSize().clickable {
  32. state.hide()
  33. }
  34. ) {
  35. Box(
  36. modifier = Modifier.fillMaxSize()
  37. .background(backgroundColor),
  38. contentAlignment = Alignment.Center
  39. ) {
  40. BackgroundImage(
  41. modifier = Modifier.fillMaxSize()
  42. )
  43. Box(
  44. modifier = Modifier.fillMaxWidth()
  45. .height(200.dp)
  46. .background(iconsTintColor)
  47. .align(Alignment.BottomCenter)
  48. ) {
  49. // todo
  50. }
  51. }
  52. }
  53. }
  54. }
  55. @Preview
  56. @Composable
  57. fun InfoWindowPreview() = Installer()