feat(icon): add opacity method
This commit is contained in:
parent
0eef591171
commit
ef162b8e16
1 changed files with 4 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ pub fn icon(handle: Handle) -> Icon {
|
||||||
handle,
|
handle,
|
||||||
height: None,
|
height: None,
|
||||||
size: 16,
|
size: 16,
|
||||||
|
opacity: 1.0,
|
||||||
class: crate::theme::Svg::default(),
|
class: crate::theme::Svg::default(),
|
||||||
rotation: None,
|
rotation: None,
|
||||||
width: None,
|
width: None,
|
||||||
|
|
@ -45,6 +46,7 @@ pub struct Icon {
|
||||||
class: crate::theme::Svg,
|
class: crate::theme::Svg,
|
||||||
#[setters(skip)]
|
#[setters(skip)]
|
||||||
pub(super) size: u16,
|
pub(super) size: u16,
|
||||||
|
opacity: f32,
|
||||||
content_fit: ContentFit,
|
content_fit: ContentFit,
|
||||||
#[setters(strip_option)]
|
#[setters(strip_option)]
|
||||||
width: Option<Length>,
|
width: Option<Length>,
|
||||||
|
|
@ -65,7 +67,6 @@ impl Icon {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
|
||||||
pub fn size(mut self, size: u16) -> Self {
|
pub fn size(mut self, size: u16) -> Self {
|
||||||
self.size = size;
|
self.size = size;
|
||||||
self
|
self
|
||||||
|
|
@ -83,6 +84,7 @@ impl Icon {
|
||||||
self.height
|
self.height
|
||||||
.unwrap_or_else(|| Length::Fixed(f32::from(self.size))),
|
.unwrap_or_else(|| Length::Fixed(f32::from(self.size))),
|
||||||
)
|
)
|
||||||
|
.opacity(self.opacity)
|
||||||
.rotation(self.rotation.unwrap_or_default())
|
.rotation(self.rotation.unwrap_or_default())
|
||||||
.content_fit(self.content_fit)
|
.content_fit(self.content_fit)
|
||||||
.into()
|
.into()
|
||||||
|
|
@ -99,6 +101,7 @@ impl Icon {
|
||||||
self.height
|
self.height
|
||||||
.unwrap_or_else(|| Length::Fixed(f32::from(self.size))),
|
.unwrap_or_else(|| Length::Fixed(f32::from(self.size))),
|
||||||
)
|
)
|
||||||
|
.opacity(self.opacity)
|
||||||
.rotation(self.rotation.unwrap_or_default())
|
.rotation(self.rotation.unwrap_or_default())
|
||||||
.content_fit(self.content_fit)
|
.content_fit(self.content_fit)
|
||||||
.symbolic(self.handle.symbolic)
|
.symbolic(self.handle.symbolic)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue