Skip to content

Commit 2ece2da

Browse files
authored
Merge pull request #34 from HowieHChen/main
library: Limit the size of rightText/value
2 parents de38e97 + 0b42f96 commit 2ece2da

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import androidx.compose.foundation.Image
44
import androidx.compose.foundation.layout.PaddingValues
55
import androidx.compose.foundation.layout.padding
66
import androidx.compose.foundation.layout.size
7+
import androidx.compose.foundation.layout.widthIn
78
import androidx.compose.runtime.Composable
89
import androidx.compose.runtime.Immutable
910
import androidx.compose.runtime.Stable
@@ -13,6 +14,7 @@ import androidx.compose.ui.Modifier
1314
import androidx.compose.ui.graphics.Color
1415
import androidx.compose.ui.graphics.ColorFilter
1516
import androidx.compose.ui.text.style.TextAlign
17+
import androidx.compose.ui.text.style.TextOverflow
1618
import androidx.compose.ui.unit.dp
1719
import top.yukonga.miuix.kmp.basic.BasicComponent
1820
import top.yukonga.miuix.kmp.basic.BasicComponentColors
@@ -64,10 +66,13 @@ fun SuperArrow(
6466
rightActions = {
6567
if (rightText != null) {
6668
Text(
69+
modifier = Modifier.widthIn(max = 130.dp),
6770
text = rightText,
6871
fontSize = MiuixTheme.textStyles.body2.fontSize,
6972
color = rightActionColor.color(enabled),
7073
textAlign = TextAlign.End,
74+
overflow = TextOverflow.Ellipsis,
75+
maxLines = 2
7176
)
7277
}
7378
Image(

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import androidx.compose.ui.text.TextStyle
5757
import androidx.compose.ui.text.font.FontWeight
5858
import androidx.compose.ui.text.rememberTextMeasurer
5959
import androidx.compose.ui.text.style.TextAlign
60+
import androidx.compose.ui.text.style.TextOverflow
6061
import androidx.compose.ui.unit.Dp
6162
import androidx.compose.ui.unit.LayoutDirection
6263
import androidx.compose.ui.unit.dp
@@ -180,6 +181,8 @@ fun SuperDropdown(
180181
fontSize = MiuixTheme.textStyles.body2.fontSize,
181182
color = actionColor,
182183
textAlign = TextAlign.End,
184+
overflow = TextOverflow.Ellipsis,
185+
maxLines = 2
183186
)
184187
}
185188
Image(

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import androidx.compose.ui.platform.LocalDensity
5656
import androidx.compose.ui.platform.LocalHapticFeedback
5757
import androidx.compose.ui.text.font.FontWeight
5858
import androidx.compose.ui.text.style.TextAlign
59+
import androidx.compose.ui.text.style.TextOverflow
5960
import androidx.compose.ui.unit.Dp
6061
import androidx.compose.ui.unit.DpSize
6162
import androidx.compose.ui.unit.IntOffset
@@ -185,6 +186,8 @@ fun SuperSpinner(
185186
fontSize = MiuixTheme.textStyles.body2.fontSize,
186187
color = actionColor,
187188
textAlign = TextAlign.End,
189+
overflow = TextOverflow.Ellipsis,
190+
maxLines = 2
188191
)
189192
}
190193
Image(
@@ -353,10 +356,8 @@ fun SuperSpinner(
353356
* @param titleColor the color of the title of the [SuperSpinner].
354357
* @param summary the summary of the [SuperSpinner].
355358
* @param summaryColor the color of the summary of the [SuperSpinner].
356-
* @param horizontalPadding the horizontal padding of the [SuperSpinner].
357359
* @param leftAction the action to be shown at the left side of the [SuperSpinner].
358360
* @param insideMargin the [PaddingValues] to be applied inside the [SuperSpinner].
359-
* @param defaultWindowInsetsPadding whether to apply the default window insets padding to the [SuperSpinner].
360361
* @param enabled whether the [SuperSpinner] is enabled.
361362
* @param showValue whether to show the value of the [SuperSpinner].
362363
* @param onSelectedIndexChange the callback to be invoked when the selected index of the [SuperSpinner] is changed.
@@ -372,10 +373,8 @@ fun SuperSpinner(
372373
titleColor: BasicComponentColors = BasicComponentDefaults.titleColor(),
373374
summary: String? = null,
374375
summaryColor: BasicComponentColors = BasicComponentDefaults.summaryColor(),
375-
horizontalPadding: Dp = 0.dp,
376376
leftAction: @Composable (() -> Unit)? = null,
377377
insideMargin: PaddingValues = BasicComponentDefaults.InsideMargin,
378-
defaultWindowInsetsPadding: Boolean = true,
379378
enabled: Boolean = true,
380379
showValue: Boolean = true,
381380
onSelectedIndexChange: ((Int) -> Unit)?,
@@ -444,6 +443,8 @@ fun SuperSpinner(
444443
fontSize = MiuixTheme.textStyles.body2.fontSize,
445444
color = actionColor,
446445
textAlign = TextAlign.End,
446+
overflow = TextOverflow.Ellipsis,
447+
maxLines = 2
447448
)
448449
}
449450
Image(

0 commit comments

Comments
 (0)