From d0abcb24561c12721eed2c47742c38d3197887a1 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 11 Mar 2025 20:55:58 +0800 Subject: [PATCH] switch: Fix switch label to vertical center. (#710) image --- crates/ui/src/switch.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/ui/src/switch.rs b/crates/ui/src/switch.rs index 2ec4c353..e9727b1b 100644 --- a/crates/ui/src/switch.rs +++ b/crates/ui/src/switch.rs @@ -203,9 +203,11 @@ impl Element for Switch { ), ) .when_some(self.label.take(), |this, label| { - this.child(div().child(label).map(|this| match self.size { - Size::XSmall | Size::Small => this.text_sm(), - _ => this.text_base(), + this.child(div().line_height(bg_height).child(label).map(|this| { + match self.size { + Size::XSmall | Size::Small => this.text_sm(), + _ => this.text_base(), + } })) }) .when_some(