Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c1ef764 authored by Anton Potapov's avatar Anton Potapov
Browse files

Change show PlatformButtons apply height restrictions

This is how the original material components do it. Settings min height
allows buttons to grow to accomodate the scaled text.

Flag: EXEMPT bugfix
Fixes: 358004012
Test: manual on the foldable
Test: atest VolumePanelScreenshotTest
Change-Id: Iddff6d70e659b6150030704e14d314ef88d6e5bc
parent 40e7272d
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -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