dropzone
Builds Dropzone


The code that drew it
A still frame holds a repeating animation at its first frame and a one-shot at its last, because a still of a moving thing is not reproducible. Run the gallery to review motion.
fn dropzone(_window: &mut Window, cx: &mut App) -> AnyElement {
let theme = cx.theme().clone();
// No single pointer position can produce all three states at once, so each
// zone is pinned to the one it is here to show.
stack(&theme)
.w(px(560.0))
.child(caption(&theme, "idle, accepting, refusing"))
.child(
row(&theme)
.items_stretch()
.child(
div().flex_1().child(
Dropzone::new("scene.dropzone.idle", "Drop files to attach")
.hint("PDF, PNG, or plain text")
.state(DropzoneState::Idle)
.on_files(|_, _, _| {}),
),
)
.child(
div().flex_1().child(
Dropzone::new("scene.dropzone.accepting", "Drop files to attach")
.hint("PDF, PNG, or plain text")
.state(DropzoneState::Accepting)
.on_files(|_, _, _| {}),
),
)
.child(
div().flex_1().child(
Dropzone::new("scene.dropzone.refusing", "Drop files to attach")
.refusal("A folder cannot be attached.")
.state(DropzoneState::Refusing)
.on_files(|_, _, _| {}),
),
),
)
.into_any_element()
}