Skip to content

Commit 495dd22

Browse files
committed
fix: apply padding before fill width
1 parent 8d825fe commit 495dd22

File tree

1 file changed

+13
-6
lines changed
  • app/src/main/java/to/bitkit/ui/components

1 file changed

+13
-6
lines changed

app/src/main/java/to/bitkit/ui/components/Button.kt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fun PrimaryButton(
7575
),
7676
contentPadding = contentPadding,
7777
shape = buttonShape,
78-
modifier = Modifier
78+
modifier = modifier
7979
.then(if (fullWidth) Modifier.fillMaxWidth() else Modifier)
8080
.requiredHeight(size.height)
8181
.primaryButtonStyle(
@@ -84,7 +84,6 @@ fun PrimaryButton(
8484
primaryColor = color
8585
)
8686
.alphaFeedback(enabled = enabled && !isLoading)
87-
.then(modifier)
8887
) {
8988
if (isLoading) {
9089
CircularProgressIndicator(
@@ -141,10 +140,9 @@ fun SecondaryButton(
141140
colors = AppButtonDefaults.secondaryColors,
142141
contentPadding = contentPadding,
143142
border = border,
144-
modifier = Modifier
143+
modifier = modifier
145144
.then(if (fullWidth) Modifier.fillMaxWidth() else Modifier)
146145
.requiredHeight(size.height)
147-
.then(modifier)
148146
) {
149147
if (isLoading) {
150148
CircularProgressIndicator(
@@ -199,10 +197,9 @@ fun TertiaryButton(
199197
enabled = enabled && !isLoading,
200198
colors = AppButtonDefaults.tertiaryColors,
201199
contentPadding = contentPadding,
202-
modifier = Modifier
200+
modifier = modifier
203201
.then(if (fullWidth) Modifier.fillMaxWidth() else Modifier)
204202
.requiredHeight(size.height)
205-
.then(modifier)
206203
) {
207204
if (isLoading) {
208205
CircularProgressIndicator(
@@ -252,6 +249,11 @@ private fun PrimaryButtonPreview() {
252249
text = "Primary",
253250
onClick = {},
254251
)
252+
PrimaryButton(
253+
text = "Primary with padding",
254+
modifier = Modifier.padding(horizontal = 32.dp),
255+
onClick = {},
256+
)
255257
PrimaryButton(
256258
text = "Primary With Icon",
257259
onClick = {},
@@ -373,6 +375,11 @@ private fun SecondaryButtonPreview() {
373375
text = "Secondary",
374376
onClick = {},
375377
)
378+
SecondaryButton(
379+
text = "Secondary With padding",
380+
modifier = Modifier.padding(horizontal = 32.dp),
381+
onClick = {},
382+
)
376383
SecondaryButton(
377384
text = "Secondary With Icon",
378385
onClick = {},

0 commit comments

Comments
 (0)