pub struct HeroState { /* private fields */ }Expand description
The Hero widget displays different content based on whether it is in an animated
transition (“flight”), from/to another Hero with the same tag:
- When
start_flightis called, the real content of thisHerowill be replaced by a “placeholder” widget. - When the flight ends, the “toHero”’s
end_flightmethod must be called by the hero controller, so the real content of thatHerobecomes visible again when the animation completes.
Dart’s _HeroState.
Implementations§
Source§impl HeroState
impl HeroState
Sourcepub fn start_flight(
self: Handle<Self>,
app: &mut App,
should_included_child_in_placeholder: bool,
)
pub fn start_flight( self: Handle<Self>, app: &mut App, should_included_child_in_placeholder: bool, )
Replaces this hero’s content with a placeholder of its current size.
The should_included_child_in_placeholder flag dictates if the child widget of this hero
should be included in the placeholder widget as a descendant.
When a new hero flight animation takes place, a placeholder widget needs to be built to
replace the original hero widget. When should_included_child_in_placeholder is set to
true and Hero::placeholder_builder is None, the placeholder widget will include the
original hero’s child widget as a descendant, allowing the original element tree to be
preserved.
It is typically set to true for the from hero in a push transition, and false otherwise.
Sourcepub fn end_flight(self: Handle<Self>, app: &mut App, keep_placeholder: bool)
pub fn end_flight(self: Handle<Self>, app: &mut App, keep_placeholder: bool)
Restores this hero’s content once its flight is over.
When keep_placeholder is true, the placeholder will continue to be shown after the
flight ends. Otherwise the child of the hero will become visible and its TickerMode
will be re-enabled.
This method can be safely called even when this Hero is currently not in a flight.
Trait Implementations§
Source§impl State for HeroState
impl State for HeroState
Source§fn state_data(self: Handle<Self>, app: &App) -> &StateData<Self::Widget>
fn state_data(self: Handle<Self>, app: &App) -> &StateData<Self::Widget>
state
(state_accessors!).Source§fn state_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut StateData<Self::Widget>
fn state_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut StateData<Self::Widget>
state_data.Source§fn build(self: Handle<Self>, app: &mut App, context: BuildContext) -> WidgetRef
fn build(self: Handle<Self>, app: &mut App, context: BuildContext) -> WidgetRef
Source§fn widget(self: Handle<Self>, app: &App) -> &Self::Widget
fn widget(self: Handle<Self>, app: &App) -> &Self::Widget
Source§fn context(self: Handle<Self>, app: &App) -> BuildContext
fn context(self: Handle<Self>, app: &App) -> BuildContext
Source§fn init_state(self: Handle<Self>, app: &mut App)
fn init_state(self: Handle<Self>, app: &mut App)
Source§fn did_update_widget(
self: Handle<Self>,
app: &mut App,
old_widget: &Self::Widget,
)
fn did_update_widget( self: Handle<Self>, app: &mut App, old_widget: &Self::Widget, )
Source§fn set_state(self: Handle<Self>, app: &mut App, f: impl FnOnce(&mut Self))
fn set_state(self: Handle<Self>, app: &mut App, f: impl FnOnce(&mut Self))
Source§fn deactivate(self: Handle<Self>, app: &mut App)
fn deactivate(self: Handle<Self>, app: &mut App)
Source§fn activate(self: Handle<Self>, app: &mut App)
fn activate(self: Handle<Self>, app: &mut App)
deactivate. Read moreSource§fn dispose(self: Handle<Self>, app: &mut App)
fn dispose(self: Handle<Self>, app: &mut App)
Source§fn did_change_dependencies(self: Handle<Self>, app: &mut App)
fn did_change_dependencies(self: Handle<Self>, app: &mut App)
Source§fn debug_fill_properties(
self: Handle<Self>,
app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( self: Handle<Self>, app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties this state shows where its element’s dump
names it (state: ScrollableState#1a2b3(offset: 0.0)), after the lifecycle and mounting
properties State’s base adds, which the framework adds first.