summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anton Potapov <apotapov@google.com> 2024-08-14 14:11:14 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-08-14 14:11:14 +0000
commitddc9625954f4866f2b45e46486322190013cab58 (patch)
treec5bbdd087495e69cf67b2d014ffc8be6cc355d9c
parentbf49ff4a99693297bc8c9746867c4cc1ba2ffcd0 (diff)
parent4c1ef76413f279ea1baf7e410e2b0e17caf0c9de (diff)
Merge "Change show PlatformButtons apply height restrictions" into main
-rw-r--r--packages/SystemUI/compose/core/src/com/android/compose/PlatformButtons.kt11
1 files changed, 3 insertions, 8 deletions
diff --git a/packages/SystemUI/compose/core/src/com/android/compose/PlatformButtons.kt b/packages/SystemUI/compose/core/src/com/android/compose/PlatformButtons.kt
index a18b460cb168..a5f8057b524f 100644
--- a/packages/SystemUI/compose/core/src/com/android/compose/PlatformButtons.kt
+++ b/packages/SystemUI/compose/core/src/com/android/compose/PlatformButtons.kt
@@ -21,8 +21,7 @@ import androidx.annotation.DrawableRes
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
-import androidx.compose.foundation.layout.height
-import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.heightIn
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
@@ -32,7 +31,6 @@ import androidx.compose.material3.IconButtonDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
-import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.android.compose.theme.LocalAndroidColorScheme
@@ -42,11 +40,10 @@ fun PlatformButton(
modifier: Modifier = Modifier,
enabled: Boolean = true,
colors: ButtonColors = filledButtonColors(),
- verticalPadding: Dp = DefaultPlatformButtonVerticalPadding,
content: @Composable RowScope.() -> Unit,
) {
androidx.compose.material3.Button(
- modifier = modifier.padding(vertical = verticalPadding).height(36.dp),
+ modifier = modifier.heightIn(min = 36.dp),
colors = colors,
contentPadding = ButtonPaddings,
onClick = onClick,
@@ -63,11 +60,10 @@ fun PlatformOutlinedButton(
enabled: Boolean = true,
colors: ButtonColors = outlineButtonColors(),
border: BorderStroke? = outlineButtonBorder(),
- verticalPadding: Dp = DefaultPlatformButtonVerticalPadding,
content: @Composable RowScope.() -> Unit,
) {
androidx.compose.material3.OutlinedButton(
- modifier = modifier.padding(vertical = verticalPadding).height(36.dp),
+ modifier = modifier.heightIn(min = 36.dp),
enabled = enabled,
colors = colors,
border = border,
@@ -118,7 +114,6 @@ fun PlatformIconButton(
}
}
-private val DefaultPlatformButtonVerticalPadding = 6.dp
private val ButtonPaddings = PaddingValues(horizontal = 16.dp, vertical = 8.dp)
@Composable