pub struct TileLayout { /* private fields */ }Expand description
A dashboard: tiles in a grid of cells, that people can drag to another place and resize. As the width falls, it uses fewer columns. From the keyboard, on a tile’s handle: arrows move it, Shift with arrows resizes it.
use ravenrs_reactive::State;
use ravenrs_widgets::{Text, Tile, TileLayout, TileSpot, Ui};
let spots = State::new(vec![TileSpot::new("sales", 2, 1)]);
let tiles = TileLayout::new(spots.binding())
.tile(Tile::new("sales", "Sales", Text::new("R$ 1.000")))
.tile(Tile::new("stock", "Stock", Text::new("42")));
let mut ui = Ui::new(tiles, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl TileLayout
impl TileLayout
Sourcepub fn new(spots: Binding<Vec<TileSpot>>) -> Self
pub fn new(spots: Binding<Vec<TileSpot>>) -> Self
A layout bound to where the tiles stand, to keep between sessions. Tiles not in the list take one cell, after the others.
Sourcepub fn columns(self, columns: usize) -> Self
pub fn columns(self, columns: usize) -> Self
The most columns, when there is room. 4 by default.
Sourcepub fn min_column_width(self, width: f32) -> Self
pub fn min_column_width(self, width: f32) -> Self
A column narrower than this makes the layout use one column less. 200 by default.
Sourcepub fn row_height(self, height: f32) -> Self
pub fn row_height(self, height: f32) -> Self
Height of a row of cells in logical pixels. 160 by default.
Trait Implementations§
Source§impl Debug for TileLayout
impl Debug for TileLayout
Auto Trait Implementations§
impl !RefUnwindSafe for TileLayout
impl !Send for TileLayout
impl !Sync for TileLayout
impl !UnwindSafe for TileLayout
impl Freeze for TileLayout
impl Unpin for TileLayout
impl UnsafeUnpin for TileLayout
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
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.