pub struct Expansible {
pub key: Option<KeyRef>,
pub controller: Ref<ExpansibleController>,
pub header_builder: ExpansibleComponentBuilder,
pub body_builder: ExpansibleComponentBuilder,
pub animation_style: Option<AnimationStyle>,
pub duration: Duration,
pub curve: Rc<dyn Curve>,
pub reverse_curve: Option<Rc<dyn Curve>>,
pub maintain_state: bool,
pub expansible_builder: ExpansibleBuilder,
}Expand description
A StatefulWidget that expands and collapses.
An Expansible consists of a header, which is always shown, and a
body, which is hidden in its collapsed state and shown in its expanded
state.
The Expansible is expanded or collapsed with an animation driven by an
AnimationController. When the widget is expanded, the height of its body
animates from 0 to its fully expanded height.
This widget is typically used with ListView to create an “expand /
collapse” list entry. When used with scrolling widgets like ListView, a
unique PageStorageKey must be specified as the key, to enable the
Expansible to save and restore its expanded state when it is scrolled
in and out of view.
Provide header_builder and
body_builder callbacks to build the header and body widgets. An
additional expansible_builder callback can be provided to
further customize the layout of the widget.
The Expansible does not inherently toggle the expansion state. To toggle
the expansion state, call ExpansibleController::expand and
ExpansibleController::collapse as needed, most typically when the header
returned in header_builder is tapped.
See also:
ExpansionTile, a Material-styled widget that expands and collapses.
Fields§
§key: Option<KeyRef>See Widget::key.
controller: Ref<ExpansibleController>Expands and collapses the widget.
The controller manages the expansion state and toggles the expansion.
header_builder: ExpansibleComponentBuilderBuilds the always-displayed header.
Many use cases involve toggling the expansion state when this header is
tapped. To toggle the expansion state, call ExpansibleController::expand
or ExpansibleController::collapse.
body_builder: ExpansibleComponentBuilderBuilds the collapsible body.
When this widget is expanded, the height of its body animates from 0 to its fully extended height.
animation_style: Option<AnimationStyle>Used to override the expansion animation curve and duration.
If AnimationStyle::duration is provided, it will be used instead of
duration. If not provided, duration is used,
which defaults to 200ms.
If AnimationStyle::curve is provided, it will be used to override
curve. If it is None, then curve will be used.
Otherwise, defaults to Curves::ease.
If AnimationStyle::reverse_curve is provided, it will be used to
override reverse_curve. If it is None, then
reverse_curve will be used.
To disable the theme animation, use AnimationStyle::NO_ANIMATION.
duration: DurationUse animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
The duration of the expansion animation.
Defaults to a duration of 200ms.
This property is deprecated, use animation_style instead.
curve: Rc<dyn Curve>Use animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
The curve of the expansion animation.
Defaults to Curves::ease.
This property is deprecated, use animation_style instead.
reverse_curve: Option<Rc<dyn Curve>>Use animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
The reverse curve of the expansion animation.
If None, uses curve in both directions.
This property is deprecated, use animation_style instead.
maintain_state: boolWhether the state of the body is maintained when the widget expands or collapses.
If true, the body is kept in the tree while the widget is collapsed. Otherwise, the body is removed from the tree when the widget is collapsed and recreated upon expansion.
Defaults to true.
expansible_builder: ExpansibleBuilderBuilds the widget with the results of header_builder and
body_builder.
Defaults to placing the header and body in a Column.
Implementations§
Source§impl Expansible
impl Expansible
Sourcepub fn new(
header_builder: ExpansibleComponentBuilder,
body_builder: ExpansibleComponentBuilder,
controller: Ref<ExpansibleController>,
) -> Expansible
pub fn new( header_builder: ExpansibleComponentBuilder, body_builder: ExpansibleComponentBuilder, controller: Ref<ExpansibleController>, ) -> Expansible
Creates an instance of Expansible; Dart’s optional named arguments are the
setters.
Sourcepub fn key(self, key: KeyRef) -> Expansible
pub fn key(self, key: KeyRef) -> Expansible
Dart Expansible(key:).
Sourcepub fn expansible_builder(
self,
expansible_builder: ExpansibleBuilder,
) -> Expansible
pub fn expansible_builder( self, expansible_builder: ExpansibleBuilder, ) -> Expansible
Dart Expansible(expansibleBuilder:).
Sourcepub fn animation_style(self, animation_style: AnimationStyle) -> Expansible
pub fn animation_style(self, animation_style: AnimationStyle) -> Expansible
Dart Expansible(animationStyle:).
Sourcepub fn duration(self, duration: Duration) -> Expansible
👎Deprecated: Use animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
pub fn duration(self, duration: Duration) -> Expansible
Use animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
Dart Expansible(duration:).
Sourcepub fn curve(self, curve: Rc<dyn Curve>) -> Expansible
👎Deprecated: Use animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
pub fn curve(self, curve: Rc<dyn Curve>) -> Expansible
Use animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
Dart Expansible(curve:).
Sourcepub fn reverse_curve(self, reverse_curve: Rc<dyn Curve>) -> Expansible
👎Deprecated: Use animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
pub fn reverse_curve(self, reverse_curve: Rc<dyn Curve>) -> Expansible
Use animation_style instead. This feature was deprecated after v3.38.0-0.2.pre.
Dart Expansible(reverseCurve:).
Sourcepub fn maintain_state(self, maintain_state: bool) -> Expansible
pub fn maintain_state(self, maintain_state: bool) -> Expansible
Dart Expansible(maintainState:).
Trait Implementations§
Source§impl Debug for Expansible
impl Debug for Expansible
Source§impl StatefulWidget for Expansible
impl StatefulWidget for Expansible
Source§type State = ExpansibleState
type State = ExpansibleState
Source§fn create_state(&self) -> ExpansibleState
fn create_state(&self) -> ExpansibleState
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>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
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 Expansible
impl !Send for Expansible
impl !Sync for Expansible
impl !UnwindSafe for Expansible
impl Forget for Expansible
impl Freeze for Expansiblewhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
NonZero<u32>: Freeze,
PhantomData<fn() -> ExpansibleController>: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>>: Freeze,
*const RcInner<dyn Curve> is !null: Freeze,
PhantomData<RcInner<dyn Curve>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, &Rc<dyn Widget>, &Rc<dyn Widget>, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &Rc<dyn Widget>, &Rc<dyn Widget>, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>>: Freeze,
impl Move for Expansible
impl Unpin for Expansible
impl UnsafeUnpin for Expansiblewhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
PhantomData<fn() -> ExpansibleController>: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>>: UnsafeUnpin,
*const RcInner<dyn Curve> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Curve>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, &Rc<dyn Widget>, &Rc<dyn Widget>, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &Rc<dyn Widget>, &Rc<dyn Widget>, Retained<AnyAnimation<f64>>) -> Rc<dyn Widget>>>: 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<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.