From 216350ae63f7c6597219d182ea642154d2724637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf=20Montwe=CC=81?= Date: Fri, 31 Mar 2023 18:13:55 +0200 Subject: [PATCH] Add ButtonDefaults that replaces the Material 2 one to allow changes of PaddingValues --- .../ui/compose/designsystem/atom/button/Button.kt | 2 +- .../designsystem/atom/button/ButtonDefaults.kt | 13 +++++++++++++ .../designsystem/atom/button/ButtonOutlined.kt | 2 +- .../compose/designsystem/atom/button/ButtonText.kt | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonDefaults.kt diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/Button.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/Button.kt index 5f96bb075..4b9754d1d 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/Button.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/Button.kt @@ -15,7 +15,7 @@ fun Button( onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, - contentPadding: PaddingValues = ButtonDefaults.ContentPadding, + contentPadding: PaddingValues = buttonContentPadding(), ) { MaterialButton( onClick = onClick, diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonDefaults.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonDefaults.kt new file mode 100644 index 000000000..346441e9f --- /dev/null +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonDefaults.kt @@ -0,0 +1,13 @@ +package app.k9mail.core.ui.compose.designsystem.atom.button + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.runtime.Composable +import app.k9mail.core.ui.compose.theme.MainTheme + +@Composable +fun buttonContentPadding(): PaddingValues = PaddingValues( + start = MainTheme.spacings.quadruple, + top = MainTheme.spacings.default, + end = MainTheme.spacings.quadruple, + bottom = MainTheme.spacings.default, +) diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonOutlined.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonOutlined.kt index 8768d8d8f..70cc9e12b 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonOutlined.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonOutlined.kt @@ -18,7 +18,7 @@ fun ButtonOutlined( onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, - contentPadding: PaddingValues = ButtonDefaults.ContentPadding, + contentPadding: PaddingValues = buttonContentPadding(), ) { MaterialOutlinedButton( onClick = onClick, diff --git a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonText.kt b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonText.kt index 777bd14bd..2ab02ca07 100644 --- a/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonText.kt +++ b/core/ui/compose/designsystem/src/main/kotlin/app/k9mail/core/ui/compose/designsystem/atom/button/ButtonText.kt @@ -15,7 +15,7 @@ fun ButtonText( onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, - contentPadding: PaddingValues = ButtonDefaults.ContentPadding, + contentPadding: PaddingValues = buttonContentPadding(), ) { MaterialTextButton( onClick = onClick,