Samkeene
05/31/2020, 10:42 PMprivate fun playerLifeBar() : Component {
val label = Tag(TAG.LABEL, classes = setOf("justify-content-center", "align-items-center", "d-flex", "h-inherit", "position-absolute", "w-100"))
return ProgressBar(0, style = ProgressBarStyle.DANGER, classes = setOf("m-1", "position-relative")) {
add(label)
playerStore.subscribe { player ->
progress = player.life.roundToInt()
max = player.maxLife.roundToInt()
label.content = "${player.life.roundToInt()} / ${player.maxLife.roundToInt()}"
}
}
}
I'm not sure if it would be 'cleaner' to declare the label inside the progress bar and subscribe to it, what do you think? Am I being too nit-picky here?