| Crates.io | sweeten |
| lib.rs | sweeten |
| version | 0.13.0 |
| created_at | 2024-10-26 01:12:41.27457+00 |
| updated_at | 2025-11-28 17:23:14.541819+00 |
| description | `sweeten` your daily `iced` brew |
| homepage | |
| repository | https://github.com/airstrike/sweeten |
| max_upload_size | |
| id | 1423448 |
| size | 406,669 |
sweeten provides sweetened versions of common iced widgets with additional
functionality for more complex use cases. It aims to maintain the simplicity and
elegance of iced while offering "sweetened" variants with extended
capabilities.
Add this to your Cargo.toml:
[dependencies]
sweeten = "0.1.0"
MouseAreaA sweetened version of iced's mouse_area widget with an additional
on_press_with method for capturing the click position with a closure. Use it
like:
mouse_area("Click me and I'll tell you where!",)
.on_press_with(|point| Message::ClickWithPoint(point)),
PickListA sweetened version of iced's PickList which accepts an optional closure to
disable some items. Use it like:
pick_list(
&Language::ALL[..],
Some(|languages: &[Language]| {
languages
.iter()
.map(|lang| matches!(lang, Language::Javascript))
.collect()
}),
self.selected_language,
Message::Pick,
)
.placeholder("Choose a language...");
Note that the compiler is not currently able to infer the type of the closure, so you may need to specify it explicitly as shown above.
TextInputA sweetened version of iced's text_input widget with additional focus-related features:
.on_focus and .on_blur methods for handling focus eventsfocus_next and focus_previous focus management functions, which return the ID of the focused elementFor complete examples, see examples/ or run an example like this:
cargo run --example mouse_area
Other examples include:
cargo run --example pick_list
cargo run --example text_input
The library is organized into modules for each enhanced widget:
widget/: Contains all widget implementations
mouse_area.rs: Sweetened mouse interaction handlingpick_list.rs: Sweetened pick list with item disablingtext_input.rs: Sweetened text input with focus handlingContributions are welcome! If you have ideas for new widgets or enhancements:
MIT