Don't apply the gap when we don't have any items in the first row
This commit is contained in:
parent
bc479af2c1
commit
53b608378c
1 changed files with 6 additions and 3 deletions
|
@ -102,16 +102,19 @@ impl Render for Toolbar {
|
||||||
|
|
||||||
let secondary_item = self.secondary_items().next().map(|item| item.to_any());
|
let secondary_item = self.secondary_items().next().map(|item| item.to_any());
|
||||||
|
|
||||||
|
let has_left_items = self.left_items().count() > 0;
|
||||||
|
let has_right_items = self.right_items().count() > 0;
|
||||||
|
|
||||||
v_stack()
|
v_stack()
|
||||||
.p_1()
|
.p_1()
|
||||||
.gap_2()
|
.when(has_left_items || has_right_items, |this| this.gap_2())
|
||||||
.border_b()
|
.border_b()
|
||||||
.border_color(cx.theme().colors().border_variant)
|
.border_color(cx.theme().colors().border_variant)
|
||||||
.bg(cx.theme().colors().toolbar_background)
|
.bg(cx.theme().colors().toolbar_background)
|
||||||
.child(
|
.child(
|
||||||
h_stack()
|
h_stack()
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.when(self.left_items().count() > 0, |this| {
|
.when(has_left_items, |this| {
|
||||||
this.child(
|
this.child(
|
||||||
h_stack()
|
h_stack()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
|
@ -119,7 +122,7 @@ impl Render for Toolbar {
|
||||||
.children(self.left_items().map(|item| item.to_any())),
|
.children(self.left_items().map(|item| item.to_any())),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.when(self.right_items().count() > 0, |this| {
|
.when(has_right_items, |this| {
|
||||||
this.child(
|
this.child(
|
||||||
h_stack()
|
h_stack()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue