pub struct EnsureVisibleConfig {
pub alignment_y: f32,
pub alignment_x: f32,
pub animation: Option<ScrollAnimation>,
}Expand description
Configuration for [ensure_focused_visible].
Controls how the focused widget is positioned within the scrollable viewport after scrolling.
Fields§
§alignment_y: f32Vertical alignment of the focused widget within the viewport.
0.0— align to the top edge0.35— 35% from the top (Flutter Grid default)0.5— center vertically1.0— align to the bottom edge
alignment_x: f32Horizontal alignment of the focused widget within the viewport.
0.0— align to the left edge0.5— center horizontally1.0— align to the right edge
animation: Option<ScrollAnimation>Optional animation. When Some, the scrollable animates smoothly
to the target position. When None, it jumps instantly.
Implementations§
Source§impl EnsureVisibleConfig
impl EnsureVisibleConfig
Sourcepub const DEFAULT_ALIGNMENT: f32 = 0.35
pub const DEFAULT_ALIGNMENT: f32 = 0.35
Default alignment ratio (35% from the top/left of the viewport).
Sourcepub const CENTER: EnsureVisibleConfig
pub const CENTER: EnsureVisibleConfig
Align the focused widget to the center of the viewport on both axes. Animated by default.
Sourcepub fn new(alignment_y: f32, alignment_x: f32) -> EnsureVisibleConfig
pub fn new(alignment_y: f32, alignment_x: f32) -> EnsureVisibleConfig
Creates a config with custom vertical and horizontal alignment. Animated by default.
Sourcepub fn vertical(alignment_y: f32) -> EnsureVisibleConfig
pub fn vertical(alignment_y: f32) -> EnsureVisibleConfig
Creates a config with a custom vertical alignment.
Horizontal alignment defaults to Self::DEFAULT_ALIGNMENT. Animated by default.
Sourcepub const fn with_animation(
self,
animation: ScrollAnimation,
) -> EnsureVisibleConfig
pub const fn with_animation( self, animation: ScrollAnimation, ) -> EnsureVisibleConfig
Sets the animation configuration.
Sourcepub const fn instant(self) -> EnsureVisibleConfig
pub const fn instant(self) -> EnsureVisibleConfig
Disables animation — the scroll will jump instantly.
Trait Implementations§
Source§impl Clone for EnsureVisibleConfig
impl Clone for EnsureVisibleConfig
Source§fn clone(&self) -> EnsureVisibleConfig
fn clone(&self) -> EnsureVisibleConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EnsureVisibleConfig
Source§impl Debug for EnsureVisibleConfig
impl Debug for EnsureVisibleConfig
Source§impl Default for EnsureVisibleConfig
impl Default for EnsureVisibleConfig
Source§fn default() -> EnsureVisibleConfig
fn default() -> EnsureVisibleConfig
Default: 35% alignment on both axes, animated with default duration.