Introduce selector flag and decouple iced_widget from iced_runtime
This commit is contained in:
parent
34a42b5ad4
commit
81d1eda7fe
22 changed files with 118 additions and 67 deletions
18
runtime/src/widget/selector.rs
Normal file
18
runtime/src/widget/selector.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//! Find and query widgets in your applications.
|
||||
pub use iced_selector::Selector;
|
||||
|
||||
pub use iced_selector::target::{Bounded, Match, Target, Text};
|
||||
|
||||
use crate::Task;
|
||||
use crate::core::widget;
|
||||
use crate::task;
|
||||
|
||||
/// Finds a widget by the given [`widget::Id`].
|
||||
pub fn find_by_id(id: impl Into<widget::Id>) -> Task<Option<Match>> {
|
||||
task::widget(id.into().find())
|
||||
}
|
||||
|
||||
/// Finds a widget that contains the given text.
|
||||
pub fn find_by_text(text: impl Into<String>) -> Task<Option<Text>> {
|
||||
task::widget(Selector::find(text.into()))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue