Skip to content

Commit 1f72499

Browse files
eriedclaude
andcommitted
Dashboard: fix dial sizing so ODO never gets clipped, no giant gap
The dial Box now claims all leftover vertical space (weight 1, fill=true) and sizes the gauge to fit both available width and height. On phones it stays a near-square (ratio 1.05); on tablets it becomes a wide-arc car-dash speedo (ratio 2.0) so the wide screen is actually used. The weighted bottom Spacer between action buttons and ODO is gone, so the footer sits where it belongs without a giant mid-dashboard hole. Bumps version to 0.3.2-p6preview13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 70bb90b commit 1f72499

3 files changed

Lines changed: 24 additions & 10 deletions

File tree

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ android {
2727
applicationId = "com.eried.eucplanet"
2828
minSdk = 29
2929
targetSdk = 35
30-
versionCode = 21
31-
versionName = "0.3.2-p6preview12"
30+
versionCode = 22
31+
versionName = "0.3.2-p6preview13"
3232

3333
val buildStamp = SimpleDateFormat("yyMMdd.HHmm")
3434
.apply { timeZone = TimeZone.getTimeZone("UTC") }

app/src/main/java/com/eried/eucplanet/ui/dashboard/DashboardScreen.kt

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import androidx.compose.foundation.rememberScrollState
2929
import androidx.compose.foundation.verticalScroll
3030
import androidx.compose.foundation.layout.Arrangement
3131
import androidx.compose.foundation.layout.Box
32+
import androidx.compose.foundation.layout.BoxWithConstraints
3233
import androidx.compose.foundation.layout.Column
3334
import androidx.compose.foundation.layout.ColumnScope
3435
import androidx.compose.foundation.layout.PaddingValues
@@ -419,7 +420,21 @@ fun DashboardScreen(
419420
val useAccent = !com.eried.eucplanet.ui.theme.isDefaultAccent(accentKey)
420421
val primary = MaterialTheme.colorScheme.primary
421422
val safeColor = if (useAccent) primary else AccentGreen
422-
Box(modifier = Modifier.fillMaxWidth()) {
423+
// BoxWithConstraints with weight(1f, fill=true): the dial Box
424+
// absorbs ALL leftover vertical space so the ODO footer stays
425+
// pinned just below the action buttons. On phones the dial is a
426+
// near-square at ratio 1.05; on tablets it becomes a wide-arc
427+
// car-dash style speedo (ratio 2.0) so the extra horizontal real
428+
// estate is actually used. Width is capped on phones at 0.85 of
429+
// screen, on tablets at 0.95 to leave a small margin.
430+
BoxWithConstraints(
431+
modifier = Modifier.fillMaxWidth().weight(1f, fill = true)
432+
) {
433+
val widthFraction = if (wideStats) 0.95f else 0.85f
434+
val ratio = if (wideStats) 2.0f else 1.05f
435+
val candidateW = maxWidth * widthFraction
436+
val maxByHeight = maxHeight * ratio
437+
val dialW = minOf(candidateW, maxByHeight)
423438
SpeedGauge(
424439
speed = wheelData.speed.absoluteValue,
425440
maxSpeed = gaugeMax,
@@ -433,10 +448,9 @@ fun DashboardScreen(
433448
// arc (overrideColor above) still wears the accent.
434449
safeBandColor = AccentGreen,
435450
modifier = Modifier
436-
.fillMaxWidth(if (wideStats) 0.55f else 0.85f)
437-
.widthIn(max = if (wideStats) 360.dp else Dp.Unspecified)
438-
.aspectRatio(if (wideStats) 1.25f else 1.05f)
439-
.align(Alignment.TopCenter)
451+
.width(dialW)
452+
.aspectRatio(ratio)
453+
.align(Alignment.Center)
440454
.clickable { onNavigateToMetric("SPEED") }
441455
)
442456
// Car-dashboard status cluster, top-left: P (park) / D (drive).
@@ -730,7 +744,7 @@ fun DashboardScreen(
730744
)
731745
}
732746

733-
Spacer(Modifier.weight(1f, fill = true))
747+
Spacer(Modifier.height(12.dp))
734748

735749
// Bottom info row: ODO + wheel model + firmware + version (tap for About)
736750
var showAboutDialog by remember { mutableStateOf(false) }

wear/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ android {
2222
applicationId = "com.eried.eucplanet"
2323
minSdk = 30
2424
targetSdk = 35
25-
versionCode = 21
26-
versionName = "0.3.2-p6preview12"
25+
versionCode = 22
26+
versionName = "0.3.2-p6preview13"
2727
}
2828

2929
signingConfigs {

0 commit comments

Comments
 (0)