pub struct SingleChildScrollView {Show 13 fields
pub key: Option<KeyRef>,
pub scroll_direction: Axis,
pub reverse: bool,
pub padding: Option<EdgeInsetsGeometry>,
pub controller: Option<ScrollControllerRef>,
pub primary: Option<bool>,
pub physics: Option<ScrollPhysicsRef>,
pub child: Option<WidgetRef>,
pub drag_start_behavior: DragStartBehavior,
pub clip_behavior: Clip,
pub hit_test_behavior: HitTestBehavior,
pub restoration_id: Option<String>,
pub keyboard_dismiss_behavior: Option<ScrollViewKeyboardDismissBehavior>,
}Expand description
A box in which a single widget can be scrolled.
This widget is useful when you have a single box that will normally be entirely visible, for example a clock face in a time picker, but you need to make sure it can be scrolled if the container gets too small in one axis (the scroll direction).
It is also useful if you need to shrink-wrap in both axes (the main
scrolling direction as well as the cross axis), as one might see in a dialog
or pop-up menu. In that case, you might pair the SingleChildScrollView
with a ListBody child.
When you have a list of children and do not require cross-axis
shrink-wrapping behavior, for example a scrolling list that is always the
width of the screen, consider ListView, which is vastly
more efficient than a SingleChildScrollView containing a ListBody or
Column with many children.
See also:
ListView, which handles multiple children in a scrolling list.Scrollable, which handles arbitrary scrolling effects.
Fields§
§key: Option<KeyRef>§scroll_direction: AxisThe Axis along which the scroll view’s offset increases.
Defaults to Axis::Vertical.
reverse: boolWhether the scroll view scrolls in the reading direction.
For example, if the reading direction is left-to-right and
scroll_direction is Axis::Horizontal, then the scroll
view scrolls from left to right when reverse is false and from right
to left when it is true.
Defaults to false.
padding: Option<EdgeInsetsGeometry>The amount of space by which to inset the child.
controller: Option<ScrollControllerRef>An object that can be used to control the position to which this scroll view is scrolled.
Must be None if primary is true.
primary: Option<bool>Whether this is the primary scroll view associated with the parent
PrimaryScrollController.
physics: Option<ScrollPhysicsRef>How the scroll view should respond to user input.
For example, determines how the scroll view continues to animate after the user stops dragging the scroll view.
Defaults to matching platform conventions.
child: Option<WidgetRef>The widget that scrolls.
drag_start_behavior: DragStartBehaviorDetermines the way that drag start behavior is handled.
clip_behavior: ClipThe content will be clipped (or not) according to this option.
Defaults to Clip::HardEdge.
hit_test_behavior: HitTestBehaviorHow to behave during hit testing when deciding how the hit test propagates to children and whether to consider targets behind this scroll view.
Defaults to HitTestBehavior::Opaque.
restoration_id: Option<String>Restoration ID to save and restore the scroll offset of the scrollable.
keyboard_dismiss_behavior: Option<ScrollViewKeyboardDismissBehavior>How this scroll view will dismiss the keyboard automatically.
If None then it falls back to the inherited
ScrollBehavior::get_keyboard_dismiss_behavior.
Implementations§
Source§impl SingleChildScrollView
impl SingleChildScrollView
Sourcepub fn new() -> SingleChildScrollView
pub fn new() -> SingleChildScrollView
Creates a box in which a single widget can be scrolled.
Sourcepub fn key(self, key: KeyRef) -> SingleChildScrollView
pub fn key(self, key: KeyRef) -> SingleChildScrollView
Dart SingleChildScrollView(key:).
Sourcepub fn scroll_direction(self, scroll_direction: Axis) -> SingleChildScrollView
pub fn scroll_direction(self, scroll_direction: Axis) -> SingleChildScrollView
Dart SingleChildScrollView(scrollDirection:).
Sourcepub fn reverse(self, reverse: bool) -> SingleChildScrollView
pub fn reverse(self, reverse: bool) -> SingleChildScrollView
Dart SingleChildScrollView(reverse:).
Sourcepub fn padding(
self,
padding: impl Into<EdgeInsetsGeometry>,
) -> SingleChildScrollView
pub fn padding( self, padding: impl Into<EdgeInsetsGeometry>, ) -> SingleChildScrollView
Dart SingleChildScrollView(padding:).
Sourcepub fn controller(
self,
controller: ScrollControllerRef,
) -> SingleChildScrollView
pub fn controller( self, controller: ScrollControllerRef, ) -> SingleChildScrollView
Dart SingleChildScrollView(controller:).
Sourcepub fn primary(self, primary: bool) -> SingleChildScrollView
pub fn primary(self, primary: bool) -> SingleChildScrollView
Dart SingleChildScrollView(primary:).
Sourcepub fn physics(self, physics: ScrollPhysicsRef) -> SingleChildScrollView
pub fn physics(self, physics: ScrollPhysicsRef) -> SingleChildScrollView
Dart SingleChildScrollView(physics:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> SingleChildScrollView
pub fn child<K>(self, child: impl IntoWidget<K>) -> SingleChildScrollView
Dart SingleChildScrollView(child:).
Sourcepub fn drag_start_behavior(
self,
drag_start_behavior: DragStartBehavior,
) -> SingleChildScrollView
pub fn drag_start_behavior( self, drag_start_behavior: DragStartBehavior, ) -> SingleChildScrollView
Dart SingleChildScrollView(dragStartBehavior:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> SingleChildScrollView
pub fn clip_behavior(self, clip_behavior: Clip) -> SingleChildScrollView
Dart SingleChildScrollView(clipBehavior:).
Sourcepub fn hit_test_behavior(
self,
hit_test_behavior: HitTestBehavior,
) -> SingleChildScrollView
pub fn hit_test_behavior( self, hit_test_behavior: HitTestBehavior, ) -> SingleChildScrollView
Dart SingleChildScrollView(hitTestBehavior:).
Sourcepub fn restoration_id(
self,
restoration_id: impl Into<String>,
) -> SingleChildScrollView
pub fn restoration_id( self, restoration_id: impl Into<String>, ) -> SingleChildScrollView
Dart SingleChildScrollView(restorationId:).
Sourcepub fn keyboard_dismiss_behavior(
self,
keyboard_dismiss_behavior: ScrollViewKeyboardDismissBehavior,
) -> SingleChildScrollView
pub fn keyboard_dismiss_behavior( self, keyboard_dismiss_behavior: ScrollViewKeyboardDismissBehavior, ) -> SingleChildScrollView
Dart SingleChildScrollView(keyboardDismissBehavior:).
Trait Implementations§
Source§impl Clone for SingleChildScrollView
impl Clone for SingleChildScrollView
Source§impl Debug for SingleChildScrollView
impl Debug for SingleChildScrollView
Source§impl Default for SingleChildScrollView
impl Default for SingleChildScrollView
Source§fn default() -> SingleChildScrollView
fn default() -> SingleChildScrollView
Source§impl StatelessWidget for SingleChildScrollView
impl StatelessWidget for SingleChildScrollView
Source§fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef
fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef
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 debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl !RefUnwindSafe for SingleChildScrollView
impl !Send for SingleChildScrollView
impl !Sync for SingleChildScrollView
impl !UnwindSafe for SingleChildScrollView
impl Forget for SingleChildScrollView
impl Freeze for SingleChildScrollViewwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
NonZero<u32>: Freeze,
&'static ScrollControllerVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const RcInner<dyn ScrollPhysics> is !null: Freeze,
PhantomData<RcInner<dyn ScrollPhysics>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
impl Move for SingleChildScrollView
impl Unpin for SingleChildScrollView
impl UnsafeUnpin for SingleChildScrollViewwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
&'static ScrollControllerVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
*const RcInner<dyn ScrollPhysics> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn ScrollPhysics>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.