Incular logoIncular
API ReferenceNavigation & Scrolling

DraggableScrollableSheet

Bottom sheets with fractional extents, snap, and nested deltas.

DraggableScrollableSheet builds its child around an inner ScrollController; DraggableScrollableController drives size programmatically.

use incular::prelude::*;

fn main() {
    let sheet = DraggableScrollableSheet::new(|_inner| Text::new("Sheet"))
        .extents(0.25, 1.0, 0.5)
        .expand(true)
        .should_close_on_min_extent(true)
        .snap(vec![0.25, 0.5, 1.0], std::time::Duration::from_millis(125));
    let controller = sheet.controller();
    controller.jump_to(0.75);
    println!("size: {:?}", controller.size());
    let app = Application::new(|_cx| {
        Container::builder()
            .padding(EdgeInsets::all(24.0))
            .alignment(Alignment::CENTER)
            .child(Text::new("Sheet configured"))
            .build()
            .into()
    })
    .expect("valid application");
    incular::run(app).expect("run application");
}

DraggableSheetExtent snapshot: min/max/initial/current_size, is_at_min() / is_at_max(), pixels_to_size() / size_to_pixels(). DraggableSheetDelta splits one gesture into sheet/inner/parent/unconsumed parts. DraggableSnap { enabled, sizes, animation_duration } resolves via snap_target(velocity). DraggableScrollableState (mounted handle): inner_controller(), set_inner_physics(), apply_user_offset(), add_notification_listener() (→ DraggableNotificationSubscription, DraggableScrollableNotification { min/max/extent/initial/… }), attach_actuator() (DraggableScrollableActuator::reset()). DraggableSizeAnimation steps frames (Active / Completed / Interrupted via DraggableAnimationStep); DraggableSnapTarget { size, duration } is the resolved snap goal. DraggableAnimationStep: Active / Completed / Interrupted.

Related: ScrollController, SliverList.