Skip to content

Commit 700831f

Browse files
committed
注释
1 parent a1a6d72 commit 700831f

File tree

2 files changed

+47
-32
lines changed

2 files changed

+47
-32
lines changed

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

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ fun SuperDropdown(
219219
)
220220
}
221221
}
222-
) { _,_ ->
223-
layout(0,0) {}
222+
) { _, _ ->
223+
layout(0, 0) {}
224224
}
225225
}
226226
},
@@ -304,11 +304,13 @@ fun SuperDropdown(
304304
)
305305
}
306306
.layout { measurable, constraints ->
307-
val placeable = measurable.measure(constraints.copy(
308-
minWidth = 200.dp.roundToPx(),
309-
minHeight = 50.dp.roundToPx(),
310-
maxHeight = windowHeightPx - statusBarPx - navigationBarPx - captionBarPx
311-
))
307+
val placeable = measurable.measure(
308+
constraints.copy(
309+
minWidth = 200.dp.roundToPx(),
310+
minHeight = 50.dp.roundToPx(),
311+
maxHeight = windowHeightPx - statusBarPx - navigationBarPx - captionBarPx
312+
)
313+
)
312314
layout(constraints.maxWidth, constraints.maxHeight) {
313315
val xCoordinate = calculateOffsetXPx(
314316
componentInnerOffsetXPx,
@@ -431,6 +433,18 @@ fun DropdownImpl(
431433
}
432434
}
433435

436+
/**
437+
* Calculate the offset of the dropdown.
438+
*
439+
* @param componentInnerOffsetXPx The offset of the component inside.
440+
* @param componentInnerWidthPx The width of the component inside.
441+
* @param dropdownWidthPx The width of the dropdown.
442+
* @param extraPaddingPx The extra padding of the dropdown.
443+
* @param displayCutoutLeftSizePx The size of the display cutout on the left.
444+
* @param defaultWindowInsetsPadding Whether to apply default window insets padding to the dropdown.
445+
* @param alignRight Whether to align the dropdown to the right.
446+
* @return The offset of the dropdown.
447+
*/
434448
fun calculateOffsetXPx(
435449
componentInnerOffsetXPx: Int,
436450
componentInnerWidthPx: Int,

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

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,26 +85,25 @@ import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
8585
import top.yukonga.miuix.kmp.utils.getWindowSize
8686
import kotlin.math.roundToInt
8787

88-
8988
/**
90-
* A [SuperSpinner] component with Miuix style.
89+
* A spinner component with Miuix style.
9190
*
92-
* @param title the title of the [SuperSpinner].
93-
* @param items the list of [SpinnerEntry] to be shown in the [SuperSpinner].
94-
* @param selectedIndex the index of the selected item in the [SuperSpinner].
95-
* @param modifier the [Modifier] to be applied to the [SuperSpinner].
96-
* @param popupModifier the [Modifier] to be applied to the popup of the [SuperSpinner].
97-
* @param titleColor the color of the title of the [SuperSpinner].
98-
* @param summary the summary of the [SuperSpinner].
99-
* @param summaryColor the color of the summary of the [SuperSpinner].
100-
* @param mode the mode of the [SuperSpinner].
101-
* @param horizontalPadding the horizontal padding of the [SuperSpinner].
102-
* @param leftAction the action to be shown at the left side of the [SuperSpinner].
103-
* @param insideMargin the [PaddingValues] to be applied inside the [SuperSpinner].
104-
* @param defaultWindowInsetsPadding whether to apply the default window insets padding to the [SuperSpinner].
105-
* @param enabled whether the [SuperSpinner] is enabled.
106-
* @param showValue whether to show the value of the [SuperSpinner].
107-
* @param onSelectedIndexChange the callback to be invoked when the selected index of the [SuperSpinner] is changed.
91+
* @param title The title of the [SuperSpinner].
92+
* @param items The list of [SpinnerEntry] to be shown in the [SuperSpinner].
93+
* @param selectedIndex The index of the selected item in the [SuperSpinner].
94+
* @param modifier The [Modifier] to be applied to the [SuperSpinner].
95+
* @param popupModifier The [Modifier] to be applied to the popup of the [SuperSpinner].
96+
* @param titleColor The color of the title of the [SuperSpinner].
97+
* @param summary The summary of the [SuperSpinner].
98+
* @param summaryColor The color of the summary of the [SuperSpinner].
99+
* @param mode The mode of the [SuperSpinner].
100+
* @param horizontalPadding The horizontal padding of the [SuperSpinner].
101+
* @param leftAction The action to be shown at the left side of the [SuperSpinner].
102+
* @param insideMargin The [PaddingValues] to be applied inside the [SuperSpinner].
103+
* @param defaultWindowInsetsPadding Whether to apply the default window insets padding to the [SuperSpinner].
104+
* @param enabled Whether the [SuperSpinner] is enabled.
105+
* @param showValue Whether to show the value of the [SuperSpinner].
106+
* @param onSelectedIndexChange The callback to be invoked when the selected index of the [SuperSpinner] is changed.
108107
*/
109108
@Composable
110109
fun SuperSpinner(
@@ -224,8 +223,8 @@ fun SuperSpinner(
224223
)
225224
}
226225
}
227-
) { _,_ ->
228-
layout(0,0) {}
226+
) { _, _ ->
227+
layout(0, 0) {}
229228
}
230229
}
231230
leftAction?.invoke()
@@ -314,11 +313,13 @@ fun SuperSpinner(
314313
)
315314
}
316315
.layout { measurable, constraints ->
317-
val placeable = measurable.measure(constraints.copy(
318-
minWidth = 200.dp.roundToPx(),
319-
minHeight = 50.dp.roundToPx(),
320-
maxHeight = windowHeightPx - statusBarPx - navigationBarPx - captionBarPx
321-
))
316+
val placeable = measurable.measure(
317+
constraints.copy(
318+
minWidth = 200.dp.roundToPx(),
319+
minHeight = 50.dp.roundToPx(),
320+
maxHeight = windowHeightPx - statusBarPx - navigationBarPx - captionBarPx
321+
)
322+
)
322323
layout(constraints.maxWidth, constraints.maxHeight) {
323324
val xCoordinate = calculateOffsetXPx(
324325
componentInnerOffsetXPx,

0 commit comments

Comments
 (0)