Status Bar
The bar at the bottom of a window or of a pane that says how things stand: a document's validity and size at its start, the caret's line and column and the text's encoding at its end. Its buttons keep its height, short as it is, and are pressed past it.
import com.pantrixui.components.container.statusbar.PantrixStatusBar
- Items.
startandendare written as the items of aStatusBarScope:textwords,buttona button,itemthe app's own item, with its words for the menu. - Pressing. The bar is 28dp under a pointer and 32dp on a phone and a tablet; its buttons are 24dp. A button smaller than the touch target is pressed past what it draws too, above and under the bar and in half of the room beside it. So a few dp of what stands above the bar are the button's.
- What does not fit. It falls into the menu of the "…" button at the end, the lowest
priorityfirst, and of two alike the later one; in the menu a button is a row that is pressed, words a row that is read. - Diagnostics. The diagnostics measure the room a button is pressed in, and report a button its neighbours leave less than the target as
SmallTouchTarget. - Automation. With
tagKeythe bar isStatusBar_<tagKey>, its itemsItem_<key>in the bar and in the menu alike, and the "…" buttonMore_items. - Style and colour.
StatusBarStylegives the height and the room at the ends and between items,StatusBarColorsthe fill, the line over the bar, the words and the selected button's colour.
Examples
A document's status
A document's status, at the width chosen: that it is valid, in a tag, and its size, in a button that opens its summary; at the end the caret's place and the text's layout. As the bar narrows, the text's layout falls into the "…" menu first, and then the caret's place.
var width by rememberSaveable { mutableStateOf(640) }
var summary by rememberSaveable { mutableStateOf(false) }
Column(verticalArrangement = Arrangement.spacedBy(PantrixTheme.spacing.sm)) {
PantrixSegmentButton(
options = listOf(
SegmentOption(value = 640, label = "640 dp", tagKey = "640"),
SegmentOption(value = 320, label = "320 dp", tagKey = "320")
),
selected = width,
onSelect = { width = it },
tagKey = "width"
)
PantrixText(
text = if (summary) "The summary is open." else "The summary is closed: press the size.",
color = PantrixTheme.colors.textSecondary,
tagKey = "summary"
)
PantrixStatusBar(
start = {
item(key = "valid", label = "Valid", priority = 3) {
PantrixTag(text = "Valid", tone = TagTone.Success, tagKey = "valid")
}
button(
key = "size",
text = "41 lines · 742 B",
onClick = { summary = !summary },
selected = summary,
contentDescription = if (summary) "Close the summary, 742 B" else "Show the summary, 742 B",
priority = 2
)
},
end = {
text(key = "caret", text = "Ln 12, Col 4", priority = 1)
text(key = "layout", text = "UTF-8 · LF · 2 spaces")
},
modifier = Modifier.widthIn(max = width.dp).fillMaxWidth(),
tagKey = "document"
)
}
A status said when it changes
A status the reader waits on: "Saving…" while it saves, "Saved" when it is done. Since it is given live, a screen reader says each change. The bar's name here is "Editor status".
var saving by rememberSaveable { mutableStateOf(false) }
Column(verticalArrangement = Arrangement.spacedBy(PantrixTheme.spacing.sm)) {
PantrixButton(text = if (saving) "Finish" else "Save", onClick = { saving = !saving }, tagKey = "save")
PantrixStatusBar(
start = { text(key = "saved", text = if (saving) "Saving…" else "Saved", live = true) },
contentDescription = "Editor status",
tagKey = "editor"
)
}
Its own style and colours
In its own style and colours: a lower bar, the app's fill and line, and the selected button's colour.
val colors = PantrixTheme.colors
PantrixStatusBar(
start = {
button(key = "branch", text = "main", onClick = {}, selected = true)
text(key = "changes", text = "3 changes")
},
end = { text(key = "time", text = "14:32") },
style = StatusBarStyle(height = 24.dp, gap = 12.dp),
colors = StatusBarColors(
container = colors.primary.container,
line = colors.primary.color,
content = colors.primary.onContainer,
selected = colors.primary.onContainer
),
tagKey = "own"
)
API
start
The bar at the bottom of a window or of a pane that says how things stand: a document's validity and size at its start, the caret's line and column and the text's encoding at its end. Its buttons keep its height, short as it is, and are pressed past it.
| Parameter | Type | Default | What it is |
|---|---|---|---|
start | StatusBarScope.() -> Unit | the items at the bar's start. | |
modifier | Modifier | Modifier | the bar's modifier. The bar is as wide as it may be. |
end | StatusBarScope.() -> Unit | {} | the items at the bar's end, before the "…" button. |
contentDescription | String? | null | what a screen reader calls the bar, or null for the theme's words for a status bar. |
style | StatusBarStyle? | null | this call's own style: over every enclosing one and under the density. Only the fields it sets change, on every platform. |
colors | StatusBarColors? | null | this call's own colours, where they are not the theme's. |
tagKey | String? | null | the bar's automation key: it is StatusBar_<tagKey>, its items Item_<key> inside it and its "…" button More_items. |
StatusBarStyle
PantrixStatusBar's geometry: how tall the bar is, the room at its two ends and the room between two items. A bar used by touch is taller; its buttons are pressed past it, up to the platform's touch target, rather than made taller.
| Parameter | Type | Default | What it is |
|---|---|---|---|
height | Dp | Dp.Unspecified | How tall the bar is, under its line: 28 under a pointer, 32 on a phone and a tablet. |
horizontalPadding | Dp | Dp.Unspecified | The room at the bar's start and its end. |
gap | Dp | Dp.Unspecified | The room between two items. A button is pressed in half of it on either side, where it is narrower than the touch target. |
StatusBarColors
A PantrixStatusBar's own colours, where they are not the theme's.
| Parameter | Type | Default | What it is |
|---|---|---|---|
container | Color | Color.Unspecified | The bar's fill: the theme's background, a step from the surface of the panes over it. |
line | Color | Color.Unspecified | The line over the bar: the theme's divider. |
content | Color | Color.Unspecified | Its words, a button's among them: the theme's textSecondary, quieter than a pane's. |
selected | Color | Color.Unspecified | The words of a button that is selected, as one that shows a pane while the pane is shown: the theme's primary colour. |
Accessibility
- Screen reader. The bar is one group, named
contentDescriptionor the theme's word "Status". Words givenliveare said each time they change; it is not given to what changes with every key, as a caret's place. A selected button is read as selected.