Struct floem_ui_kit::theme::Theme
source · pub struct Theme {
pub accent_color: RwSignal<AccentColor>,
pub horizontal_window_margin: f32,
}
Expand description
Allows you to create any of the widgets supported by Floem UI Kit. The
Theme
struct contains any settings that will apply across the entire
UI.
use floem_ui_kit::accents::AccentColor;
use floem_ui_kit::theme::Theme;
let theme = Theme {
..Default::default()
};
Fields§
§accent_color: RwSignal<AccentColor>
Controls color variations of the theme. Wrapped in a signal so your UI may change appearance without restarting.
horizontal_window_margin: f32
UI elements generally shouldn’t stick to the edge of the window, but exceptions are sometimes necessary for decorative elements. To cover your use cases, you can set a horizontal window margin here. It does not do anything by default. You may however:
- Make use of the
padded_container
function to wrap your layout in an amount of padding equal to the target window margin. - Read the value of this field in your own code whenever you prefer to manually insert horizontal window margin.
Decorative UI elements containing text (such as Floem UI Kit’s own header) may hook in to this field to keep different parts of the window layout aligned.
Implementations§
source§impl Theme
impl Theme
sourcepub fn simple_header(self, title: &str) -> impl View
pub fn simple_header(self, title: &str) -> impl View
Instantiates a minimalistic decorative element containing a title.
source§impl Theme
impl Theme
sourcepub fn integer_input<T>(
self,
int_signal: RwSignal<T>,
step: T,
min_value: Option<T>,
max_value: Option<T>
) -> impl View
pub fn integer_input<T>( self, int_signal: RwSignal<T>, step: T, min_value: Option<T>, max_value: Option<T> ) -> impl View
Instantiates an input field that only accepts integer numeric input. Comes with up/down arrows allowing the user to increment/decrement the value in steps. If min_value and/or max_value are set, input is restricted to the given bounds.
source§impl Theme
impl Theme
sourcepub fn padded_container<V: View + 'static>(self, child: V) -> impl View
pub fn padded_container<V: View + 'static>(self, child: V) -> impl View
Wraps a stack of UI elements in the theme’s configured horizontal window margin, and applies a padding of the same amount in vertical direction for symmetry purposes. You’d ordinarily do this to prevent form widgets from sticking to the side of the window.
source§impl Theme
impl Theme
Instantiates one option in a radio group widget. For most use cases you’ll want Self::radio_group
instead.
Use Self::radio_button
to implement special accommodations such as non-standard layouts or to render
certain options as disabled.
sourcepub fn radio_group<T>(
self,
read_signal: ReadSignal<T>,
write_signal: WriteSignal<T>,
gap_between_items: f32,
variant: RadioGroupVariant
) -> impl View
pub fn radio_group<T>( self, read_signal: ReadSignal<T>, write_signal: WriteSignal<T>, gap_between_items: f32, variant: RadioGroupVariant ) -> impl View
Instantiates a radio group widget for given enum T. For the display of labels, we rely on
the Display
trait. We ask that your enum derives EnumIter
so the radio group may list
all available options. Options can be laid out horizontally or vertically. A configurable
gap is inserted between items.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnwindSafe for Theme
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.