const MEDIA_MAX_WIDTH: f32 = 960.0;
const MEDIA_ASPECT_RATIO: f32 = 16.0 / 9.0;
let (_ctx, view) = fission::build::current::<MediaState>();
let spacing = &view.env().theme.tokens.spacing;
let style = BoxStyle::default()
.width(Length::percent(100.0))
.max_width(Length::points(MEDIA_MAX_WIDTH))
.padding_symmetric(
Length::points(spacing.xl),
Length::points(spacing.m),
)
.align(BoxAlignment::Center)
.overflow(Overflow::Clip)
.aspect_ratio(MEDIA_ASPECT_RATIO);
Container {
child: Some(MediaPreview.into()),
box_style: style,
..Default::default()
}
.into()
Field group | Methods |
|---|---|
Preferred size | width, height |
Min/max size | min_width, max_width, min_height, max_height |
Spacing | padding, padding_all, padding_symmetric, margin, margin_all, margin_symmetric |
Overflow | overflow |
Alignment | align |
Ratio | aspect_ratio |
Positioning | positioned |
Grid placement | grid |
Flex | flex |