Skip to main content

Crate smudge_widgets

Crate smudge_widgets 

Source
Expand description

The core widget set: layout containers, the button, the image, the scroll view and the virtual list.

The widgets here are built from the Panel the core provides, the Label the text crate provides, and the Widget trait directly, styled with theme tokens by default. A theme switch therefore repaints what these widgets show without any extra code.

use smudge_core::geometry::Size;
use smudge_core::style::px;
use smudge_widgets::{ButtonExt, button, column, scroll, spacer};

let toolbar = column()
    .width(px(200.0))
    .gap(Size {
        width: 8.0,
        height: 8.0,
    })
    .child(button("Save"))
    .child(button("Cancel").primary())
    .child(spacer())
    .child(scroll(column()).height(px(120.0)));

Structs§

ImageView
The widget behind image: it paints a panel’s background and border, then one image stretched over its content box.
ScrollView
A panel that clips its content and scrolls it with the wheel.

Traits§

ButtonExt
The appearance variants of a button.
ScrollExt
Controls the offset of a scroll view through a signal.

Functions§

button
Creates a push button that shows label_text.
column
Creates a container that lays its children out top to bottom.
image
Creates an image that stretches its source over the rectangle its style gives it.
row
Creates a container that lays its children out left to right.
scroll
Creates a view that clips content and scrolls it with the wheel.
spacer
Creates an empty box that takes the leftover space on the main axis.
stack
Creates a container whose children overlap.
virtual_list
Creates a list of count rows of one height inside a scroll view, with only the rows near the viewport mounted.
virtual_list_keyed
Creates a list of keyed rows of different heights inside a scroll view, with only the rows near the viewport mounted.