Skip to content

Commit

Permalink
Fix inconsistency in margin application between ComposeUiBox and `V…
Browse files Browse the repository at this point in the history
…iewBox` (#2478)

Relates to #2367

In compose ui, modifier order matters and applying padding before a background prevents the background from filling the box.
  • Loading branch information
luis-cortes authored Nov 21, 2024
1 parent d496ac0 commit 365b927
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Changed:
- Nothing yet!

Fixed:
- Nothing yet!
- Fix inconsistency in margin application between `ComposeUiBox` and `ViewBox`.


## [0.16.0] - 2024-11-19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ internal class ComposeUiBox(
} else {
modifier.wrapContentHeight(Alignment.Top, unbounded = true)
}
if (backgroundColor != 0) {
modifier = modifier.background(Color(backgroundColor))
}
modifier = margin.let { margin ->
modifier.padding(
start = margin.start.toDp(),
Expand All @@ -158,9 +161,6 @@ internal class ComposeUiBox(
bottom = margin.bottom.toDp(),
)
}
if (backgroundColor != 0) {
modifier = modifier.background(Color(backgroundColor))
}
return modifier
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 365b927

Please sign in to comment.