StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.
| 1 | //! StratoUI Widgets - A comprehensive widget library for StratoUI |
| 2 | //! |
| 3 | //! This crate provides a collection of UI widgets built on top of the StratoUI core framework. |
| 4 | //! All widgets are designed to be composable, reactive, and performant. |
| 5 | |
| 6 | pub mod animation; |
| 7 | pub mod builder; |
| 8 | pub mod button; |
| 9 | pub mod checkbox; |
| 10 | pub mod container; |
| 11 | pub mod control; |
| 12 | pub mod dropdown; |
| 13 | pub mod grid; |
| 14 | pub mod image; |
| 15 | pub mod input; |
| 16 | pub mod inspector; |
| 17 | pub mod layout; |
| 18 | pub mod registry; |
| 19 | pub mod scroll_view; |
| 20 | pub mod slider; |
| 21 | pub mod text; |
| 22 | pub mod theme; |
| 23 | pub mod top_bar; |
| 24 | pub mod widget; |
| 25 | pub mod wrap; |
| 26 | |
| 27 | pub mod prelude; |
| 28 | use crate::prelude::*; |
| 29 | |
| 30 | // Re-export all widget types for easy access |
| 31 | pub use builder::WidgetBuilder; |
| 32 | pub use button::{Button, ButtonStyle}; |
| 33 | pub use checkbox::{Checkbox, CheckboxStyle, RadioButton}; |
| 34 | pub use container::{Container, ContainerStyle}; |
| 35 | pub use control::{ControlRole, ControlSemantics, ControlState}; |
| 36 | pub use dropdown::{Dropdown, DropdownOption, DropdownStyle}; |
| 37 | pub use grid::{Grid, GridUnit}; |
| 38 | pub use image::{ |
| 39 | Image, ImageBuilder, ImageData, ImageFilter, ImageFit, ImageFormat, ImageSource, ImageStyle, |
| 40 | }; |
| 41 | pub use input::{InputStyle, InputType, TextInput}; |
| 42 | pub use inspector::InspectorOverlay; |
| 43 | pub use layout::{Column, Flex, Row, Stack}; |
| 44 | pub use scroll_view::ScrollView; |
| 45 | pub use slider::{ProgressBar, Slider, SliderStyle}; |
| 46 | pub use strato_macros::view; |
| 47 | pub use text::{Text, TextStyle}; |
| 48 | pub use theme::Theme; |
| 49 | pub use top_bar::TopBar; |
| 50 | pub use widget::{Widget, WidgetContext, WidgetId}; |
| 51 | |
| 52 | /// Initialize the widgets module |
| 53 | pub fn init() -> strato_core::Result<()> { |
| 54 | tracing::info!("StratoUI Widgets initialized"); |
| 55 | Ok(()) |
| 56 | } |
| 57 | |
| 58 | /// Create a simple app example |
| 59 | pub fn example_app() -> impl Widget { |
| 60 | Container::new() |
| 61 | .padding(20.0) |
| 62 | .child(Column::new().spacing(10.0).children(vec![ |
| 63 | Box::new(Text::new("Welcome to StratoUI")), |
| 64 | Box::new(Button::new("Click Me")), |
| 65 | Box::new(TextInput::new().placeholder("Enter text...")), |
| 66 | ])) |
| 67 | } |
| 68 | |
| 69 | #[cfg(test)] |
| 70 | mod tests { |
| 71 | use super::*; |
| 72 | |
| 73 | #[test] |
| 74 | fn test_widget_creation() { |
| 75 | let button = Button::new("Test"); |
| 76 | assert_eq!(button.text(), "Test"); |
| 77 | } |
| 78 | } |
| 79 |