Seregon/StratoSDK

StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.

Rust/27.3 KB/No license
crates/strato-widgets/src/lib.rs
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 
6pub mod animation;
7pub mod builder;
8pub mod button;
9pub mod checkbox;
10pub mod container;
11pub mod control;
12pub mod dropdown;
13pub mod grid;
14pub mod image;
15pub mod input;
16pub mod inspector;
17pub mod layout;
18pub mod registry;
19pub mod scroll_view;
20pub mod slider;
21pub mod text;
22pub mod theme;
23pub mod top_bar;
24pub mod widget;
25pub mod wrap;
26 
27pub mod prelude;
28use crate::prelude::*;
29 
30// Re-export all widget types for easy access
31pub use builder::WidgetBuilder;
32pub use button::{Button, ButtonStyle};
33pub use checkbox::{Checkbox, CheckboxStyle, RadioButton};
34pub use container::{Container, ContainerStyle};
35pub use control::{ControlRole, ControlSemantics, ControlState};
36pub use dropdown::{Dropdown, DropdownOption, DropdownStyle};
37pub use grid::{Grid, GridUnit};
38pub use image::{
39 Image, ImageBuilder, ImageData, ImageFilter, ImageFit, ImageFormat, ImageSource, ImageStyle,
40};
41pub use input::{InputStyle, InputType, TextInput};
42pub use inspector::InspectorOverlay;
43pub use layout::{Column, Flex, Row, Stack};
44pub use scroll_view::ScrollView;
45pub use slider::{ProgressBar, Slider, SliderStyle};
46pub use strato_macros::view;
47pub use text::{Text, TextStyle};
48pub use theme::Theme;
49pub use top_bar::TopBar;
50pub use widget::{Widget, WidgetContext, WidgetId};
51 
52/// Initialize the widgets module
53pub fn init() -> strato_core::Result<()> {
54 tracing::info!("StratoUI Widgets initialized");
55 Ok(())
56}
57 
58/// Create a simple app example
59pub 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)]
70mod 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