C+
Packages · View as Markdown
v0.0.27 is a macOS / AppKit release. That is the supported path. Other platforms are not recommended; wait for a later version.

flex_layout

A UI-kit-agnostic layout engine: CSS Flexbox and CSS Grid. It computes frames; an adapter applies them. facet's tree is this tree.

import "flex_layout/flex_layout" as flex;

var root: flex::Node = flex::Node::new();
root.set_flex_direction(flex::FlexDirection::Row);

var sidebar: flex::Node = flex::Node::new();
sidebar.set_width(flex::StyleLength::points(200.0f64));
root.add_child(sidebar);

var content: flex::Node = flex::Node::new();
content.set_flex_grow(1.0f64);
root.add_child(content);

root.calculate_layout(1024.0f64, 768.0f64, flex::Direction::LTR);

Grow, shrink, basis, justify/align, min/max, percent sizes, absolute placement, and measure callbacks. An optional @flex builder writes the same tree declaratively. flex_layout/responsive classifies a caller-supplied viewport against application-defined named breakpoints; it knows no devices.

[dependencies]
flex_layout = "*"