Skip to main content

ButtonSegment

Struct ButtonSegment 

Source
pub struct ButtonSegment<T> {
    pub value: T,
    pub icon: Option<WidgetRef>,
    pub label: Option<WidgetRef>,
    pub tooltip: Option<String>,
    pub enabled: bool,
}
Expand description

Data describing a segment of a SegmentedButton.

Two segments are equal when their fields are: their widgets by identity. Where Dart compares two segments by identity, a SegmentedButton matches the segments of a rebuild by value, which must be unique.

Fields§

§value: T

Value used to identify the segment.

This value must be unique across all segments in a SegmentedButton.

§icon: Option<WidgetRef>

Optional icon displayed in the segment.

§label: Option<WidgetRef>

Optional label displayed in the segment.

§tooltip: Option<String>

Optional tooltip for the segment

§enabled: bool

Determines if the segment is available for selection.

Implementations§

Source§

impl<T> ButtonSegment<T>

Source

pub fn new(value: T) -> ButtonSegment<T>

Construct a ButtonSegment.

One of icon or label must be non-null, which SegmentedButton asserts when it is built into a widget.

Source

pub fn icon<K>(self, icon: impl IntoWidget<K>) -> ButtonSegment<T>

Dart ButtonSegment(icon:).

Source

pub fn label<K>(self, label: impl IntoWidget<K>) -> ButtonSegment<T>

Dart ButtonSegment(label:).

Source

pub fn tooltip(self, tooltip: impl Into<String>) -> ButtonSegment<T>

Dart ButtonSegment(tooltip:).

Source

pub fn enabled(self, enabled: bool) -> ButtonSegment<T>

Dart ButtonSegment(enabled:).

Trait Implementations§

Source§

impl<T: Clone> Clone for ButtonSegment<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for ButtonSegment<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq> PartialEq for ButtonSegment<T>

Source§

fn eq(&self, other: &ButtonSegment<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for ButtonSegment<T>

§

impl<T> !Send for ButtonSegment<T>

§

impl<T> !Sync for ButtonSegment<T>

§

impl<T> !UnwindSafe for ButtonSegment<T>

§

impl<T> Forget for ButtonSegment<T>

§

impl<T> Freeze for ButtonSegment<T>
where T: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl<T> Move for ButtonSegment<T>

§

impl<T> Unpin for ButtonSegment<T>
where T: Unpin, Rc<dyn Widget>: Unpin, *const u8 is !null: Unpin,

§

impl<T> UnsafeUnpin for ButtonSegment<T>
where T: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>