pub struct ScrollNotificationObserver {
pub key: Option<KeyRef>,
pub child: WidgetRef,
}Expand description
Notifies its listeners when a descendant scrolls.
To add a listener to a ScrollNotificationObserver ancestor:
ScrollNotificationObserver::of(app, context).add_listener(app, listener);To remove the listener from a ScrollNotificationObserver ancestor:
ScrollNotificationObserver::of(app, context).remove_listener(app, &listener);Stateful widgets that share an ancestor ScrollNotificationObserver typically
add a listener in State::did_change_dependencies (removing the old one
if necessary) and remove the listener in their State::dispose method.
This widget is similar to NotificationListener. It supports a listener
list instead of just a single listener and its listeners run
unconditionally, they do not require a gating boolean return value.
Fields§
§key: Option<KeyRef>§child: WidgetRefThe subtree below this widget.
Implementations§
Source§impl ScrollNotificationObserver
impl ScrollNotificationObserver
Sourcepub fn new<K>(child: impl IntoWidget<K>) -> ScrollNotificationObserver
pub fn new<K>(child: impl IntoWidget<K>) -> ScrollNotificationObserver
Create a ScrollNotificationObserver.
Sourcepub fn key(self, key: KeyRef) -> ScrollNotificationObserver
pub fn key(self, key: KeyRef) -> ScrollNotificationObserver
Dart ScrollNotificationObserver(key:).
Sourcepub fn maybe_of(
app: &mut App,
context: BuildContext,
) -> Option<Handle<ScrollNotificationObserverState>>
pub fn maybe_of( app: &mut App, context: BuildContext, ) -> Option<Handle<ScrollNotificationObserverState>>
The closest instance of this class that encloses the given context.
If there is no enclosing ScrollNotificationObserver widget, then None is
returned.
Calling this method will create a dependency on the closest
ScrollNotificationObserver in the context, if there is one.
See also:
ScrollNotificationObserver::of, which is similar to this method, but panics if noScrollNotificationObserverancestor is found.
Sourcepub fn of(
app: &mut App,
context: BuildContext,
) -> Handle<ScrollNotificationObserverState>
pub fn of( app: &mut App, context: BuildContext, ) -> Handle<ScrollNotificationObserverState>
The closest instance of this class that encloses the given context.
Calling this method will create a dependency on the closest
ScrollNotificationObserver in the context.
§Panics
If no ScrollNotificationObserver ancestor is found.
See also:
ScrollNotificationObserver::maybe_of, which is similar to this method, but returnsNoneif noScrollNotificationObserverancestor is found.
Trait Implementations§
Source§impl Debug for ScrollNotificationObserver
impl Debug for ScrollNotificationObserver
Source§impl StatefulWidget for ScrollNotificationObserver
impl StatefulWidget for ScrollNotificationObserver
Source§type State = ScrollNotificationObserverState
type State = ScrollNotificationObserverState
Source§fn create_state(&self) -> ScrollNotificationObserverState
fn create_state(&self) -> ScrollNotificationObserverState
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 ScrollNotificationObserver
impl !Send for ScrollNotificationObserver
impl !Sync for ScrollNotificationObserver
impl !UnwindSafe for ScrollNotificationObserver
impl Forget for ScrollNotificationObserver
impl Freeze for ScrollNotificationObserver
impl Move for ScrollNotificationObserver
impl Unpin for ScrollNotificationObserver
impl UnsafeUnpin for ScrollNotificationObserverwhere
*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<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.