Advertisement
Artyom_Kopan

view/SideChoice.kt

May 30th, 2022
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.97 KB | None | 0 0
  1. package view
  2.  
  3. import androidx.compose.foundation.layout.Box
  4. import androidx.compose.foundation.layout.Column
  5. import androidx.compose.foundation.layout.fillMaxHeight
  6. import androidx.compose.foundation.layout.fillMaxWidth
  7. import androidx.compose.foundation.layout.height
  8. import androidx.compose.foundation.layout.padding
  9. import androidx.compose.foundation.layout.width
  10. import androidx.compose.material.Button
  11. import androidx.compose.material.ButtonDefaults
  12. import androidx.compose.material.Text
  13. import androidx.compose.runtime.Composable
  14. import androidx.compose.ui.Alignment
  15. import androidx.compose.ui.Modifier
  16. import androidx.compose.ui.graphics.Color
  17. import androidx.compose.ui.text.font.FontWeight
  18. import androidx.compose.ui.text.style.TextAlign
  19. import androidx.compose.ui.unit.dp
  20. import androidx.compose.ui.unit.sp
  21.  
  22. @Suppress("FunctionNaming")
  23. @Composable
  24. fun SideChoice(onClick1: () -> Unit, onClick2: () -> Unit) = Box(
  25.     modifier = Modifier.fillMaxWidth().fillMaxHeight(), contentAlignment = Alignment.Center
  26. ) {
  27.     Column(modifier = Modifier.width(600.dp).height(800.dp)) {
  28.         Button(
  29.             onClick = onClick1,
  30.             modifier = Modifier.fillMaxWidth(),
  31.             colors = ButtonDefaults.buttonColors(backgroundColor = Color(0, 0, 0, 0))
  32.         ) {
  33.             Text(
  34.                 text = "X",
  35.                 fontSize = 60.sp,
  36.                 textAlign = TextAlign.Center,
  37.                 color = Color.Red,
  38.                 fontWeight = FontWeight.Bold
  39.             )
  40.         }
  41.  
  42.         Button(
  43.             onClick = onClick2,
  44.             modifier = Modifier.fillMaxWidth().padding(0.dp, 100.dp),
  45.             colors = ButtonDefaults.buttonColors(backgroundColor = Color(0, 0, 0, 0))
  46.         ) {
  47.             Text(
  48.                 text = "O",
  49.                 fontSize = 60.sp,
  50.                 textAlign = TextAlign.Center,
  51.                 color = Color.Blue,
  52.                 fontWeight = FontWeight.Bold
  53.             )
  54.         }
  55.     }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement