From 5c6ac565a3ea824bd5ece6cafc8a0ad645f12781 Mon Sep 17 00:00:00 2001 From: Super12138 <70494801+Super12138@users.noreply.github.com> Date: Sat, 8 Feb 2025 21:17:01 +0800 Subject: [PATCH] =?UTF-8?q?perf(editor):=20=E4=BC=98=E5=8C=96=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7=E6=96=87=E5=AD=97=E8=8E=B7=E5=8F=96=E6=80=A7?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt b/app/src/main/kotlin/cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt index f9ea722..e409877 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/pages/editor/TodoEditorPage.kt @@ -24,7 +24,6 @@ import androidx.compose.material.icons.automirrored.outlined.Undo import androidx.compose.material.icons.outlined.Delete import androidx.compose.material.icons.outlined.Save import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon import androidx.compose.material3.Label import androidx.compose.material3.MaterialTheme import androidx.compose.material3.PlainTooltip @@ -207,8 +206,8 @@ fun TodoEditorPage( Spacer(Modifier.size(5.dp)) + val priorityName = Priority.entries.map { it.getDisplayName(context) } // 要不要用 remember 呢 val interactionSource = remember { MutableInteractionSource() } - Slider( modifier = Modifier.semantics { contentDescription = context.getString(R.string.label_priority) @@ -218,7 +217,7 @@ fun TodoEditorPage( VibrationUtils.performHapticFeedback(view, HapticFeedbackConstants.LONG_PRESS) priorityState = it }, - valueRange = -10f..10f, + valueRange = -2f..2f, steps = 3, interactionSource = interactionSource, thumb = { @@ -229,7 +228,7 @@ fun TodoEditorPage( .sizeIn(45.dp, 25.dp) .wrapContentWidth() ) { - Text(Priority.fromFloat(priorityState).getDisplayName(context)) + Text(priorityName[Priority.fromFloat(priorityState).ordinal]) } }, interactionSource = interactionSource