fix: v0.3.0.1 — editor chip-row to bottom + centred colour picker + hashtags on list cards + dog-ear colour accent
Urgent UI polish patch on top of v0.3.0.0.
EDITOR (NoteEditorScreen.kt)
- Drop the '+ add' chip from the hashtag row. The '#' icon in the
top bar is now the only way to add tags.
- Move the hashtag chip row to the bottom of the editor. The text
field now uses weight(1f) instead of fillMaxSize() so the row stays
visible below it.
- Hide the chip row entirely when the note has no hashtags (no 'No
tags' placeholder).
- Centre the colour picker horizontally. Switched from a left-aligned
LazyRow to a plain Row with Arrangement.spacedBy(12.dp,
Alignment.CenterHorizontally).
LIST CARDS (NoteListScreen.kt)
- Replace the small 10 dp colour circle chip (next to the star) with
a 'dog-ear' colour accent overlaid on the top-right corner of the
card (a 28 dp right-triangle filled with the note's colour).
- Add a hashtag row to each card. Shows up to three tags as a
FlowRow of label-styled text; an '+N' indicator appears when
there are more than three. Hidden when the note has no tags.
- Wrap the Card in a Box so the dog-ear can be aligned to
Alignment.TopEnd.
VERSION + DOCS
- app/build.gradle.kts: versionCode 5 → 6, versionName '0.3.0.0' →
'0.3.0.1'. The MAJOR.MINOR.MAINTENANCE.EMERGENCY scheme validator
remains in place.
- README.md changelog: new 0.3.0.1 row.
- Incido Development Plan.txt §10: new 0.3.0.1 row.
VERIFIED
- ./gradlew assembleDebug assembleRelease both green.
- Debug 25.7 MB, release 19.8 MB.
- versionCode=6, versionName='0.3.0.1'.
- No INTERNET permission in either APK.
- Release signed (v2 scheme).
This commit is contained in:
1 parent
d616ce3021
commit
dbc4e7acba
5 files changed
+198
-163
No files matched your search
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -17,12 +18,10 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
import androidx.compose.foundation.layout.union
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.Done
|
||||
@@ -32,7 +31,6 @@ import androidx.compose.material.icons.filled.Tag
|
||||
import androidx.compose.material.icons.outlined.StarOutline
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.AssistChip
|
||||
import androidx.compose.material3.AssistChipDefaults
|
||||
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
@@ -57,6 +55,7 @@ import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
@@ -211,25 +210,18 @@ fun NoteEditorScreen(
|
||||
.fillMaxSize()
|
||||
.padding(padding),
|
||||
) {
|
||||
HashtagChipRow(
|
||||
tags = state.hashtags,
|
||||
canAddMore = state.canAddMoreTags,
|
||||
onAddClick = { viewModel.openAddTagSheet() },
|
||||
onRemove = { viewModel.removeTag(it) },
|
||||
)
|
||||
|
||||
// Colour-picker row above the editor text field.
|
||||
LazyRow(
|
||||
// v0.3.0.1: colour picker centred horizontally (was left-aligned
|
||||
// LazyRow in v0.3.0.0). Six fixed entries → plain Row, no LazyRow.
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp, vertical = 4.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(
|
||||
space = 12.dp,
|
||||
alignment = Alignment.CenterHorizontally,
|
||||
),
|
||||
) {
|
||||
items(
|
||||
count = AllNoteColors.size,
|
||||
key = { idx -> AllNoteColors[idx].storageKey.toInt() },
|
||||
) { idx ->
|
||||
val color = AllNoteColors[idx]
|
||||
AllNoteColors.forEach { color ->
|
||||
ColorSwatch(
|
||||
color = color,
|
||||
selected = state.color == color,
|
||||
@@ -238,13 +230,16 @@ fun NoteEditorScreen(
|
||||
}
|
||||
}
|
||||
|
||||
// v0.3.0.1: text field takes remaining vertical space via
|
||||
// weight(1f) instead of fillMaxSize() so the chip row below
|
||||
// it stays visible at the bottom.
|
||||
OutlinedTextField(
|
||||
value = state.content,
|
||||
onValueChange = viewModel::onContentChange,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.weight(1f)
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp)
|
||||
.padding(bottom = 16.dp)
|
||||
.focusRequester(focusRequester),
|
||||
placeholder = { Text("Write something…") },
|
||||
keyboardOptions = KeyboardOptions(
|
||||
@@ -252,6 +247,15 @@ fun NoteEditorScreen(
|
||||
imeAction = ImeAction.Default,
|
||||
),
|
||||
)
|
||||
|
||||
// v0.3.0.1: hashtag chip row now sits at the bottom of the
|
||||
// editor. Hidden entirely when the note has no tags — the `#`
|
||||
// icon in the top bar is the only way to add tags (no `+ add`
|
||||
// chip anymore).
|
||||
HashtagChipRow(
|
||||
tags = state.hashtags,
|
||||
onRemove = { viewModel.removeTag(it) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,11 +284,12 @@ fun NoteEditorScreen(
|
||||
@Composable
|
||||
private fun HashtagChipRow(
|
||||
tags: List<String>,
|
||||
canAddMore: Boolean,
|
||||
onAddClick: () -> Unit,
|
||||
onRemove: (String) -> Unit,
|
||||
) {
|
||||
if (tags.isEmpty() && !canAddMore) return
|
||||
// v0.3.0.1: hide the row entirely when there are no hashtags. The
|
||||
// user opens the add-tag sheet via the `#` icon in the top bar; the
|
||||
// row only appears once at least one tag is present.
|
||||
if (tags.isEmpty()) return
|
||||
FlowRow(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -292,13 +297,6 @@ private fun HashtagChipRow(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
if (tags.isEmpty()) {
|
||||
Text(
|
||||
text = "Tags",
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
tags.forEach { tag ->
|
||||
AssistChip(
|
||||
onClick = { onRemove(tag) },
|
||||
@@ -308,21 +306,10 @@ private fun HashtagChipRow(
|
||||
},
|
||||
)
|
||||
}
|
||||
if (canAddMore) {
|
||||
AssistChip(
|
||||
onClick = onAddClick,
|
||||
label = { Text("+ add") },
|
||||
leadingIcon = { Icon(Icons.Filled.Add, contentDescription = null, modifier = Modifier.size(16.dp)) },
|
||||
colors = AssistChipDefaults.assistChipColors(
|
||||
labelColor = MaterialTheme.colorScheme.primary,
|
||||
leadingIconContentColor = MaterialTheme.colorScheme.primary,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
private fun AddTagSheet(
|
||||
tagInput: String,
|
||||
@@ -360,9 +347,8 @@ private fun AddTagSheet(
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
LazyRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
items(count = suggestions.size, key = { idx -> suggestions[idx] }) { idx ->
|
||||
val s = suggestions[idx]
|
||||
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
suggestions.forEach { s ->
|
||||
SuggestionChip(
|
||||
onClick = { onPickSuggestion(s) },
|
||||
label = { Text("#$s") },
|
||||
|
||||
@@ -4,6 +4,8 @@ import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
@@ -13,7 +15,7 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.GenericShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.CheckBox
|
||||
@@ -41,9 +43,7 @@ import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.lerp
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -55,6 +55,19 @@ import org.incido.domain.model.Note
|
||||
import org.incido.domain.model.NoteColor
|
||||
import org.incido.domain.model.NoteFilter
|
||||
|
||||
/**
|
||||
* Right-triangle that fills the top-right corner of its bounds — a
|
||||
* "dog-ear" / folded-page effect used to mark the note's colour.
|
||||
*/
|
||||
private val DogEarShape = GenericShape { size, _ ->
|
||||
// Right-triangle anchored to the top-right corner: vertices at
|
||||
// (0, 0), (size.width, 0), (size.width, size.height).
|
||||
moveTo(0f, 0f)
|
||||
lineTo(size.width, 0f)
|
||||
lineTo(size.width, size.height)
|
||||
close()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun NoteListScreen(
|
||||
@@ -66,7 +79,6 @@ fun NoteListScreen(
|
||||
val state by viewModel.uiState.collectAsStateWithLifecycle()
|
||||
var localQuery by remember { mutableStateOf("") }
|
||||
|
||||
// Keep the ViewModel in sync with the parent's filter selection.
|
||||
LaunchedEffect(filterMode) { viewModel.setFilter(filterMode) }
|
||||
|
||||
Scaffold(
|
||||
@@ -84,14 +96,13 @@ fun NoteListScreen(
|
||||
if (state.isSearchActive) viewModel.closeSearch() else viewModel.openSearch()
|
||||
localQuery = ""
|
||||
}) {
|
||||
Icon(Icons.Filled.Search, contentDescription = "Search notes")
|
||||
Icon(Icons.Default.Search, contentDescription = "Search notes")
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
// FAB only on Home — adding notes while filtered makes less sense.
|
||||
if (filterMode == NoteFilter.Home) {
|
||||
FloatingActionButton(onClick = { onOpenEditor(null) }) {
|
||||
Icon(Icons.Default.Add, contentDescription = "New note")
|
||||
@@ -209,11 +220,14 @@ private fun NoteList(
|
||||
}
|
||||
|
||||
/**
|
||||
* v0.3.0.0 card redesign — three-layer colour accent so notes of
|
||||
* different colours are visually distinct at a glance:
|
||||
* 1. 14 dp vertical gradient stripe down the left edge.
|
||||
* 2. Tinted card surface (12 % colour blend over the M3 surface).
|
||||
* 3. 10 dp solid colour chip in the top-right corner.
|
||||
* v0.3.0.1 card layout:
|
||||
* - 14 dp vertical gradient stripe down the left edge
|
||||
* - Tinted card surface (12 % colour blend over the M3 surface)
|
||||
* - Dog-ear colour accent in the top-right corner (replaces the old
|
||||
* circle chip next to the star)
|
||||
* - Title + body preview + checklist summary + hashtag row +
|
||||
* timestamp / delete
|
||||
* - Hashtag row is hidden entirely when the note has no tags.
|
||||
*/
|
||||
@Composable
|
||||
private fun NoteCard(
|
||||
@@ -228,122 +242,155 @@ private fun NoteCard(
|
||||
val noteColor = note.color
|
||||
val hasColor = noteColor != NoteColor.NONE
|
||||
|
||||
Card(
|
||||
onClick = onClick,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = if (hasColor) {
|
||||
val tint = noteColor.toComposeColor()
|
||||
val surface = MaterialTheme.colorScheme.surface
|
||||
CardDefaults.cardColors(
|
||||
containerColor = lerp(surface, tint, 0.12f),
|
||||
)
|
||||
} else {
|
||||
CardDefaults.cardColors()
|
||||
},
|
||||
) {
|
||||
Row(modifier = Modifier.fillMaxWidth()) {
|
||||
if (hasColor) {
|
||||
// Layer 1: 14 dp gradient stripe.
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(width = 14.dp, height = 110.dp)
|
||||
.background(
|
||||
Brush.verticalGradient(
|
||||
colors = listOf(
|
||||
noteColor.toComposeColor().copy(alpha = 0.95f),
|
||||
noteColor.toComposeColor().copy(alpha = 0.05f),
|
||||
),
|
||||
)
|
||||
),
|
||||
Box(modifier = Modifier.fillMaxWidth()) {
|
||||
Card(
|
||||
onClick = onClick,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = if (hasColor) {
|
||||
val tint = noteColor.toComposeColor()
|
||||
val surface = MaterialTheme.colorScheme.surface
|
||||
CardDefaults.cardColors(
|
||||
containerColor = lerp(surface, tint, 0.12f),
|
||||
)
|
||||
}
|
||||
Column(modifier = Modifier.padding(16.dp).fillMaxWidth()) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
// Layer 3: top-right colour chip (only when coloured).
|
||||
if (hasColor) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(10.dp)
|
||||
.clip(CircleShape)
|
||||
.background(noteColor.toComposeColor()),
|
||||
)
|
||||
Spacer(modifier = Modifier.size(8.dp))
|
||||
}
|
||||
IconButton(onClick = onToggleFavorite) {
|
||||
Icon(
|
||||
imageVector = if (note.isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline,
|
||||
contentDescription = if (note.isFavorite) "Unfavorite" else "Favorite",
|
||||
tint = if (note.isFavorite) MaterialTheme.colorScheme.primary
|
||||
else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (bodyPreview.isNotEmpty()) {
|
||||
Spacer(modifier = Modifier.padding(top = 4.dp))
|
||||
Text(
|
||||
text = bodyPreview,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
} else {
|
||||
CardDefaults.cardColors()
|
||||
},
|
||||
) {
|
||||
Row(modifier = Modifier.fillMaxWidth()) {
|
||||
if (hasColor) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(width = 14.dp, height = 110.dp)
|
||||
.background(
|
||||
Brush.verticalGradient(
|
||||
colors = listOf(
|
||||
noteColor.toComposeColor().copy(alpha = 0.95f),
|
||||
noteColor.toComposeColor().copy(alpha = 0.05f),
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
if (checklistSummary.isNotEmpty()) {
|
||||
Spacer(modifier = Modifier.padding(top = 4.dp))
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
Icons.Default.CheckBox,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(14.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
Spacer(modifier = Modifier.size(6.dp))
|
||||
Column(modifier = Modifier.padding(16.dp).fillMaxWidth()) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
text = checklistSummary,
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
// v0.3.0.1: small circle chip removed — the
|
||||
// dog-ear below is now the colour indicator.
|
||||
IconButton(onClick = onToggleFavorite) {
|
||||
Icon(
|
||||
imageVector = if (note.isFavorite) Icons.Filled.Star else Icons.Outlined.StarOutline,
|
||||
contentDescription = if (note.isFavorite) "Unfavorite" else "Favorite",
|
||||
tint = if (note.isFavorite) MaterialTheme.colorScheme.primary
|
||||
else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (bodyPreview.isNotEmpty()) {
|
||||
Spacer(modifier = Modifier.padding(top = 4.dp))
|
||||
Text(
|
||||
text = bodyPreview,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
if (checklistSummary.isNotEmpty()) {
|
||||
Spacer(modifier = Modifier.padding(top = 4.dp))
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
Icons.Default.CheckBox,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(14.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
Spacer(modifier = Modifier.size(6.dp))
|
||||
Text(
|
||||
text = checklistSummary,
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (note.hashtags.isNotEmpty()) {
|
||||
Spacer(modifier = Modifier.padding(top = 4.dp))
|
||||
HashtagRow(hashtags = note.hashtags)
|
||||
}
|
||||
Spacer(modifier = Modifier.padding(top = 8.dp))
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
Text(
|
||||
text = rememberRelativeTimestamp(note.updatedAt),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.padding(top = 8.dp))
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
) {
|
||||
Text(
|
||||
text = rememberRelativeTimestamp(note.updatedAt),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
IconButton(onClick = onDelete) {
|
||||
Icon(
|
||||
Icons.Default.Delete,
|
||||
contentDescription = "Delete note",
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
IconButton(onClick = onDelete) {
|
||||
Icon(
|
||||
Icons.Default.Delete,
|
||||
contentDescription = "Delete note",
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// v0.3.0.1: dog-ear colour accent overlays the top-right corner.
|
||||
if (hasColor) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.size(28.dp)
|
||||
.background(
|
||||
color = noteColor.toComposeColor(),
|
||||
shape = DogEarShape,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Lightweight imports used to avoid shadowed-name conflicts in
|
||||
// other files that might also import these symbols ---
|
||||
@Suppress("unused")
|
||||
private fun clip(@Suppress("UNUSED_PARAMETER") shape: androidx.compose.ui.graphics.Shape): Modifier =
|
||||
Modifier.clip(shape)
|
||||
|
||||
@Suppress("unused")
|
||||
private fun background(color: Color): Modifier = Modifier.background(color)
|
||||
/**
|
||||
* v0.3.0.1: hashtag list on the card. Shows up to three tags as a
|
||||
* compact FlowRow of label-styled text; if there are more, renders a
|
||||
* "+N" abbreviation indicator. Hidden entirely by the caller when
|
||||
* [hashtags] is empty.
|
||||
*/
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
private fun HashtagRow(hashtags: List<String>) {
|
||||
val visible = hashtags.take(3)
|
||||
val overflow = hashtags.size - visible.size
|
||||
FlowRow(
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(2.dp),
|
||||
) {
|
||||
visible.forEach { tag ->
|
||||
Text(
|
||||
text = "#$tag",
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
}
|
||||
if (overflow > 0) {
|
||||
Text(
|
||||
text = "+$overflow",
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user