diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs index ff41377946..4856da03a9 100644 --- a/widget/src/text_input.rs +++ b/widget/src/text_input.rs @@ -1266,6 +1266,12 @@ impl From for widget::Id { } } +impl From for Id { + fn from(id: widget::Id) -> Self { + Id(id) + } +} + impl From<&'static str> for Id { fn from(id: &'static str) -> Self { Self::new(id) @@ -1283,6 +1289,11 @@ pub fn focus(id: impl Into) -> Task { task::effect(Action::widget(operation::focusable::focus(id.into().0))) } +/// Produces a [`Task`] that searches for a focused [`TextInput`] and returns the [`Id`] on success +pub fn find_focused() -> Task> { + task::widget(operation::focusable::find_focused()) +} + /// Produces a [`Task`] that moves the cursor of the [`TextInput`] with the given [`Id`] to the /// end. pub fn move_cursor_to_end(id: impl Into) -> Task {