sweeten your daily iced brew
Overview
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.
Installation
If you're using the latest iced release:
If you're tracking iced from git, add this to your Cargo.toml:
= { = "https://github.com/airstrike/sweeten", = "master" }
Current Features
MouseArea
A 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
.on_press_with,
PickList
A sweetened version of iced's PickList which accepts an optional closure to
disable some items. Use it like:
pick_list
.placeholder;
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.
TextInput
A sweetened version of iced's text_input widget with additional focus-related features:
.on_focusand.on_blurmethods for handling focus events- Sweetened
focus_nextandfocus_previousfocus management functions, which return the ID of the focused element
Row and Column
Sweetened versions of iced's Row and Column with drag-and-drop reordering
support via .on_drag:
use column;
use DragEvent;
column
.spacing
.on_drag
.into
Examples
For complete examples, see examples/ or run an example like this:
Other examples include:
Code Structure
The library is organized into modules for each enhanced widget:
widget/: Contains all widget implementationsmouse_area.rs: Sweetened mouse interaction handlingpick_list.rs: Sweetened pick list with item disablingtext_input.rs: Sweetened text input with focus handling- (more widgets coming soon!)
Planned Features
- MouseArea widget
- PickList widget
- TextInput widget with focus management
- Row and Column with drag and drop
Contributing
Contributions are welcome! If you have ideas for new widgets or enhancements:
- Fork the repository
- Create a feature branch
- Implement your changes with tests
- Submit a PR
License
MIT