Answer a question card as one act, and mark the press that made it
Picking an option marked nothing until the answer had crossed the tunnel, been recorded and come back as an event, so the card sat unchanged for most of a second after a tap. What the reader has picked is now the card's own state and shows at once; a Submit at the foot sends every question the tool is waiting on, greyed until all of them have an answer and a spinner while the request is out. Several questions are paged rather than stacked, with the count and a pair of arrows on the right, because three questions with four described options each is several screens and the reader scrolls past the one they are answering to reach the button that sends it. A permission ask keeps its single tap -- two bare words are not worth a submit step -- and marks what was pressed until the request settles, so the mark either stands on the recorded answer or goes away with the failure. Chevron draws all four directions from one description of the shape, since the pager needed two more of them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a4d512af26
commit
8dcd2cb708
7 files changed
+299
-127
No files matched your search
@@ -183,13 +183,34 @@ fun GlyphButton(
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
colour: Color = MaterialTheme.colorScheme.primary,
|
||||
) {
|
||||
MarkButton(label, onClick, modifier, enabled) {
|
||||
Glyph(glyph, colour = if (enabled) colour else MaterialTheme.colorScheme.outline)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The same square, around a mark that is not a glyph.
|
||||
*
|
||||
* A [Chevron] is drawn rather than set in a font, and a pair of them used as buttons has to be the
|
||||
* size, spacing and touch target every other icon button on this app's headers already is -- so
|
||||
* this is [GlyphButton] with the mark left to the caller rather than a second set of measurements
|
||||
* beside it. The caller still owes it a [label]: nothing here draws a word.
|
||||
*/
|
||||
@Composable
|
||||
fun MarkButton(
|
||||
label: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
mark: @Composable () -> Unit,
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onClick,
|
||||
enabled = enabled,
|
||||
modifier = modifier.size(GLYPH_BUTTON_SIZE).semantics { contentDescription = label },
|
||||
) {
|
||||
Glyph(glyph, colour = if (enabled) colour else MaterialTheme.colorScheme.outline)
|
||||
mark()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user