Skip to content

Commit dda376f

Browse files
committed
library: Move necessary parameters to the top
1 parent ee71022 commit dda376f

File tree

17 files changed

+55
-57
lines changed

17 files changed

+55
-57
lines changed

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
2424
/**
2525
* A [Button] component with Miuix style.
2626
*
27-
* @param modifier The modifier to be applied to the [Button].
2827
* @param text The text of the [Button].
2928
* @param onClick The callback when the [Button] is clicked.
29+
* @param modifier The modifier to be applied to the [Button].
3030
* @param enabled Whether the [Button] is enabled.
3131
* @param submit Whether the [Button] is a submit button.
3232
* @param cornerRadius The corner radius of the [Button].
@@ -35,9 +35,9 @@ import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
3535
*/
3636
@Composable
3737
fun Button(
38-
modifier: Modifier = Modifier,
3938
text: String,
4039
onClick: () -> Unit,
40+
modifier: Modifier = Modifier,
4141
enabled: Boolean = true,
4242
submit: Boolean = false,
4343
cornerRadius: Dp = 16.dp,

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Checkbox.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ import top.yukonga.miuix.kmp.theme.MiuixTheme
3737
/**
3838
* A [Checkbox] component with Miuix style.
3939
*
40-
* @param modifier The modifier to be applied to the [Checkbox].
4140
* @param checked The current state of the [Checkbox].
4241
* @param onCheckedChange The callback to be called when the state of the [Checkbox] changes.
42+
* @param modifier The modifier to be applied to the [Checkbox].
4343
* @param enabled Whether the [Checkbox] is enabled.
4444
*/
4545
@Composable
4646
fun Checkbox(
47-
modifier: Modifier = Modifier,
4847
checked: Boolean,
4948
onCheckedChange: ((Boolean) -> Unit)?,
49+
modifier: Modifier = Modifier,
5050
enabled: Boolean = true,
5151
) {
5252
val isChecked by rememberUpdatedState(checked)

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/FloatingActionButton.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ import top.yukonga.miuix.kmp.theme.MiuixTheme
1717
/**
1818
* A [FloatingActionButton] component with Miuix style.
1919
*
20-
* @param modifier The modifier to be applied to the [FloatingActionButton].
2120
* @param onClick The callback when the [FloatingActionButton] is clicked.
21+
* @param modifier The modifier to be applied to the [FloatingActionButton].
2222
* @param shape The shape of the [FloatingActionButton].
2323
* @param containerColor The color of the [FloatingActionButton].
2424
* @param shadowElevation The shadow elevation of the [FloatingActionButton].
2525
* @param content The [Composable] content of the [FloatingActionButton].
2626
*/
2727
@Composable
2828
fun FloatingActionButton(
29-
modifier: Modifier = Modifier,
3029
onClick: () -> Unit,
30+
modifier: Modifier = Modifier,
3131
shape: Shape = RoundedCornerShape(60.dp),
3232
containerColor: Color = MiuixTheme.colorScheme.primary,
3333
shadowElevation: Float = 18f,

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/HorizontalPager.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import androidx.compose.ui.Modifier
1717
/**
1818
* A [HorizontalPager] component with Miuix style.
1919
*
20-
* @param modifier The modifier to be applied to the [HorizontalPager].
2120
* @param pagerState The state of the [HorizontalPager].
21+
* @param modifier The modifier to be applied to the [HorizontalPager].
2222
* @param beyondViewportPageCount The count of pages beyond the viewport.
2323
* @param defaultWindowInsetsPadding Whether to apply default window insets padding to the [HorizontalPager].
2424
* @param pageContent The content of the [HorizontalPager].
@@ -27,13 +27,13 @@ import androidx.compose.ui.Modifier
2727
*/
2828
@Composable
2929
fun HorizontalPager(
30-
modifier: Modifier = Modifier,
3130
pagerState: PagerState,
31+
modifier: Modifier = Modifier,
3232
beyondViewportPageCount: Int = 1,
3333
defaultWindowInsetsPadding: Boolean = true,
34-
pageContent: @Composable (pageIndex: Int) -> Unit,
3534
userScrollEnabled: Boolean = false,
36-
flingBehavior: TargetedFlingBehavior = PagerDefaults.flingBehavior(state = pagerState)
35+
flingBehavior: TargetedFlingBehavior = PagerDefaults.flingBehavior(state = pagerState),
36+
pageContent: @Composable (pageIndex: Int) -> Unit
3737
) {
3838
HorizontalPager(
3939
modifier =

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/NavigationBar.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ import top.yukonga.miuix.kmp.utils.platform
4444
/**
4545
* A [NavigationBar] that with 2 to 5 items.
4646
*
47-
* @param modifier The modifier to be applied to the [NavigationBar].
4847
* @param items The items of the [NavigationBar].
4948
* @param selected The selected index of the [NavigationBar].
50-
* @param color The color of the [NavigationBar].
5149
* @param onClick The callback when the item of the [NavigationBar] is clicked.
50+
* @param modifier The modifier to be applied to the [NavigationBar].
51+
* @param color The color of the [NavigationBar].
5252
* @param defaultWindowInsetsPadding whether to apply default window insets padding to the [NavigationBar].
5353
*/
5454
@Composable
5555
fun NavigationBar(
56-
modifier: Modifier = Modifier,
5756
items: List<NavigationItem>,
5857
selected: Int,
59-
color: Color = MiuixTheme.colorScheme.surfaceContainer,
6058
onClick: (Int) -> Unit,
59+
modifier: Modifier = Modifier,
60+
color: Color = MiuixTheme.colorScheme.surfaceContainer,
6161
defaultWindowInsetsPadding: Boolean = true
6262
) {
6363
require(items.size in 2..5) { "BottomBar must have between 2 and 5 items" }

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/SearchBar.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
3737
/**
3838
* A [SearchBar] component with Miuix style.
3939
*
40-
* @param modifier the [Modifier] to be applied to the [SearchBar].
4140
* @param inputField the input field to input a query in the [SearchBar].
42-
* @param expanded whether the [SearchBar] is expanded and showing search results.
4341
* @param onExpandedChange the callback to be invoked when the [SearchBar]'s expanded state is
4442
* changed.
43+
* @param modifier the [Modifier] to be applied to the [SearchBar].
44+
* @param expanded whether the [SearchBar] is expanded and showing search results.
4545
* @param outsideRightAction the action to be shown at the right side of the [SearchBar] when it is
4646
* expanded.
4747
* @param content the content to be shown when the [SearchBar] is expanded.
4848
*/
4949
@Composable
5050
fun SearchBar(
51-
modifier: Modifier = Modifier,
5251
inputField: @Composable () -> Unit,
53-
expanded: Boolean = false,
5452
onExpandedChange: (Boolean) -> Unit,
53+
modifier: Modifier = Modifier,
54+
expanded: Boolean = false,
5555
outsideRightAction: @Composable (() -> Unit)? = null,
5656
content: @Composable ColumnScope.() -> Unit
5757
) {

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Slider.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@ import kotlin.math.round
3131
/**
3232
* A [Slider] component with Miuix style.
3333
*
34-
* @param modifier The modifier to be applied to the [Slider].
3534
* @param progress The current progress of the [Slider].
35+
* @param onProgressChange The callback to be called when the progress changes.
36+
* @param modifier The modifier to be applied to the [Slider].
3637
* @param enabled Whether the [Slider] is enabled.
3738
* @param minValue The minimum value of the [Slider]. It is required
3839
* that [minValue] < [maxValue].
3940
* @param maxValue The maximum value of the [Slider].
4041
* @param height The height of the [Slider].
4142
* @param effect Whether to show the effect of the [Slider].
4243
* @param decimalPlaces The number of decimal places to be displayed in the drag indicator.
43-
* @param onProgressChange The callback to be called when the progress changes.
4444
*/
4545
@Composable
4646
fun Slider(
47-
modifier: Modifier = Modifier,
4847
progress: Float,
48+
onProgressChange: (Float) -> Unit,
49+
modifier: Modifier = Modifier,
4950
enabled: Boolean = true,
5051
minValue: Float = 0f,
5152
maxValue: Float = 1f,
5253
height: Dp = 30.dp,
5354
effect: Boolean = false,
54-
decimalPlaces: Int = 2,
55-
onProgressChange: (Float) -> Unit
55+
decimalPlaces: Int = 2
5656
) {
5757
val hapticFeedback = LocalHapticFeedback.current
5858
var dragOffset by remember { mutableStateOf(0f) }

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/SmallTitle.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import top.yukonga.miuix.kmp.theme.MiuixTheme
1313
/**
1414
* A [SmallTitle] with Miuix style.
1515
*
16-
* @param modifier The modifier to be applied to the [SmallTitle].
1716
* @param text The text to be displayed in the [SmallTitle].
17+
* @param modifier The modifier to be applied to the [SmallTitle].
1818
* @param textColor The color of the [SmallTitle].
1919
* @param insideMargin The margin inside the [SmallTitle].
2020
*/
2121
@Composable
2222
fun SmallTitle(
23-
modifier: Modifier = Modifier,
2423
text: String,
24+
modifier: Modifier = Modifier,
2525
textColor: Color = MiuixTheme.colorScheme.onBackgroundVariant,
2626
insideMargin: DpSize = DpSize(28.dp, 8.dp),
2727
) {

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Surface.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ fun Surface(
5252
/**
5353
* A [Surface] component with Miuix style.
5454
*
55-
* @param modifier The modifier to be applied to the [Surface].
5655
* @param onClick The callback when the [Surface] is clicked.
56+
* @param modifier The modifier to be applied to the [Surface].
5757
* @param enabled Whether the [Surface] is enabled.
5858
* @param shape The shape of the [Surface].
5959
* @param color The color of the [Surface].
@@ -64,8 +64,8 @@ fun Surface(
6464
@Composable
6565
@NonRestartableComposable
6666
fun Surface(
67-
modifier: Modifier = Modifier,
6867
onClick: () -> Unit,
68+
modifier: Modifier = Modifier,
6969
enabled: Boolean = true,
7070
shape: Shape = RectangleShape,
7171
color: Color = MiuixTheme.colorScheme.background,

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Switch.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ import kotlin.math.absoluteValue
3636
/**
3737
* A [Switch] component with Miuix style.
3838
*
39-
* @param modifier The modifier to be applied to the [Switch].
4039
* @param checked The checked state of the [Switch].
4140
* @param onCheckedChange The callback to be called when the state of the [Switch] changes.
41+
* @param modifier The modifier to be applied to the [Switch].
4242
* @param enabled Whether the [Switch] is enabled.
4343
*/
4444
@Composable
4545
fun Switch(
46-
modifier: Modifier = Modifier,
4746
checked: Boolean,
4847
onCheckedChange: ((Boolean) -> Unit)?,
48+
modifier: Modifier = Modifier,
4949
enabled: Boolean = true
5050
) {
5151
val isChecked by rememberUpdatedState(checked)

0 commit comments

Comments
 (0)