Add missing Material 3 butttons

This commit is contained in:
Wolf-Martell Montwé 2024-04-25 13:27:43 +02:00
parent 1535335eec
commit 6abbc6aedd
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72

View file

@ -6,16 +6,21 @@ import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.lazy.grid.LazyGridScope import androidx.compose.foundation.lazy.grid.LazyGridScope
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonElevated
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonFilled import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonFilled
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonFilledTonal
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonIcon
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonOutlined import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonOutlined
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonText
import app.k9mail.core.ui.compose.designsystem.atom.icon.Icons
import app.k9mail.core.ui.compose.theme2.MainTheme import app.k9mail.core.ui.compose.theme2.MainTheme
import app.k9mail.ui.catalog.ui.common.list.itemDefaultPadding import app.k9mail.ui.catalog.ui.common.list.itemDefaultPadding
import app.k9mail.ui.catalog.ui.common.list.sectionHeaderItem import app.k9mail.ui.catalog.ui.common.list.sectionHeaderItem
@Suppress("LongMethod")
@OptIn(ExperimentalLayoutApi::class) @OptIn(ExperimentalLayoutApi::class)
fun LazyGridScope.buttonItems() { fun LazyGridScope.buttonItems() {
sectionHeaderItem(text = "Buttons - Filled") sectionHeaderItem(text = "Button - Filled")
item { item {
FlowRow( FlowRow(
horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default), horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
@ -25,7 +30,27 @@ fun LazyGridScope.buttonItems() {
ButtonFilled(text = "Disabled", onClick = { }, enabled = false) ButtonFilled(text = "Disabled", onClick = { }, enabled = false)
} }
} }
sectionHeaderItem(text = "Buttons - Outlined") sectionHeaderItem(text = "Button - Filled Tonal")
item {
FlowRow(
horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
modifier = Modifier.itemDefaultPadding(),
) {
ButtonFilledTonal(text = "Enabled", onClick = { })
ButtonFilledTonal(text = "Disabled", onClick = { }, enabled = false)
}
}
sectionHeaderItem(text = "Button - Elevated")
item {
FlowRow(
horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
modifier = Modifier.itemDefaultPadding(),
) {
ButtonElevated(text = "Enabled", onClick = { })
ButtonElevated(text = "Disabled", onClick = { }, enabled = false)
}
}
sectionHeaderItem(text = "Button - Outlined")
item { item {
FlowRow( FlowRow(
horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default), horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
@ -35,7 +60,7 @@ fun LazyGridScope.buttonItems() {
ButtonOutlined(text = "Disabled", onClick = { }, enabled = false) ButtonOutlined(text = "Disabled", onClick = { }, enabled = false)
} }
} }
sectionHeaderItem(text = "Buttons - Text only") sectionHeaderItem(text = "Button - Text")
item { item {
FlowRow( FlowRow(
horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default), horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
@ -46,4 +71,14 @@ fun LazyGridScope.buttonItems() {
ButtonText(text = "Disabled", onClick = { }, enabled = false) ButtonText(text = "Disabled", onClick = { }, enabled = false)
} }
} }
sectionHeaderItem(text = "Button - Icon")
item {
FlowRow(
horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.default),
modifier = Modifier.itemDefaultPadding(),
) {
ButtonIcon(onClick = { }, imageVector = Icons.Outlined.celebration)
ButtonIcon(onClick = { }, imageVector = Icons.Outlined.celebration, enabled = false)
}
}
} }