pub struct ExpansibleController { /* private fields */ }Expand description
A controller for managing the expansion state of an Expansible.
This is a ChangeNotifier that notifies its listeners if the value of
is_expanded changes.
This controller provides methods to programmatically expand or collapse the widget, and it allows external components to query the current expansion state.
The controller’s expand and collapse methods cause
the Expansible to rebuild, so they may not be called from a build method.
Remember to dispose of the ExpansibleController when it is no
longer needed. This will ensure all resources used by the object are discarded.
Implementations§
Source§impl ExpansibleController
impl ExpansibleController
Sourcepub fn new(app: &mut App) -> Ref<ExpansibleController>
pub fn new(app: &mut App) -> Ref<ExpansibleController>
Creates a controller to be used with Expansible::controller.
Sourcepub fn is_expanded(self: Handle<Self>, app: &App) -> bool
pub fn is_expanded(self: Handle<Self>, app: &App) -> bool
Whether the expansible widget built with this controller is in expanded state.
This property doesn’t take the animation into account. It reports true
even if the expansion animation is not completed.
To be notified when this property changes, add a listener to the controller.
See also:
Sourcepub fn expand(self: Handle<Self>, app: &mut App)
pub fn expand(self: Handle<Self>, app: &mut App)
Expands the Expansible that was built with this controller.
If the widget is already in the expanded state (see
is_expanded), calling this method has no effect.
Calling this method may cause the Expansible to rebuild, so it may
not be called from a build method.
Calling this method will notify registered listeners of this controller that the expansion state has changed.
See also:
collapse, which collapses the expansible widget.is_expandedto check whether the expansible widget is expanded.
Sourcepub fn collapse(self: Handle<Self>, app: &mut App)
pub fn collapse(self: Handle<Self>, app: &mut App)
Collapses the Expansible that was built with this controller.
If the widget is already in the collapsed state (see
is_expanded), calling this method has no effect.
Calling this method may cause the Expansible to rebuild, so it may not
be called from a build method.
Calling this method will notify registered listeners of this controller that the expansion state has changed.
See also:
expand, which expands theExpansible.is_expandedto check whether theExpansibleis expanded.
Sourcepub fn toggle(self: Handle<Self>, app: &mut App)
pub fn toggle(self: Handle<Self>, app: &mut App)
Convenience method for toggling the current is_expanded status.
Calling this method may cause the Expansible to rebuild, so it may not
be called from a build method.
Calling this method will notify registered listeners of this controller that the expansion state has changed.
See also:
expand, which expands theExpansible.collapse, which collapses theExpansible.is_expandedto check whether theExpansibleis expanded.
Sourcepub fn of(app: &App, context: BuildContext) -> Handle<ExpansibleController>
pub fn of(app: &App, context: BuildContext) -> Handle<ExpansibleController>
Finds the ExpansibleController for the closest Expansible instance
that encloses the given context.
If no Expansible encloses the given context, calling this method panics.
To return None if there is no Expansible use maybe_of
instead.
Typical usage of the of function is to call it from
within the build method of a descendant of an Expansible.
Sourcepub fn maybe_of(
app: &App,
context: BuildContext,
) -> Option<Handle<ExpansibleController>>
pub fn maybe_of( app: &App, context: BuildContext, ) -> Option<Handle<ExpansibleController>>
Finds the Expansible from the closest instance of this class that
encloses the given context and returns its ExpansibleController.
If no Expansible encloses the given context then returns None.
To panic instead, use of.
See also:
of, a similar function to this one that panics if noExpansibleencloses the given context.
Trait Implementations§
Source§impl ChangeNotifier for ExpansibleController
impl ChangeNotifier for ExpansibleController
fn change_notifier_data(&self) -> &ChangeNotifierData
fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData
Source§fn will_add_listener(self: Handle<Self>, app: &mut App)
fn will_add_listener(self: Handle<Self>, app: &mut App)
addListener that
work before super.addListener go here.Source§fn did_remove_listener(self: Handle<Self>, app: &mut App)
fn did_remove_listener(self: Handle<Self>, app: &mut App)
removeListener that
work after super.removeListener go here.