Skip to content

Commit a6d00db

Browse files
committed
More scaleable desktop layout
1 parent aea875a commit a6d00db

File tree

3 files changed

+52
-48
lines changed

3 files changed

+52
-48
lines changed

desktop/src/main/kotlin/com/jdamcd/arrivals/desktop/ArrivalsView.kt

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,53 +63,56 @@ private fun Loading() {
6363

6464
@Composable
6565
private fun Data(state: ArrivalsState.Data, onClickRefresh: () -> Unit) {
66-
Column(
67-
modifier = Modifier
68-
.padding(top = 44.dp, bottom = 16.dp, start = 32.dp, end = 32.dp)
69-
.fillMaxWidth(),
70-
verticalArrangement = Arrangement.spacedBy(32.dp)
71-
) {
72-
state.result.arrivals.forEach {
73-
ArrivalRow(it)
66+
Column {
67+
Column(
68+
modifier = Modifier
69+
.padding(top = 32.dp, bottom = 20.dp, start = 32.dp, end = 32.dp)
70+
.weight(1f)
71+
.fillMaxWidth(),
72+
verticalArrangement = Arrangement.SpaceEvenly
73+
) {
74+
state.result.arrivals.forEach {
75+
ArrivalRow(it)
76+
}
7477
}
75-
}
76-
Row(
77-
modifier = Modifier
78-
.background(color = Footer)
79-
.padding(start = 32.dp, end = 28.dp)
80-
.fillMaxWidth()
81-
.height(70.dp),
82-
horizontalArrangement = Arrangement.SpaceBetween,
83-
verticalAlignment = Alignment.CenterVertically
84-
) {
85-
Text(
86-
modifier = Modifier.padding(bottom = 4.dp),
87-
text = state.result.station,
88-
color = Text,
89-
style = TextStyle(
90-
fontSize = 32.sp
91-
)
92-
)
93-
Box(
94-
modifier = Modifier.size(42.dp),
95-
contentAlignment = Alignment.Center
78+
Row(
79+
modifier = Modifier
80+
.background(color = Footer)
81+
.padding(start = 32.dp, end = 28.dp)
82+
.fillMaxWidth()
83+
.height(70.dp),
84+
horizontalArrangement = Arrangement.SpaceBetween,
85+
verticalAlignment = Alignment.CenterVertically
9686
) {
97-
if (state.refreshing) {
98-
CircularProgressIndicator(color = LedYellow, modifier = Modifier.size(22.dp))
99-
} else {
100-
TextButton(
101-
onClick = { onClickRefresh() },
102-
colors = ButtonDefaults.textButtonColors(
103-
contentColor = Text,
104-
backgroundColor = Footer
105-
)
106-
) {
107-
Icon(
108-
Icons.Rounded.Refresh,
109-
contentDescription = "Refresh",
110-
modifier = Modifier.size(32.dp),
111-
tint = Text
112-
)
87+
Text(
88+
modifier = Modifier.padding(bottom = 4.dp),
89+
text = state.result.station,
90+
color = Text,
91+
style = TextStyle(
92+
fontSize = 32.sp
93+
)
94+
)
95+
Box(
96+
modifier = Modifier.size(42.dp),
97+
contentAlignment = Alignment.Center
98+
) {
99+
if (state.refreshing) {
100+
CircularProgressIndicator(color = LedYellow, modifier = Modifier.size(22.dp))
101+
} else {
102+
TextButton(
103+
onClick = { onClickRefresh() },
104+
colors = ButtonDefaults.textButtonColors(
105+
contentColor = Text,
106+
backgroundColor = Footer
107+
)
108+
) {
109+
Icon(
110+
Icons.Rounded.Refresh,
111+
contentDescription = "Refresh",
112+
modifier = Modifier.size(32.dp),
113+
tint = Text
114+
)
115+
}
113116
}
114117
}
115118
}

desktop/src/main/kotlin/com/jdamcd/arrivals/desktop/Main.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import androidx.compose.ui.input.key.key
88
import androidx.compose.ui.unit.DpSize
99
import androidx.compose.ui.unit.dp
1010
import androidx.compose.ui.window.Window
11+
import androidx.compose.ui.window.WindowPlacement
1112
import androidx.compose.ui.window.WindowPosition
1213
import androidx.compose.ui.window.application
1314
import androidx.compose.ui.window.rememberWindowState
@@ -21,7 +22,7 @@ fun main(args: Array<String>) = application {
2122
val fixWindow = args.contains("-pi")
2223

2324
val windowState = rememberWindowState(
24-
position = WindowPosition(Alignment.Center),
25+
placement = if (fixWindow) WindowPlacement.Maximized else WindowPlacement.Floating,
2526
size = DpSize(1280.dp, 400.dp)
2627
)
2728

desktop/src/main/kotlin/com/jdamcd/arrivals/desktop/Theme.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ val LurFontFamily = FontFamily(
1818

1919
val LedYellow = Color(0xFFFFDD00)
2020
val Background = Color.Black
21-
val Footer = Color(0xFF121218)
22-
val Text = Color(0xFF707070)
21+
val Footer = Color(0xFF181822)
22+
val Text = Color(0xFF808080)

0 commit comments

Comments
 (0)