form: Fix form label required not in same line. (#1013)

![image](https://github.com/user-attachments/assets/2435e099-4d92-4a52-a825-d7b23e27e5d1)
This commit is contained in:
Jason Lee 2025-06-25 22:30:09 +08:00 committed by GitHub
parent f7d536531d
commit 819161ec58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -377,13 +377,15 @@ impl RenderOnce for FormField {
.gap_1() .gap_1()
.items_center() .items_center()
.when_some(self.label, |this, builder| { .when_some(self.label, |this, builder| {
this.child(builder.render(window, cx)).when( this.child(
h_flex().gap_1().child(builder.render(window, cx)).when(
self.required, self.required,
|this| { |this| {
this.child( this.child(
div().text_color(cx.theme().danger).child("*"), div().text_color(cx.theme().danger).child("*"),
) )
}, },
),
) )
}), }),
) )