plushie/widget/container

Container widget builder (generic layout and styling).

Types

Background can be a solid color or a gradient.

pub type Background {
  ColorBackground(color.Color)
  GradientBackground(gradient.Gradient)
}

Constructors

pub opaque type Container

Option type for container properties.

pub type Opt {
  Padding(padding.Padding)
  Width(length.Length)
  Height(length.Length)
  MaxWidth(Float)
  MaxHeight(Float)
  Center(Bool)
  Clip(Bool)
  AlignX(alignment.Alignment)
  AlignY(alignment.Alignment)
  BgColor(color.Color)
  BgGradient(gradient.Gradient)
  TextColor(color.Color)
  Border(border.Border)
  Shadow(shadow.Shadow)
  Style(String)
  A11y(a11y.A11y)
}

Constructors

Values

pub fn a11y(c: Container, a: a11y.A11y) -> Container

Set accessibility properties for this widget.

pub fn align_x(c: Container, a: alignment.Alignment) -> Container

Set the horizontal alignment.

pub fn align_y(c: Container, a: alignment.Alignment) -> Container

Set the vertical alignment.

pub fn background(c: Container, col: color.Color) -> Container

Set a solid color background.

pub fn border(c: Container, b: border.Border) -> Container

Set the border.

pub fn build(c: Container) -> node.Node

Build the container into a renderable Node.

pub fn center(c: Container, enabled: Bool) -> Container

Set whether content is centered.

pub fn clip(c: Container, enabled: Bool) -> Container

Set whether overflowing content is clipped.

pub fn color(c: Container, col: color.Color) -> Container

Set the color.

pub fn extend(
  c: Container,
  children: List(node.Node),
) -> Container

Add multiple child nodes.

pub fn gradient_background(
  c: Container,
  g: gradient.Gradient,
) -> Container

Set a gradient background.

pub fn height(c: Container, h: length.Length) -> Container

Set the height.

pub fn height_animated(
  c: Container,
  animation: node.PropValue,
) -> Container

Set height to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn max_height(c: Container, m: Float) -> Container

Set the maximum height in pixels.

pub fn max_height_animated(
  c: Container,
  animation: node.PropValue,
) -> Container

Set max_height to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn max_width(c: Container, m: Float) -> Container

Set the maximum width.

pub fn max_width_animated(
  c: Container,
  animation: node.PropValue,
) -> Container

Set max_width to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn new(id: String) -> Container

Create a new container builder.

pub fn padding(c: Container, p: padding.Padding) -> Container

Set the padding.

pub fn padding_animated(
  c: Container,
  animation: node.PropValue,
) -> Container

Set padding to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn push(c: Container, child: node.Node) -> Container

Add a child node.

pub fn shadow(c: Container, s: shadow.Shadow) -> Container

Set the shadow.

pub fn style(c: Container, s: String) -> Container

Set the style.

pub fn width(c: Container, w: length.Length) -> Container

Set the width.

pub fn width_animated(
  c: Container,
  animation: node.PropValue,
) -> Container

Set width to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn with_opts(c: Container, opts: List(Opt)) -> Container

Apply a list of options to a container builder.

Search Document