diff options
author | 2021-05-19 07:14:26 -0700 | |
---|---|---|
committer | 2021-05-19 07:14:26 -0700 | |
commit | ae484429d30a3360893d030a17e52caa4164a052 (patch) | |
tree | 4bfe30d3b46c7e30170e0b495d9a4dd1a2a1825f /native/src/widget/checkbox.rs | |
parent | cf6af4c2560f5996bc533402ac3e4289c0c94702 (diff) | |
parent | 3918257883dba3cf260bd9764cb7b34101c435e6 (diff) | |
download | iced-ae484429d30a3360893d030a17e52caa4164a052.tar.gz iced-ae484429d30a3360893d030a17e52caa4164a052.tar.bz2 iced-ae484429d30a3360893d030a17e52caa4164a052.zip |
Merge branch 'hecrj:master' into upgrade-wgpu
Diffstat (limited to 'native/src/widget/checkbox.rs')
-rw-r--r-- | native/src/widget/checkbox.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs index 6ce2e973..0f21c873 100644 --- a/native/src/widget/checkbox.rs +++ b/native/src/widget/checkbox.rs @@ -8,8 +8,8 @@ use crate::row; use crate::text; use crate::touch; use crate::{ - Align, Clipboard, Element, Hasher, HorizontalAlignment, Layout, Length, - Point, Rectangle, Row, Text, VerticalAlignment, Widget, + Align, Clipboard, Color, Element, Hasher, HorizontalAlignment, Layout, + Length, Point, Rectangle, Row, Text, VerticalAlignment, Widget, }; /// A box that can be checked. @@ -39,6 +39,7 @@ pub struct Checkbox<Message, Renderer: self::Renderer + text::Renderer> { spacing: u16, text_size: Option<u16>, font: Renderer::Font, + text_color: Option<Color>, style: Renderer::Style, } @@ -66,6 +67,7 @@ impl<Message, Renderer: self::Renderer + text::Renderer> spacing: Renderer::DEFAULT_SPACING, text_size: None, font: Renderer::Font::default(), + text_color: None, style: Renderer::Style::default(), } } @@ -102,6 +104,12 @@ impl<Message, Renderer: self::Renderer + text::Renderer> self } + /// Sets the text color of the [`Checkbox`] button. + pub fn text_color(mut self, color: Color) -> Self { + self.text_color = Some(color); + self + } + /// Sets the style of the [`Checkbox`]. pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); @@ -193,7 +201,7 @@ where &self.label, self.text_size.unwrap_or(renderer.default_size()), self.font, - None, + self.text_color, HorizontalAlignment::Left, VerticalAlignment::Center, ); |