Skip to main content

ExpandIcon

Struct ExpandIcon 

Source
pub struct ExpandIcon {
    pub key: Option<KeyRef>,
    pub is_expanded: bool,
    pub size: f64,
    pub on_pressed: Option<ValueChanged<bool>>,
    pub padding: EdgeInsetsGeometry,
    pub color: Option<Color>,
    pub disabled_color: Option<Color>,
    pub expanded_color: Option<Color>,
    pub splash_color: Option<Color>,
    pub highlight_color: Option<Color>,
}
Expand description

A widget representing a rotating expand/collapse button. The icon rotates 180 degrees when pressed, then reverts the animation on a second press. The underlying icon is Icons::expand_more.

The expand icon does not include a semantic label for accessibility. In order to be accessible it should be combined with a label using MergeSemantics. This is done automatically by the ExpansionPanel widget.

See IconButton for a more general implementation of a pressable button with an icon.

See also:

Fields§

§key: Option<KeyRef>§is_expanded: bool

Whether the icon is in an expanded state.

Rebuilding the widget with a different is_expanded value will trigger the animation, but will not trigger the on_pressed callback.

§size: f64

The size of the icon.

Defaults to 24.

§on_pressed: Option<ValueChanged<bool>>

The callback triggered when the icon is pressed and the state changes between expanded and collapsed. The value passed to the current state.

If this is set to None, the button will be disabled.

§padding: EdgeInsetsGeometry

The padding around the icon. The entire padded icon will react to input gestures.

Defaults to a padding of 8 on all sides.

§color: Option<Color>

The color of the icon.

Defaults to Colors::BLACK54 when the theme’s ThemeData::brightness is Brightness::Light and to Colors::WHITE60 when it is Brightness::Dark. This adheres to the Material Design specifications for icons and for dark theme

§disabled_color: Option<Color>

The color of the icon when it is disabled, i.e. if on_pressed is None.

Defaults to Colors::BLACK38 when the theme’s ThemeData::brightness is Brightness::Light and to Colors::WHITE38 when it is Brightness::Dark. This adheres to the Material Design specifications for icons and for dark theme

§expanded_color: Option<Color>

The color of the icon when the icon is expanded.

Defaults to Colors::BLACK54 when the theme’s ThemeData::brightness is Brightness::Light and to Colors::WHITE when it is Brightness::Dark. This adheres to the Material Design specifications for icons and for dark theme

§splash_color: Option<Color>

Defines the splash color of the IconButton.

If ThemeData::use_material3 is true, this field will be ignored, as IconButton::splash_color will be ignored, and you should use highlight_color instead.

Defaults to ThemeData::splash_color.

§highlight_color: Option<Color>

Defines the highlight color of the IconButton.

Defaults to ThemeData::highlight_color.

Implementations§

Source§

impl ExpandIcon

Source

pub fn new(on_pressed: Option<ValueChanged<bool>>) -> ExpandIcon

Creates an ExpandIcon with the given padding, and a callback that is triggered when the icon is pressed; Dart’s optional named arguments are the setters.

Source

pub fn key(self, key: KeyRef) -> ExpandIcon

Dart ExpandIcon(key:).

Source

pub fn is_expanded(self, is_expanded: bool) -> ExpandIcon

Dart ExpandIcon(isExpanded:).

Source

pub fn size(self, size: f64) -> ExpandIcon

Dart ExpandIcon(size:).

Source

pub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> ExpandIcon

Dart ExpandIcon(padding:).

Source

pub fn color(self, color: Color) -> ExpandIcon

Dart ExpandIcon(color:).

Source

pub fn disabled_color(self, disabled_color: Color) -> ExpandIcon

Dart ExpandIcon(disabledColor:).

Source

pub fn expanded_color(self, expanded_color: Color) -> ExpandIcon

Dart ExpandIcon(expandedColor:).

Source

pub fn splash_color(self, splash_color: Color) -> ExpandIcon

Dart ExpandIcon(splashColor:).

Source

pub fn highlight_color(self, highlight_color: Color) -> ExpandIcon

Dart ExpandIcon(highlightColor:).

Trait Implementations§

Source§

impl Debug for ExpandIcon

Source§

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

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

impl StatefulWidget for ExpandIcon

Source§

type State = ExpandIconState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> ExpandIconState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn debug_check_constructor(&self)

Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for ExpandIcon

§

impl !Send for ExpandIcon

§

impl !Sync for ExpandIcon

§

impl !UnwindSafe for ExpandIcon

§

impl Forget for ExpandIcon

§

impl Freeze for ExpandIcon
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze,

§

impl Move for ExpandIcon

§

impl Unpin for ExpandIcon
where Rc<dyn Key>: Unpin, Rc<dyn Fn(&mut App, bool)>: Unpin,

§

impl UnsafeUnpin for ExpandIcon
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: 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> 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<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

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

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>