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
impl RawScrollbar
Sourcepub fn new<K>(child: impl IntoWidget<K>) -> RawScrollbar
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.
Sourcepub fn key(self, key: KeyRef) -> RawScrollbar
pub fn key(self, key: KeyRef) -> RawScrollbar
Dart key:.
Sourcepub fn controller(self, controller: ScrollControllerRef) -> RawScrollbar
pub fn controller(self, controller: ScrollControllerRef) -> RawScrollbar
Dart controller:.
Sourcepub fn thumb_visibility(self, thumb_visibility: bool) -> RawScrollbar
pub fn thumb_visibility(self, thumb_visibility: bool) -> RawScrollbar
Dart thumbVisibility:.
Sourcepub fn track_visibility(self, track_visibility: bool) -> RawScrollbar
pub fn track_visibility(self, track_visibility: bool) -> RawScrollbar
Dart trackVisibility:.
Sourcepub fn shape(self, shape: impl Into<OutlinedBorderRef>) -> RawScrollbar
pub fn shape(self, shape: impl Into<OutlinedBorderRef>) -> RawScrollbar
Dart shape:.
Sourcepub fn radius(self, radius: Radius) -> RawScrollbar
pub fn radius(self, radius: Radius) -> RawScrollbar
Dart radius:.
Sourcepub fn thickness(self, thickness: f64) -> RawScrollbar
pub fn thickness(self, thickness: f64) -> RawScrollbar
Dart thickness:.
Sourcepub fn thumb_color(self, thumb_color: Color) -> RawScrollbar
pub fn thumb_color(self, thumb_color: Color) -> RawScrollbar
Dart thumbColor:.
Sourcepub fn min_thumb_length(self, min_thumb_length: f64) -> RawScrollbar
pub fn min_thumb_length(self, min_thumb_length: f64) -> RawScrollbar
Dart minThumbLength:.
Sourcepub fn min_overscroll_length(self, min_overscroll_length: f64) -> RawScrollbar
pub fn min_overscroll_length(self, min_overscroll_length: f64) -> RawScrollbar
Dart minOverscrollLength:.
Sourcepub fn track_radius(self, track_radius: Radius) -> RawScrollbar
pub fn track_radius(self, track_radius: Radius) -> RawScrollbar
Dart trackRadius:.
Sourcepub fn track_color(self, track_color: Color) -> RawScrollbar
pub fn track_color(self, track_color: Color) -> RawScrollbar
Dart trackColor:.
Sourcepub fn track_border_color(self, track_border_color: Color) -> RawScrollbar
pub fn track_border_color(self, track_border_color: Color) -> RawScrollbar
Dart trackBorderColor:.
Sourcepub fn fade_duration(self, fade_duration: Duration) -> RawScrollbar
pub fn fade_duration(self, fade_duration: Duration) -> RawScrollbar
Dart fadeDuration:.
Sourcepub fn time_to_fade(self, time_to_fade: Duration) -> RawScrollbar
pub fn time_to_fade(self, time_to_fade: Duration) -> RawScrollbar
Dart timeToFade:.
Sourcepub fn press_duration(self, press_duration: Duration) -> RawScrollbar
pub fn press_duration(self, press_duration: Duration) -> RawScrollbar
Dart pressDuration:.
Sourcepub fn notification_predicate(
self,
notification_predicate: ScrollNotificationPredicate,
) -> RawScrollbar
pub fn notification_predicate( self, notification_predicate: ScrollNotificationPredicate, ) -> RawScrollbar
Dart notificationPredicate:.
Sourcepub fn interactive(self, interactive: bool) -> RawScrollbar
pub fn interactive(self, interactive: bool) -> RawScrollbar
Dart interactive:.
Sourcepub fn scrollbar_orientation(
self,
scrollbar_orientation: ScrollbarOrientation,
) -> RawScrollbar
pub fn scrollbar_orientation( self, scrollbar_orientation: ScrollbarOrientation, ) -> RawScrollbar
Dart scrollbarOrientation:.
Sourcepub fn main_axis_margin(self, main_axis_margin: f64) -> RawScrollbar
pub fn main_axis_margin(self, main_axis_margin: f64) -> RawScrollbar
Dart mainAxisMargin:.
Sourcepub fn cross_axis_margin(self, cross_axis_margin: f64) -> RawScrollbar
pub fn cross_axis_margin(self, cross_axis_margin: f64) -> RawScrollbar
Dart crossAxisMargin:.
Sourcepub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> RawScrollbar
pub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> RawScrollbar
Dart padding:.
Trait Implementations§
Source§impl Debug for RawScrollbar
impl Debug for RawScrollbar
Source§impl RawScrollbarLeaf for RawScrollbar
impl RawScrollbarLeaf for RawScrollbar
Source§fn raw_scrollbar_data(&self) -> &RawScrollbarData
fn raw_scrollbar_data(&self) -> &RawScrollbarData
RawScrollbarData bag
(raw_scrollbar_accessors!).Source§fn raw_scrollbar_data_mut(&mut self) -> &mut RawScrollbarData
fn raw_scrollbar_data_mut(&mut self) -> &mut RawScrollbarData
RawScrollbarData bag, mutably.Source§impl StatefulWidget for RawScrollbar
impl StatefulWidget for RawScrollbar
Source§type State = RawScrollbarState
type State = RawScrollbarState
Source§fn create_state(&self) -> RawScrollbarState
fn create_state(&self) -> RawScrollbarState
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 RawScrollbar
impl !Send for RawScrollbar
impl !Sync for RawScrollbar
impl !UnwindSafe for RawScrollbar
impl Forget for RawScrollbar
impl Freeze for RawScrollbarwhere
*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
impl UnsafeUnpin for RawScrollbarwhere
*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> 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.