mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-06 03:18:23 +00:00
Add option to show full content in EventSection
Tapping the displayed value now toggles between truncated and full content. A new showFullContent parameter controls the initial state. https://claude.ai/code/session_012o3stPCRDek8YpPhEo8y6z
This commit is contained in:
@@ -13,6 +13,10 @@ import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -29,7 +33,9 @@ fun EventSection(
|
||||
displayValue: String,
|
||||
onCopy: () -> Unit,
|
||||
padding: Dp = 16.dp,
|
||||
showFullContent: Boolean = false,
|
||||
) {
|
||||
var expanded by remember { mutableStateOf(showFullContent) }
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -45,13 +51,15 @@ fun EventSection(
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
)
|
||||
Text(
|
||||
modifier = Modifier.padding(top = 12.dp),
|
||||
modifier = Modifier
|
||||
.padding(top = 12.dp)
|
||||
.clickable { expanded = !expanded },
|
||||
text = displayValue,
|
||||
style = MaterialTheme.typography.bodyMedium.copy(
|
||||
lineHeight = 24.sp,
|
||||
),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = if (expanded) Int.MAX_VALUE else 1,
|
||||
overflow = if (expanded) TextOverflow.Clip else TextOverflow.Ellipsis,
|
||||
fontWeight = FontWeight.Bold,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user