pub struct Offstage {
pub key: Option<KeyRef>,
pub offstage: bool,
pub child: Option<WidgetRef>,
}Expand description
A widget that lays the child out as if it was in the tree, but without painting anything, without making the child available for hit testing, and without taking any room in the parent.
Offstage children are still active: they can receive focus and have keyboard input directed to them.
Animations continue to run in offstage children, and therefore use battery and CPU time, regardless of whether the animations end up being visible.
Offstage can be used to measure the dimensions of a widget without
bringing it on screen (yet). To hide a widget from view while it is not
needed, prefer removing the widget from the tree entirely rather than
keeping it alive in an Offstage subtree.
See also:
Visibility, which can hide a child more efficiently (albeit less subtly).TickerMode, which can be used to disable animations in a subtree.SliverOffstage, the sliver version of this widget.- The catalog of layout widgets.
Flutter’s _OffstageElement only overrides debugVisitOnstageChildren; this uses the
plain single-child element.
Fields§
§key: Option<KeyRef>§offstage: boolWhether the child is hidden from the rest of the tree.
If true, the child is laid out as if it was in the tree, but without painting anything, without making the child available for hit testing, and without taking any room in the parent.
Offstage children are still active: they can receive focus and have keyboard input directed to them.
Animations continue to run in offstage children, and therefore use battery and CPU time, regardless of whether the animations end up being visible.
If false, the child is included in the tree as normal.
child: Option<WidgetRef>Implementations§
Trait Implementations§
Source§impl RenderObjectWidget for Offstage
impl RenderObjectWidget for Offstage
Source§fn debug_visit_onstage_children(
&self,
_app: &App,
children: &[AnyElement],
visitor: &mut dyn FnMut(AnyElement),
)
fn debug_visit_onstage_children( &self, _app: &App, children: &[AnyElement], visitor: &mut dyn FnMut(AnyElement), )
Dart’s _OffstageElement.debugVisitOnstageChildren: no child while offstage.
Source§type RenderObject = RenderOffstage
type RenderObject = RenderOffstage
covariant RenderObject parameter type.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 create_render_object(
&self,
app: &mut App,
_context: BuildContext,
) -> AnyRenderObject
fn create_render_object( &self, app: &mut App, _context: BuildContext, ) -> AnyRenderObject
RenderObject class that this widget represents, using the
configuration described by this widget. Read moreSource§fn update_render_object(
&self,
app: &mut App,
_context: BuildContext,
render_object: RenderHandle<RenderOffstage>,
)
fn update_render_object( &self, app: &mut App, _context: BuildContext, render_object: RenderHandle<RenderOffstage>, )
create_render_object. Read moreSource§fn to_string_short(&self) -> String
fn to_string_short(&self) -> String
toStringShort, for a widget that names itself apart from its type, as
SizedBox.expand does; see Widget::to_string_short.Source§fn did_unmount_render_object(
&self,
app: &mut App,
render_object: RenderHandle<Self::RenderObject>,
)
fn did_unmount_render_object( &self, app: &mut App, render_object: RenderHandle<Self::RenderObject>, )
RenderObject will be of the same type as returned by this object’s
create_render_object.Auto Trait Implementations§
impl !RefUnwindSafe for Offstage
impl !Send for Offstage
impl !Sync for Offstage
impl !UnwindSafe for Offstage
impl Forget for Offstage
impl Freeze for Offstage
impl Move for Offstage
impl Unpin for Offstage
impl UnsafeUnpin for Offstagewhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<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<SingleChildRenderObjectKind> for Wwhere
W: SingleChildRenderObjectWidget,
<W as RenderObjectWidget>::RenderObject: RenderObjectWithChildMixin,
impl<W> IntoWidget<SingleChildRenderObjectKind> for Wwhere
W: SingleChildRenderObjectWidget,
<W as RenderObjectWidget>::RenderObject: RenderObjectWithChildMixin,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.