fix: 待办项目内容过长的显示错误(添加跑马灯效果)

This commit is contained in:
Super12138 2025-01-11 22:25:40 +08:00
parent 52c9ce58ae
commit 4bfa2c4970

View file

@ -1,5 +1,6 @@
package cn.super12138.todo.ui.pages.main.components
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@ -17,6 +18,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@Composable
@ -37,7 +39,7 @@ fun TodoCard(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxSize()
.padding(start = 15.dp, end = 15.dp)
.padding(horizontal = 15.dp)
) {
Column(
verticalArrangement = Arrangement.Center,
@ -47,11 +49,15 @@ fun TodoCard(
) {
Text(
text = content,
style = MaterialTheme.typography.titleLarge
style = MaterialTheme.typography.titleLarge,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.basicMarquee() // TODO: 后续评估性能影响
)
Text(
text = subject,
style = MaterialTheme.typography.labelMedium
style = MaterialTheme.typography.labelMedium,
maxLines = 1
)
}
@ -59,7 +65,7 @@ fun TodoCard(
Icon(
imageVector = Icons.Outlined.Check,
tint = MaterialTheme.colorScheme.primary,
contentDescription = ""
contentDescription = "" // TODO: 无障碍适配
)
}