Skip to main content

RawScrollbar

Struct RawScrollbar 

Source
pub struct RawScrollbar { /* private fields */ }
Expand description

An extendable base class for building scrollbars that fade in and out.

To add a scrollbar to a ScrollView, like a ListView or a CustomScrollView, wrap the scroll view widget in a RawScrollbar widget.

A scrollbar thumb indicates which portion of a ScrollView is actually visible.

By default, the thumb will fade in and out as the child scroll view scrolls. When thumb_visibility is true, the scrollbar thumb will remain visible without the fade animation. This requires that the scroll controller associated with the scrollable widget is provided to controller, or that the PrimaryScrollController is being used by that scrollable widget.

If the scrollbar is wrapped around multiple scroll views, it only responds to the nearest one and shows the corresponding scrollbar thumb by default. The notification_predicate allows the ability to customize which scroll notifications the scrollbar should listen to.

If the child scroll view is infinitely long, the RawScrollbar will not be painted. In this case, the scrollbar cannot accurately represent the relative location of the visible area, or calculate the accurate delta to apply when dragging on the thumb or tapping on the track.

§Interaction

Scrollbars are interactive and can use the PrimaryScrollController if a controller is not set. Interactive scrollbar thumbs can be dragged along the main axis of the scroll view to change the scroll position. Tapping along the track exclusive of the thumb will trigger a ScrollIncrementType::Page based on the relative position to the thumb.

§Automatic scrollbars on desktop platforms

Scrollbars are added to most scrollable widgets by default on the desktop platforms. This is done through ScrollBehavior::build_scrollbar as part of an app’s ScrollConfiguration.

Implementations§

Source§

impl RawScrollbar

Source

pub fn new<K>(child: impl IntoWidget<K>) -> RawScrollbar

Creates a basic raw scrollbar that wraps the given child.

The child, or a descendant of the child, should be a source of ScrollNotification notifications, typically a Scrollable widget.

Source

pub fn key(self, key: KeyRef) -> RawScrollbar

Dart key:.

Source

pub fn controller(self, controller: ScrollControllerRef) -> RawScrollbar

Dart controller:.

Source

pub fn thumb_visibility(self, thumb_visibility: bool) -> RawScrollbar

Dart thumbVisibility:.

Source

pub fn track_visibility(self, track_visibility: bool) -> RawScrollbar

Dart trackVisibility:.

Source

pub fn shape(self, shape: impl Into<OutlinedBorderRef>) -> RawScrollbar

Dart shape:.

Source

pub fn radius(self, radius: Radius) -> RawScrollbar

Dart radius:.

Source

pub fn thickness(self, thickness: f64) -> RawScrollbar

Dart thickness:.

Source

pub fn thumb_color(self, thumb_color: Color) -> RawScrollbar

Dart thumbColor:.

Source

pub fn min_thumb_length(self, min_thumb_length: f64) -> RawScrollbar

Dart minThumbLength:.

Source

pub fn min_overscroll_length(self, min_overscroll_length: f64) -> RawScrollbar

Dart minOverscrollLength:.

Source

pub fn track_radius(self, track_radius: Radius) -> RawScrollbar

Dart trackRadius:.

Source

pub fn track_color(self, track_color: Color) -> RawScrollbar

Dart trackColor:.

Source

pub fn track_border_color(self, track_border_color: Color) -> RawScrollbar

Dart trackBorderColor:.

Source

pub fn fade_duration(self, fade_duration: Duration) -> RawScrollbar

Dart fadeDuration:.

Source

pub fn time_to_fade(self, time_to_fade: Duration) -> RawScrollbar

Dart timeToFade:.

Source

pub fn press_duration(self, press_duration: Duration) -> RawScrollbar

Dart pressDuration:.

Source

pub fn notification_predicate( self, notification_predicate: ScrollNotificationPredicate, ) -> RawScrollbar

Dart notificationPredicate:.

Source

pub fn interactive(self, interactive: bool) -> RawScrollbar

Dart interactive:.

Source

pub fn scrollbar_orientation( self, scrollbar_orientation: ScrollbarOrientation, ) -> RawScrollbar

Dart scrollbarOrientation:.

Source

pub fn main_axis_margin(self, main_axis_margin: f64) -> RawScrollbar

Dart mainAxisMargin:.

Source

pub fn cross_axis_margin(self, cross_axis_margin: f64) -> RawScrollbar

Dart crossAxisMargin:.

Source

pub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> RawScrollbar

Dart padding:.

Trait Implementations§

Source§

impl Debug for RawScrollbar

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl RawScrollbarLeaf for RawScrollbar

Source§

impl StatefulWidget for RawScrollbar

Source§

type State = RawScrollbarState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> RawScrollbarState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s 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 debug_check_constructor(&self)

Source§

fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>

Source§

fn type_name(&self) -> &'static str

See 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 RawScrollbar

§

impl !Send for RawScrollbar

§

impl !Sync for RawScrollbar

§

impl !UnwindSafe for RawScrollbar

§

impl Forget for RawScrollbar

§

impl Freeze for RawScrollbar
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, NonZero<u32>: Freeze, &'static ScrollControllerVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const RcInner<dyn OutlinedBorder> is !null: Freeze, PhantomData<RcInner<dyn OutlinedBorder>>: Freeze, *const RcInner<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool> is !null: Freeze, PhantomData<RcInner<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool>>: Freeze,

§

impl Move for RawScrollbar

§

impl Unpin for RawScrollbar
where Rc<dyn Key>: Unpin, Rc<dyn Widget>: Unpin, NonZero<u32>: Unpin, &'static ScrollControllerVTable: Unpin, Rc<Keep>: Unpin, Rc<dyn OutlinedBorder>: Unpin, Rc<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool>: Unpin,

§

impl UnsafeUnpin for RawScrollbar
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static ScrollControllerVTable: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const RcInner<dyn OutlinedBorder> is !null: UnsafeUnpin, PhantomData<RcInner<dyn OutlinedBorder>>: UnsafeUnpin, *const RcInner<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&(dyn ScrollNotification + 'static)) -> bool>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>