Add is_focused function that produces an Operation to get the focused state of a focusable by ID.
Add `is_focused` function that produces a `Task` to get the focused state of a `text_input` by ID.
This commit is contained in:
parent
f1ed99cb47
commit
9cba92f57f
2 changed files with 50 additions and 0 deletions
|
|
@ -1481,6 +1481,11 @@ impl From<String> for Id {
|
|||
}
|
||||
}
|
||||
|
||||
/// Produces a [`Task`] that returns whether the [`TextInput`] with the given [`Id`] is focused or not.
|
||||
pub fn is_focused(id: impl Into<Id>) -> Task<bool> {
|
||||
task::widget(operation::focusable::is_focused(id.into().into()))
|
||||
}
|
||||
|
||||
/// Produces a [`Task`] that focuses the [`TextInput`] with the given [`Id`].
|
||||
pub fn focus<T>(id: impl Into<Id>) -> Task<T> {
|
||||
task::effect(Action::widget(operation::focusable::focus(id.into().0)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue