Allow converting from widget-specific IDs to generic ID
This commit is contained in:
parent
23299a555f
commit
44aba47b0e
2 changed files with 12 additions and 0 deletions
|
|
@ -332,6 +332,12 @@ impl Id {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Id> for widget::Id {
|
||||
fn from(id: Id) -> Self {
|
||||
id.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Produces a [`Command`] that focuses the [`TextInput`] with the given [`Id`].
|
||||
pub fn focus<Message: 'static>(id: Id) -> Command<Message> {
|
||||
Command::widget(operation::focusable::focus(id.0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue