Make the Android stage detail pane an opaque raised sheet
The pane's Scaffold already painted an opaque colour, but it was the app background role, identical to the peeks it slides over, so it read as "no background" and its rows ran together with the covered pane's compact identity. Paint the whole pane one theme container role: StageDetailPane gains paneContainerColor() = colorScheme.surfaceContainer and applies it to the Scaffold container, the TopAppBar and the visit PrimaryScrollableTabRow, and StageSection passes it to the shared SectionHeader, which gains an opaque containerColor parameter defaulting to the previous background. The pane now fully covers the area it occupies, including under a sticky section header, and sits a tuneful step above the app background it covers. Move the shared cards one step up so a card stays a card on the new sheet: CodeBlock and the artifacts ArtifactRow use surfaceContainerHigh and the full-size artifact dialog uses surfaceContainerHighest. No geometry, inset or dependency changes; all colours come from the existing theme. Verified with gradle :app:assembleDebug and :app:testDebugUnitTest (137 tests, 0 failures) and by capturing the pane open over the graph and the Timeline at both window widths on emulator-5554. android/README.md records the change and evidence.
This commit is contained in:
@@ -29,8 +29,10 @@ import net.awan.pipelines.ui.theme.pipelinesText
|
||||
/**
|
||||
* The one themed card for code-like content (Input, Output, Source, transcripts,
|
||||
* per-field/evidence data, diagnostics). It matches the rest of the app's cards
|
||||
* (surfaceContainer role, default rounded shape, no elevation) rather than
|
||||
* reading as a foreign bordered monospace box, and adds:
|
||||
* (surfaceContainerHigh role, default rounded shape, no elevation) rather than
|
||||
* reading as a foreign bordered monospace box — one tonal step above both the
|
||||
* app background and a pane's surfaceContainer container, so a card stays a card
|
||||
* wherever it is placed. It adds:
|
||||
*
|
||||
* - a small label header naming the block plus a whole-block copy action;
|
||||
* - monospace body at the shared [pipelinesText] `mono` size/line height;
|
||||
@@ -58,7 +60,7 @@ fun CodeBlock(
|
||||
|
||||
Card(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainer),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
||||
) {
|
||||
Column {
|
||||
|
||||
@@ -21,6 +21,7 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.clearAndSetSemantics
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
@@ -33,9 +34,14 @@ import net.awan.pipelines.ui.theme.pipelinesText
|
||||
/**
|
||||
* The one collapsible section header shared by both detail screens: the section
|
||||
* title in the theme's section-header style, a trailing chevron that rotates
|
||||
* with the state (animated, no jump cut), an opaque background matching the
|
||||
* screen so content passing underneath a stuck header stays readable, and a
|
||||
* subtle divider.
|
||||
* with the state (animated, no jump cut), an opaque background so content
|
||||
* passing underneath a stuck header stays readable, and a subtle divider.
|
||||
*
|
||||
* [containerColor] is the opaque colour the header covers with. It defaults to
|
||||
* the screen background so a stuck header on an ordinary page hides the content
|
||||
* scrolling under it; a caller whose surface is a different container (the stage
|
||||
* pane) passes that same colour so the header never reads as a differently toned
|
||||
* band across its pane.
|
||||
*
|
||||
* Accessibility is exposed without relying on the chevron: the header is a
|
||||
* single button node described as e.g. "Steps, expanded" and carries the
|
||||
@@ -47,6 +53,7 @@ fun SectionHeader(
|
||||
expanded: Boolean,
|
||||
onToggle: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
containerColor: Color = MaterialTheme.colorScheme.background,
|
||||
) {
|
||||
val rotation by animateFloatAsState(
|
||||
targetValue = if (expanded) 0f else -90f,
|
||||
@@ -56,7 +63,7 @@ fun SectionHeader(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
// Opaque: the header is sticky, so content scrolls under it.
|
||||
.background(MaterialTheme.colorScheme.background)
|
||||
.background(containerColor)
|
||||
.clickable(role = Role.Button, onClick = onToggle)
|
||||
.clearAndSetSemantics {
|
||||
contentDescription = "$title, ${if (expanded) "expanded" else "collapsed"}"
|
||||
|
||||
@@ -233,7 +233,7 @@ private fun ArtifactRow(
|
||||
|
||||
Surface(
|
||||
shape = RoundedCornerShape(12.dp),
|
||||
color = MaterialTheme.colorScheme.surfaceContainer,
|
||||
color = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
) {
|
||||
Row(
|
||||
@@ -293,7 +293,7 @@ private fun FullSizeArtifactDialog(
|
||||
Dialog(onDismissRequest = onDismiss) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
color = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
color = MaterialTheme.colorScheme.surfaceContainerHighest,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(12.dp),
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Tab
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
@@ -166,6 +167,16 @@ internal const val STAGE_DEFINITION_KEY = "definition"
|
||||
/** The stage-definition section's title, naming clearly what it holds. */
|
||||
internal const val STAGE_DEFINITION_TITLE = "Stage definition"
|
||||
|
||||
/**
|
||||
* The stage pane's opaque container colour, from the theme's container roles. The
|
||||
* pane is a raised sheet: every one of its own surfaces (the scaffold, the app
|
||||
* bar, the visit tab row and the section headers) paints this same colour, so the
|
||||
* pane fully covers the area it occupies — including under a section header — and
|
||||
* is a visible tonal step above the app background, never see-through.
|
||||
*/
|
||||
@Composable
|
||||
internal fun paneContainerColor() = MaterialTheme.colorScheme.surfaceContainer
|
||||
|
||||
/**
|
||||
* Whether the stage-definition section starts expanded. It is the only content of
|
||||
* a pane opened without a run context (a pipeline's own stage definition, see
|
||||
@@ -322,6 +333,7 @@ fun StageDetailPane(
|
||||
}
|
||||
Scaffold(
|
||||
modifier = modifier,
|
||||
containerColor = paneContainerColor(),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text(GraphSemantics.nodeLabel(stageKey)) },
|
||||
@@ -330,6 +342,7 @@ fun StageDetailPane(
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
||||
}
|
||||
},
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = paneContainerColor()),
|
||||
)
|
||||
},
|
||||
) { padding ->
|
||||
@@ -410,6 +423,7 @@ private fun StageDetailBody(
|
||||
PrimaryScrollableTabRow(
|
||||
selectedTabIndex = clampedVisit,
|
||||
edgePadding = 0.dp,
|
||||
containerColor = paneContainerColor(),
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 8.dp),
|
||||
) {
|
||||
runSteps.forEachIndexed { index, _ ->
|
||||
@@ -485,7 +499,12 @@ private fun StageSection(
|
||||
title: String = key.capitalized(),
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
SectionHeader(title, expansion.isExpanded(key), { expansion.toggle(key) })
|
||||
SectionHeader(
|
||||
title,
|
||||
expansion.isExpanded(key),
|
||||
{ expansion.toggle(key) },
|
||||
containerColor = paneContainerColor(),
|
||||
)
|
||||
if (expansion.isExpanded(key)) content()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user