pub struct Expander {Show 16 fields
pub is_expanded: bool,
pub is_expanded_changed: ExpanderExpandedChangedHandler,
pub header: Option<WidgetRef>,
pub content: Option<WidgetRef>,
pub expand_direction: ExpandDirection,
pub is_enabled: bool,
pub background: Option<Brush>,
pub border_brush: Option<Brush>,
pub padding: Option<[f64; 4]>,
pub corner_radius: Option<f64>,
pub min_width: Option<f64>,
pub min_height: Option<f64>,
pub expanding: Option<Listener>,
pub collapsed: Option<Listener>,
pub template: Option<ExpanderTemplate>,
pub key: Option<KeyRef>,
}Expand description
A header toggle that reveals or hides retained content using the Fluent template.
Fields§
§is_expanded: boolWhether the content is expanded.
is_expanded_changed: ExpanderExpandedChangedHandlerRequests a new expanded value from the owner.
header: Option<WidgetRef>Content displayed by the header toggle.
content: Option<WidgetRef>Content retained while the Expander is collapsed.
expand_direction: ExpandDirectionWhether content is above or below the header.
is_enabled: boolWhether the header and content accept input.
background: Option<Brush>Optional content background.
border_brush: Option<Brush>Optional content border.
padding: Option<[f64; 4]>Content padding in left, top, right, bottom order; the theme’s ExpanderContentPadding when None.
corner_radius: Option<f64>Corner radius shared by the header and content; the theme’s ControlCornerRadius when None.
min_width: Option<f64>Minimum width of the control; the theme’s FlyoutThemeMinWidth when None.
min_height: Option<f64>Minimum height of both header and content borders; the theme’s ExpanderMinHeight when None.
expanding: Option<Listener>Called when IsExpanded changes to true, before the opening animation completes.
collapsed: Option<Listener>Called when IsExpanded changes to false, rather than after the collapse animation.
template: Option<ExpanderTemplate>The template of another style; None is DefaultExpanderStyle’s.
key: Option<KeyRef>Stable identity across rebuilds.
Implementations§
Source§impl Expander
impl Expander
Sourcepub fn new(
is_expanded: bool,
changed: impl Fn(&mut App, bool) + 'static,
) -> Self
pub fn new( is_expanded: bool, changed: impl Fn(&mut App, bool) + 'static, ) -> Self
Creates an Expander whose expanded value is owned by its caller.
Sourcepub fn header<K>(self, value: impl IntoWidget<K>) -> Self
pub fn header<K>(self, value: impl IntoWidget<K>) -> Self
Sets Header.
Sourcepub fn content<K>(self, value: impl IntoWidget<K>) -> Self
pub fn content<K>(self, value: impl IntoWidget<K>) -> Self
Sets Content.
Sourcepub fn expand_direction(self, value: ExpandDirection) -> Self
pub fn expand_direction(self, value: ExpandDirection) -> Self
Sets ExpandDirection.
Sourcepub fn is_enabled(self, value: bool) -> Self
pub fn is_enabled(self, value: bool) -> Self
Sets IsEnabled.
Sourcepub fn background(self, value: Brush) -> Self
pub fn background(self, value: Brush) -> Self
Sets Background.
Sourcepub fn border_brush(self, value: Brush) -> Self
pub fn border_brush(self, value: Brush) -> Self
Sets BorderBrush.
Sourcepub fn corner_radius(self, value: f64) -> Self
pub fn corner_radius(self, value: f64) -> Self
Sets CornerRadius.
Sourcepub fn min_height(self, value: f64) -> Self
pub fn min_height(self, value: f64) -> Self
Sets MinHeight.
Sourcepub fn template(
self,
builder: impl Fn(&mut App, BuildContext, &Expander, ExpanderTemplateStates, &ExpanderTemplateParts) -> WidgetRef + 'static,
) -> Self
pub fn template( self, builder: impl Fn(&mut App, BuildContext, &Expander, ExpanderTemplateStates, &ExpanderTemplateParts) -> WidgetRef + 'static, ) -> Self
Sets the ControlTemplate of a style that replaces DefaultExpanderStyle’s.
Trait Implementations§
Source§impl StatefulWidget for Expander
impl StatefulWidget for Expander
Source§fn key(&self) -> Option<&KeyRef>
fn key(&self) -> Option<&KeyRef>
Returns the identity used to retain this control across owner rebuilds.
Source§fn create_state(&self) -> ExpanderState
fn create_state(&self) -> ExpanderState
Initializes template state from the first widget description.
Source§type State = ExpanderState
type State = ExpanderState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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 as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
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 Expander
impl !Send for Expander
impl !Sync for Expander
impl !UnwindSafe for Expander
impl Forget for Expander
impl Freeze for Expanderwhere
*const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
NonZero<u32>: Freeze,
*const (): Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, &Expander, ExpanderTemplateStates, &ExpanderTemplateParts) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &Expander, ExpanderTemplateStates, &ExpanderTemplateParts) -> Rc<dyn Widget>>>: Freeze,
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
impl Move for Expander
impl Unpin for Expander
impl UnsafeUnpin for Expanderwhere
*const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, &Expander, ExpanderTemplateStates, &ExpanderTemplateParts) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &Expander, ExpanderTemplateStates, &ExpanderTemplateParts) -> Rc<dyn Widget>>>: UnsafeUnpin,
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.