Skip to content

Commit f883d99

Browse files
committed
Added text_color for native checkbox
1 parent e41ffdc commit f883d99

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

native/src/widget/checkbox.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::row;
88
use crate::text;
99
use crate::touch;
1010
use crate::{
11-
Align, Clipboard, Element, Hasher, HorizontalAlignment, Layout, Length,
11+
Align, Clipboard, Color, Element, Hasher, HorizontalAlignment, Layout, Length,
1212
Point, Rectangle, Row, Text, VerticalAlignment, Widget,
1313
};
1414

@@ -39,6 +39,7 @@ pub struct Checkbox<Message, Renderer: self::Renderer + text::Renderer> {
3939
spacing: u16,
4040
text_size: Option<u16>,
4141
font: Renderer::Font,
42+
text_color: Option<Color>,
4243
style: Renderer::Style,
4344
}
4445

@@ -66,6 +67,7 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
6667
spacing: Renderer::DEFAULT_SPACING,
6768
text_size: None,
6869
font: Renderer::Font::default(),
70+
text_color: None,
6971
style: Renderer::Style::default(),
7072
}
7173
}
@@ -102,6 +104,12 @@ impl<Message, Renderer: self::Renderer + text::Renderer>
102104
self
103105
}
104106

107+
/// Sets the text color of the [`Checkbox`] button.
108+
pub fn text_color(mut self, color: Color) -> Self {
109+
self.text_color = Some(color);
110+
self
111+
}
112+
105113
/// Sets the style of the [`Checkbox`].
106114
pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self {
107115
self.style = style.into();
@@ -193,7 +201,7 @@ where
193201
&self.label,
194202
self.text_size.unwrap_or(renderer.default_size()),
195203
self.font,
196-
None,
204+
self.text_color,
197205
HorizontalAlignment::Left,
198206
VerticalAlignment::Center,
199207
);

0 commit comments

Comments
 (0)