Move all operations to widget::operation module
This commit is contained in:
parent
885d45f435
commit
34a42b5ad4
14 changed files with 124 additions and 136 deletions
|
|
@ -37,8 +37,6 @@ use crate::core::{
|
|||
Length, Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector,
|
||||
Widget,
|
||||
};
|
||||
use crate::runtime::Action;
|
||||
use crate::runtime::task::{self, Task};
|
||||
|
||||
pub use operation::scrollable::{AbsoluteOffset, RelativeOffset};
|
||||
|
||||
|
|
@ -1262,42 +1260,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Produces a [`Task`] that snaps the [`Scrollable`] with the given [`widget::Id`]
|
||||
/// to the provided [`RelativeOffset`].
|
||||
pub fn snap_to<T>(
|
||||
id: impl Into<widget::Id>,
|
||||
offset: RelativeOffset,
|
||||
) -> Task<T> {
|
||||
task::effect(Action::widget(operation::scrollable::snap_to(
|
||||
id.into(),
|
||||
offset,
|
||||
)))
|
||||
}
|
||||
|
||||
/// Produces a [`Task`] that scrolls the [`Scrollable`] with the given [`widget::Id`]
|
||||
/// to the provided [`AbsoluteOffset`].
|
||||
pub fn scroll_to<T>(
|
||||
id: impl Into<widget::Id>,
|
||||
offset: AbsoluteOffset,
|
||||
) -> Task<T> {
|
||||
task::effect(Action::widget(operation::scrollable::scroll_to(
|
||||
id.into(),
|
||||
offset,
|
||||
)))
|
||||
}
|
||||
|
||||
/// Produces a [`Task`] that scrolls the [`Scrollable`] with the given [`widget::Id`]
|
||||
/// by the provided [`AbsoluteOffset`].
|
||||
pub fn scroll_by<T>(
|
||||
id: impl Into<widget::Id>,
|
||||
offset: AbsoluteOffset,
|
||||
) -> Task<T> {
|
||||
task::effect(Action::widget(operation::scrollable::scroll_by(
|
||||
id.into(),
|
||||
offset,
|
||||
)))
|
||||
}
|
||||
|
||||
fn notify_scroll<Message>(
|
||||
state: &mut State,
|
||||
on_scroll: &Option<Box<dyn Fn(Viewport) -> Message + '_>>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue