refactor: cleaner display code

This commit is contained in:
aro 2023-01-13 11:45:11 +01:00
parent 1791010676
commit be5039b386

View file

@ -13,6 +13,7 @@ import androidx.compose.ui.unit.ExperimentalUnitApi
import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.TextUnitType import androidx.compose.ui.unit.TextUnitType
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import xyz.atnrch.wrench.gui.style.Fonts
import xyz.atnrch.wrench.gui.style.UIColors import xyz.atnrch.wrench.gui.style.UIColors
import xyz.atnrch.wrench.watcher.WatcherEntry import xyz.atnrch.wrench.watcher.WatcherEntry
import xyz.atnrch.wrench.watcher.WatcherManager import xyz.atnrch.wrench.watcher.WatcherManager
@ -35,35 +36,26 @@ fun OutputEntries(
) { ) {
OutputTopText() OutputTopText()
Column( Column(
verticalArrangement = Arrangement.spacedBy(15.dp) verticalArrangement = Arrangement.spacedBy(15.dp),
horizontalAlignment = Alignment.CenterHorizontally
) { ) {
val entry: WatcherEntry? = watcherManager.getFromId(currentClick) val entry: WatcherEntry? = watcherManager.getFromId(currentClick)
if (entry != null) { if (entry != null) {
outputs.clear() outputs.clear()
outputs.addAll(entry.outputs) outputs.addAll(entry.outputs)
Box( if (outputs.isEmpty()) Text(
contentAlignment = Alignment.Center text = "This file does not have any output location.",
) { fontSize = TextUnit(17F, TextUnitType.Sp),
Column( fontFamily = Fonts.ROBOTO_BOLD,
verticalArrangement = Arrangement.SpaceEvenly, color = Color.White
horizontalAlignment = Alignment.CenterHorizontally ) else outputs.forEach {
) { Text(
if (outputs.isEmpty()) { text = it.pathString,
Text( fontSize = TextUnit(17F, TextUnitType.Sp),
text = "This file does not have any output location.", fontFamily = Fonts.ROBOTO_REGULAR,
fontSize = TextUnit(17F, TextUnitType.Sp), color = Color.White
color = Color.White )
)
} else {
outputs.forEach {
Text(
text = it.pathString,
color = Color.White
)
}
}
}
} }
} }
} }