why is kotlin desktop compose so hard?
This commit is contained in:
parent
95ae63260d
commit
8d796b75d7
2 changed files with 28 additions and 13 deletions
|
@ -11,6 +11,7 @@ import androidx.compose.material.icons.Icons
|
|||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.PlayArrow
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
@ -24,6 +25,8 @@ fun BottomRow(
|
|||
state: Boolean,
|
||||
onStateChange: (state: Boolean) -> Unit
|
||||
) {
|
||||
val buttonColors = remember { arrayOf(UIColors.WATCHER_START_BG) }
|
||||
|
||||
//.............
|
||||
// START BUTTON
|
||||
//.............
|
||||
|
@ -38,21 +41,27 @@ fun BottomRow(
|
|||
onStateChange(true)
|
||||
}
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(UIColors.LIGHT, Color.White),
|
||||
colors = ButtonDefaults.buttonColors(buttonColors[0], Color.White),
|
||||
contentPadding = ButtonDefaults.ContentPadding,
|
||||
shape = RoundedCornerShape(100),
|
||||
modifier = Modifier.shadow(15.dp, RoundedCornerShape(100), false)
|
||||
) {
|
||||
if (state) Icon(
|
||||
Icons.Filled.Close,
|
||||
tint = UIColors.STRESS,
|
||||
contentDescription = "Stop",
|
||||
modifier = Modifier.size(28.dp)
|
||||
) else Icon(
|
||||
Icons.Filled.PlayArrow,
|
||||
tint = UIColors.GREEN,
|
||||
contentDescription = "Start",
|
||||
modifier = Modifier.size(28.dp)
|
||||
)
|
||||
if (state) {
|
||||
buttonColors[0] = UIColors.WATCHER_STOP_BG
|
||||
Icon(
|
||||
Icons.Filled.Close,
|
||||
tint = UIColors.WATCHER_STOP_FG,
|
||||
contentDescription = "Stop",
|
||||
modifier = Modifier.size(28.dp)
|
||||
)
|
||||
} else {
|
||||
buttonColors[0] = UIColors.WATCHER_START_BG
|
||||
Icon(
|
||||
Icons.Filled.PlayArrow,
|
||||
tint = UIColors.WATCHER_START_FG,
|
||||
contentDescription = "Start",
|
||||
modifier = Modifier.size(28.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,12 @@ class UIColors {
|
|||
val PRIMARY = Color(0xFF424242)
|
||||
val LIGHT = Color(0xFF6D6D6D)
|
||||
val STRESS = Color(0xFFF44336)
|
||||
val GREEN = Color(0xFF388E3C)
|
||||
val GREEN = Color(0xFF64BA59)
|
||||
val ORANGE = Color(0xFFFFB300)
|
||||
|
||||
val WATCHER_START_BG = Color(0xFF31893D)
|
||||
val WATCHER_START_FG = Color(0xFF64BA69)
|
||||
val WATCHER_STOP_BG = Color(0xFFBA000D)
|
||||
val WATCHER_STOP_FG = STRESS
|
||||
}
|
||||
}
|
Reference in a new issue