pub struct FavoriteToggle { /* private fields */ }Expand description
A heart that marks something as a favorite: filled when on, an outline when off.
use ravenrs_reactive::State;
use ravenrs_widgets::FavoriteToggle;
let liked = State::new(false);
let heart = FavoriteToggle::new(liked.binding()).label("Warm portrait");Implementations§
Source§impl FavoriteToggle
impl FavoriteToggle
Sourcepub fn new(value: Binding<bool>) -> FavoriteToggle
pub fn new(value: Binding<bool>) -> FavoriteToggle
A heart bound to value; clicking flips it.
Sourcepub fn label(self, label: impl Into<String>) -> FavoriteToggle
pub fn label(self, label: impl Into<String>) -> FavoriteToggle
What it marks, for screen readers, instead of the word in Labels.
Sourcepub fn star(self) -> FavoriteToggle
pub fn star(self) -> FavoriteToggle
A star instead of a heart.
Sourcepub fn size(self, size: f32) -> FavoriteToggle
pub fn size(self, size: f32) -> FavoriteToggle
Sets the size of the mark in logical pixels (16 by default). The target around it follows.
Sourcepub fn color(self, color: Color) -> FavoriteToggle
pub fn color(self, color: Color) -> FavoriteToggle
Sets the color when on (the danger tone for a heart, the warning tone for a star).
Trait Implementations§
Source§impl Debug for FavoriteToggle
impl Debug for FavoriteToggle
Auto Trait Implementations§
impl !RefUnwindSafe for FavoriteToggle
impl !Send for FavoriteToggle
impl !Sync for FavoriteToggle
impl !UnwindSafe for FavoriteToggle
impl Freeze for FavoriteToggle
impl Unpin for FavoriteToggle
impl UnsafeUnpin for FavoriteToggle
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.