Skip to content

Commit 2a7182e

Browse files
committed
update: [SuperDropdown] Use items to optimize performance
add: [SuperSpinner] New component with support for both dropdown and dialog modes, and support for complex items
1 parent d495f60 commit 2a7182e

File tree

4 files changed

+463
-15
lines changed

4 files changed

+463
-15
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="button_cancel">取消</string>
3+
</resources>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="button_cancel">Cancel</string>
3+
</resources>

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperDropdown.kt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -303,21 +303,19 @@ fun SuperDropdown(
303303
.clip(SmoothRoundedCornerShape(16.dp))
304304
.background(MiuixTheme.colorScheme.surface)
305305
) {
306-
item {
307-
items.forEachIndexed { index, option ->
308-
DropdownImpl(
309-
text = option,
310-
optionSize = items.size,
311-
isSelected = items[selectedIndex] == option,
312-
onSelectedIndexChange = {
313-
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
314-
onSelectedIndexChange(it)
315-
dismissPopup(isDropdownExpanded)
316-
},
317-
textWidthDp = textWidthDp,
318-
index = index
319-
)
320-
}
306+
items(items.size) { index ->
307+
DropdownImpl(
308+
text = items[index],
309+
optionSize = items.size,
310+
isSelected = selectedIndex == index,
311+
onSelectedIndexChange = {
312+
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
313+
onSelectedIndexChange(it)
314+
dismissPopup(isDropdownExpanded)
315+
},
316+
textWidthDp = textWidthDp,
317+
index = index
318+
)
321319
}
322320
}
323321
}

0 commit comments

Comments
 (0)