|
1 | 1 | package love.forte.simbot.codegen.components |
2 | 2 |
|
3 | | -import androidx.compose.animation.animateColorAsState |
4 | 3 | import androidx.compose.animation.animateContentSize |
5 | 4 | import androidx.compose.animation.core.Spring |
6 | 5 | import androidx.compose.animation.core.spring |
7 | | -import androidx.compose.animation.core.tween |
8 | 6 | import androidx.compose.foundation.interaction.MutableInteractionSource |
9 | 7 | import androidx.compose.foundation.interaction.collectIsFocusedAsState |
10 | 8 | import androidx.compose.foundation.layout.fillMaxWidth |
@@ -43,29 +41,34 @@ fun EnhancedTextField( |
43 | 41 | val interactionSource = remember { MutableInteractionSource() } |
44 | 42 | val isFocused by interactionSource.collectIsFocusedAsState() |
45 | 43 |
|
46 | | - val borderColor by animateColorAsState( |
47 | | - targetValue = when { |
48 | | - isError -> MaterialTheme.colorScheme.error |
49 | | - isFocused -> MaterialTheme.colorScheme.primary |
50 | | - else -> MaterialTheme.colorScheme.outline.copy(alpha = 0.8f) |
51 | | - }, |
52 | | - animationSpec = tween(durationMillis = 200), |
53 | | - label = "边框颜色动画" |
54 | | - ) |
| 44 | +// val borderColor by animateColorAsState( |
| 45 | +// targetValue = when { |
| 46 | +// isError -> MaterialTheme.colorScheme.error |
| 47 | +// isFocused -> MaterialTheme.colorScheme.primary |
| 48 | +// else -> MaterialTheme.colorScheme.outline.copy(alpha = 0.8f) |
| 49 | +// }, |
| 50 | +// animationSpec = tween(durationMillis = 200), |
| 51 | +// label = "边框颜色动画" |
| 52 | +// ) |
55 | 53 |
|
56 | | - // val backgroundColor = when { |
57 | | - // isFocused -> MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.3f) |
58 | | - // else -> MaterialTheme.colorScheme.surface |
59 | | - // } |
| 54 | + val borderColor = when { |
| 55 | + isError -> MaterialTheme.colorScheme.error |
| 56 | + isFocused -> MaterialTheme.colorScheme.primary |
| 57 | + else -> MaterialTheme.colorScheme.outline.copy(alpha = 0.65f) |
| 58 | + } |
60 | 59 |
|
61 | | - val backgroundColor by animateColorAsState( |
62 | | - targetValue = when { |
63 | | - isFocused -> MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.15f) |
64 | | - else -> MaterialTheme.colorScheme.surface |
65 | | - }, |
66 | | - animationSpec = tween(durationMillis = 130), |
67 | | - label = "背景颜色动画" |
68 | | - ) |
| 60 | +// val backgroundColor = when { |
| 61 | +// isFocused -> MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.15f) |
| 62 | +// else -> MaterialTheme.colorScheme.surface |
| 63 | +// } |
| 64 | + |
| 65 | +// val backgroundColor by animateColorAsState( |
| 66 | +// targetValue = when { |
| 67 | +// isFocused -> MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.15f) |
| 68 | +// else -> MaterialTheme.colorScheme.surface |
| 69 | +// }, |
| 70 | +// label = "背景颜色动画" |
| 71 | +// ) |
69 | 72 |
|
70 | 73 | OutlinedTextField( |
71 | 74 | value = value, |
@@ -107,8 +110,8 @@ fun EnhancedTextField( |
107 | 110 | colors = OutlinedTextFieldDefaults.colors( |
108 | 111 | focusedBorderColor = borderColor, |
109 | 112 | unfocusedBorderColor = borderColor.copy(alpha = 0.7f), |
110 | | - focusedContainerColor = backgroundColor, |
111 | | - unfocusedContainerColor = backgroundColor, |
| 113 | +// focusedContainerColor = backgroundColor, |
| 114 | +// unfocusedContainerColor = backgroundColor, |
112 | 115 | focusedLabelColor = MaterialTheme.colorScheme.primary, |
113 | 116 | unfocusedLabelColor = MaterialTheme.colorScheme.onSurfaceVariant, |
114 | 117 | errorBorderColor = MaterialTheme.colorScheme.error, |
|
0 commit comments