use std::{sync::Arc, time::Duration};
use parking_lot::Mutex;
use crate::{
animation::{Easing, Transition},
app::{
component::Component,
ctx::{Ctx, Modal, Root, Timeout},
events::{GesturePhase, PanEvent},
},
components::{Column, Row, Stack},
core::{ElementRef, Signal},
layout::{StackAlignment, layout_kind::ScrollState},
node::{Element, color::Color, dimension::Dimension, transform::Transform2D},
ui::{Recipe, Themed, engine_look::EngineLook, names},
};
const FILL: Dimension = Dimension::Pct(100.0);
const BEGIN: Duration = Duration::from_millis(1);
const SETTLE_AFTER: Duration = Duration::from_millis(50);
const UNDER: f32 = 400.0;
const RESISTANCE: f32 = 0.55;
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SheetDetent {
Medium,
Large,
Fraction(f32),
Height(f32),
Content,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct SheetStyle {
pub background: Color,
pub corner_radius: f32,
pub backdrop: Color,
pub dim: f32,
pub grabber: bool,
pub grabber_color: Color,
pub grabber_width: f32,
pub grabber_height: f32,
pub grabber_top: f32,
pub top_margin: f32,
pub max_width: f32,
pub duration: Duration,
pub throw: f32,
}
const LEGACY_BACKGROUND: Color = Color::new(255, 255, 255, 255);
const LEGACY_BACKDROP: Color = Color::new(0, 0, 0, 255);
const LEGACY_DIM: f32 = 0.3;
const LEGACY_GRABBER: Color = Color::new(60, 60, 67, 77);
impl Default for SheetStyle {
fn default() -> Self {
let look = EngineLook::of::<Self>(&[]);
Self {
background: look.background(SheetNode::Panel, LEGACY_BACKGROUND),
corner_radius: 20.0,
backdrop: look.background(SheetNode::Backdrop, LEGACY_BACKDROP),
dim: look.opacity(SheetNode::Backdrop, LEGACY_DIM),
grabber: false,
grabber_color: look.background(SheetNode::Grabber, LEGACY_GRABBER),
grabber_width: 36.0,
grabber_height: 5.0,
grabber_top: 5.0,
top_margin: 10.0,
max_width: f32::INFINITY,
duration: Duration::from_millis(500),
throw: 0.15,
}
}
}
impl Themed for SheetStyle {
const NAME: &'static str = "phone_sheet";
type Renderer = ();
fn recipe() -> Recipe {
use crate::app::theme::PaletteColor::{Background, Input, Scrim};
Recipe::new()
.base(SheetNode::Panel, |s| s.background(Background))
.base(SheetNode::Grabber, |s| s.background(Input))
.base(SheetNode::Backdrop, |s| s.background(Scrim).opacity(1.0))
}
}
impl SheetStyle {
pub fn new() -> Self {
Self::default()
}
pub(crate) fn legacy_recipe() -> Recipe {
Recipe::new()
.base(SheetNode::Panel, |s| s.background(LEGACY_BACKGROUND))
.base(SheetNode::Grabber, |s| s.background(LEGACY_GRABBER))
.base(SheetNode::Backdrop, |s| {
s.background(LEGACY_BACKDROP).opacity(LEGACY_DIM)
})
}
#[deprecated(
since = "0.63.0",
note = "the theme's appearance gives the dark colors: `SheetStyle::new()` built in a dark theme is dark"
)]
pub fn dark() -> Self {
Self {
background: Color::from_hex("#1C1C1E"),
grabber_color: Color::new(235, 235, 245, 77),
backdrop: LEGACY_BACKDROP,
dim: 0.5,
..Self::default()
}
}
#[deprecated(
since = "0.63.0",
note = "the theme's appearance gives the colors: `SheetStyle::new()` is light or dark as the theme is"
)]
#[allow(deprecated)]
pub fn for_appearance(appearance: crate::app::window::Appearance) -> Self {
match appearance {
crate::app::window::Appearance::Light => Self {
background: LEGACY_BACKGROUND,
grabber_color: LEGACY_GRABBER,
backdrop: LEGACY_BACKDROP,
dim: LEGACY_DIM,
..Self::default()
},
crate::app::window::Appearance::Dark => Self::dark(),
}
}
pub fn background(mut self, color: Color) -> Self {
self.background = color;
self
}
pub fn corner_radius(mut self, radius: f32) -> Self {
self.corner_radius = radius;
self
}
pub fn dim(mut self, dim: f32) -> Self {
self.dim = dim;
self
}
pub fn grabber(mut self, grabber: bool) -> Self {
self.grabber = grabber;
self
}
}
type SheetContent = Arc<dyn Fn(&mut Ctx) -> Element + Send + Sync>;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SheetNode {
Backdrop,
Panel,
Grabber,
}
names!(SheetNode {
Backdrop => "backdrop",
Panel => "panel",
Grabber => "grabber",
});
pub type SheetDress = Arc<dyn Fn(SheetNode, Column) -> Column + Send + Sync>;
#[derive(Clone)]
pub struct SheetProps {
open: Signal<bool>,
detents: Vec<SheetDetent>,
detent: Option<Signal<usize>>,
style: SheetStyle,
dismissable: bool,
escape: Option<bool>,
takes_focus: bool,
dress: Option<SheetDress>,
scroll: Option<ScrollState>,
content: Option<SheetContent>,
on_dismiss: Vec<Arc<dyn Fn() + Send + Sync>>,
}
impl PartialEq for SheetProps {
fn eq(&self, other: &Self) -> bool {
let same_scroll = match (&self.scroll, &other.scroll) {
(None, None) => true,
(Some(a), Some(b)) => a.same(b),
_ => false,
};
self.open.id() == other.open.id()
&& self.detents == other.detents
&& self.detent.as_ref().map(Signal::id) == other.detent.as_ref().map(Signal::id)
&& self.style == other.style
&& self.dismissable == other.dismissable
&& self.escape == other.escape
&& self.takes_focus == other.takes_focus
&& match (&self.dress, &other.dress) {
(None, None) => true,
(Some(a), Some(b)) => Arc::ptr_eq(a, b),
_ => false,
}
&& same_scroll
&& match (&self.content, &other.content) {
(None, None) => true,
(Some(a), Some(b)) => Arc::ptr_eq(a, b),
_ => false,
}
&& self.on_dismiss.len() == other.on_dismiss.len()
&& self
.on_dismiss
.iter()
.zip(&other.on_dismiss)
.all(|(a, b)| Arc::ptr_eq(a, b))
}
}
#[cfg(feature = "devtools")]
impl crate::app::component::DevtoolsInspectable for SheetProps {
fn write_info(&self, _buffer: &mut Vec<crate::app::component::ComponentInfo>) {}
}
impl SheetProps {
pub fn new(open: Signal<bool>) -> Self {
Self {
open,
detents: vec![SheetDetent::Content],
detent: None,
style: SheetStyle::default(),
dismissable: true,
escape: None,
takes_focus: false,
dress: None,
scroll: None,
content: None,
on_dismiss: Vec::new(),
}
}
pub fn detents(mut self, detents: impl IntoIterator<Item = SheetDetent>) -> Self {
let detents: Vec<SheetDetent> = detents.into_iter().collect();
if !detents.is_empty() {
self.detents = detents;
}
self
}
pub fn detent(mut self, detent: Signal<usize>) -> Self {
self.detent = Some(detent);
self
}
pub fn style(mut self, style: SheetStyle) -> Self {
self.style = style;
self
}
pub fn dismissable(mut self, dismissable: bool) -> Self {
self.dismissable = dismissable;
self
}
pub fn dismiss_on_escape(mut self, dismiss: bool) -> Self {
self.escape = Some(dismiss);
self
}
pub fn takes_focus(mut self, takes: bool) -> Self {
self.takes_focus = takes;
self
}
pub fn dress(mut self, dress: impl Fn(SheetNode, Column) -> Column + Send + Sync + 'static) -> Self {
self.dress = Some(Arc::new(dress));
self
}
pub fn on_dismiss(mut self, handler: impl Fn() + Send + Sync + 'static) -> Self {
self.on_dismiss.push(Arc::new(handler));
self
}
pub fn scroll(mut self, scroll: ScrollState) -> Self {
self.scroll = Some(scroll);
self
}
}
#[derive(Clone, Copy, PartialEq, Debug)]
enum Phase {
Closed,
Entering { started: bool },
Open,
Moving,
Leaving,
}
struct State {
phase: Phase,
begin_due: bool,
velocity: f64,
at: usize,
held: Option<f32>,
content_height: f32,
padded_by: f32,
tops: Vec<f32>,
room: f32,
receded: Receded,
told: Receded,
host: Option<Behind>,
}
#[derive(Clone, Copy, PartialEq, Debug)]
struct Receded {
share: f32,
pace: Duration,
curve: Easing,
}
#[cfg(feature = "devtools")]
impl crate::app::component::DevtoolsInspectable for Receded {
fn write_info(&self, _buffer: &mut Vec<crate::app::component::ComponentInfo>) {}
}
impl Receded {
const NONE: Self = Self {
share: 0.0,
pace: Duration::ZERO,
curve: Easing::Linear,
};
}
#[derive(Clone)]
struct Behind {
receded: Signal<Receded>,
}
#[derive(Clone, Default)]
pub(crate) struct SheetScroll(pub(crate) Arc<Mutex<Option<ScrollState>>>);
const NO_DRAG: f32 = f32::MIN;
pub struct Sheet {
state: Arc<Mutex<State>>,
changed: Signal<u64>,
drag: Signal<f32>,
detent: Signal<usize>,
begin: Timeout,
settle: Timeout,
content: ElementRef,
scroll: SheetScroll,
}
impl Sheet {
pub fn mount(ctx: &mut Ctx, props: SheetProps, content: impl Into<Element>) -> Element {
ctx.mount_with::<Self>(props, vec![content.into()])
}
pub fn mount_with(
ctx: &mut Ctx,
mut props: SheetProps,
content: impl Fn(&mut Ctx) -> Element + Send + Sync + 'static,
) -> Element {
props.content = Some(Arc::new(content));
ctx.mount::<Self>(props)
}
pub fn mount_keyed_with(
ctx: &mut Ctx,
key: &str,
mut props: SheetProps,
content: impl Fn(&mut Ctx) -> Element + Send + Sync + 'static,
) -> Element {
props.content = Some(Arc::new(content));
ctx.mount_keyed::<Self>(key, props)
}
pub fn mount_keyed(ctx: &mut Ctx, key: &str, props: SheetProps, content: impl Into<Element>) -> Element {
ctx.mount_keyed_with::<Self>(key, props, vec![content.into()])
}
}
fn height_of(detent: SheetDetent, room: f32, large: f32, bottom: f32, keyboard: f32, content: f32) -> f32 {
let height = match detent {
SheetDetent::Medium => room * 0.5 + keyboard,
SheetDetent::Large => large,
SheetDetent::Fraction(share) => large * share.clamp(0.0, 1.0) + keyboard,
SheetDetent::Height(height) => height + bottom,
SheetDetent::Content => content + bottom,
};
height.clamp(0.0, large.max(0.0))
}
impl Component for Sheet {
type Props = SheetProps;
fn create(ctx: &mut Ctx) -> Self {
ctx.provide(crate::app::ctx::SafeAreaTaken);
let scroll = SheetScroll::default();
ctx.provide(scroll.clone());
let state = Arc::new(Mutex::new(State {
phase: Phase::Closed,
begin_due: false,
velocity: 0.0,
at: 0,
held: None,
content_height: 0.0,
padded_by: 0.0,
tops: Vec::new(),
room: 0.0,
receded: Receded::NONE,
told: Receded::NONE,
host: None,
}));
let changed = Signal::new(0u64);
let begin = ctx.create_timeout(BEGIN, {
let (state, changed) = (state.clone(), changed.clone());
move || {
if let Phase::Entering { started } = &mut state.lock().phase {
*started = true;
}
changed.update(|version| *version += 1);
}
});
let duration = ctx.props::<SheetProps>().style.duration;
let settle = ctx.create_timeout(duration + SETTLE_AFTER, {
let (state, changed) = (state.clone(), changed.clone());
move || {
{
let mut state = state.lock();
state.phase = match state.phase {
Phase::Leaving | Phase::Closed => Phase::Closed,
_ => Phase::Open,
};
state.velocity = 0.0;
}
changed.update(|version| *version += 1);
}
});
Self {
state,
changed,
drag: Signal::new(NO_DRAG),
detent: Signal::new(0),
begin,
settle,
content: ElementRef::default(),
scroll,
}
}
fn render(&self, ctx: &mut Ctx) -> impl Into<Element> {
let props = ctx.props::<SheetProps>().clone();
let style = props.style;
let open = props.open.get();
let _ = self.changed.get();
let drag = self.drag.get();
let detent = props.detent.clone().unwrap_or_else(|| self.detent.clone());
let at = detent.get().min(props.detents.len() - 1);
let window = ctx.window();
let room = (window.logical_height() - window.title_bar_inset()).max(0.0);
let safe_area = window.safe_area;
let large = room - safe_area.top - style.top_margin;
let mut state = self.state.lock();
match (open, state.phase) {
(true, Phase::Closed) => {
state.phase = Phase::Entering { started: false };
state.velocity = 0.0;
state.held = None;
state.begin_due = true;
self.settle.restart();
}
(true, Phase::Leaving) => {
state.phase = Phase::Moving;
self.settle.restart();
}
(false, Phase::Entering { .. } | Phase::Open | Phase::Moving) => {
state.phase = Phase::Leaving;
state.held = None;
ctx.blur();
self.begin.cancel();
self.settle.restart();
}
_ => {}
}
if state.phase == Phase::Open && state.at != at {
state.phase = Phase::Moving;
self.settle.restart();
}
state.at = at;
state.host = ctx.use_context::<Behind>();
if state.phase == Phase::Closed {
state.receded = Receded::NONE;
return Element::from(Modal::new(Element::new()).open_when(false));
}
let heights: Vec<f32> = props
.detents
.iter()
.map(|detent| {
height_of(
*detent,
room,
large,
safe_area.bottom,
safe_area.keyboard,
state.content_height,
)
})
.collect();
state.tops = heights.iter().map(|height| room - height).collect();
state.room = room;
let height = heights[at];
let highest = heights.iter().copied().fold(0.0, f32::max);
let lowest = heights.iter().copied().fold(f32::INFINITY, f32::min);
let dragged = drag != NO_DRAG;
let reduce_motion = window.system.reduce_motion;
let away = matches!(state.phase, Phase::Entering { started: false } | Phase::Leaving);
let top = match state.phase {
Phase::Entering { started: false } | Phase::Leaving if !reduce_motion => room,
_ if dragged => {
let top = room - height + drag;
let limit = room - highest;
if top < limit {
let over = limit - top;
limit - over * RESISTANCE * room / (room + RESISTANCE * over)
} else if !props.dismissable && top > room - lowest {
let (limit, over) = (room - lowest, top - (room - lowest));
limit + over * RESISTANCE * room / (room + RESISTANCE * over)
} else {
top
}
}
_ => room - height,
};
let moving = !dragged
&& matches!(
state.phase,
Phase::Entering { started: true } | Phase::Moving | Phase::Leaving
);
let pace = if moving { style.duration } else { Duration::ZERO };
let curve = Easing::Spring {
velocity: state.velocity,
};
let up = if reduce_motion && away {
0.0
} else if lowest > 0.0 {
((room - top) / lowest).clamp(0.0, 1.0)
} else {
0.0
};
let fits_content = props.detents[at] == SheetDetent::Content;
state.padded_by = safe_area.bottom;
let reaches = highest >= large - 1.0 && large > 0.0;
let under = heights
.iter()
.copied()
.filter(|height| *height < highest - 1.0)
.fold(0.0, f32::max);
state.receded = Receded {
share: if reaches {
((room - top - under) / (highest - under)).clamp(0.0, 1.0)
} else {
0.0
},
pace,
curve,
};
drop(state);
let dress = |node: SheetNode, column: Column| match &props.dress {
Some(dress) => dress(node, column),
None => column,
};
let backdrop = Column::new().size(FILL, FILL).background(style.backdrop);
let backdrop = dress(SheetNode::Backdrop, backdrop)
.opacity(style.dim * up)
.transition(Transition::opacity().duration(pace).easing(curve))
.on_click({
let (open, dismissable, told) = (props.open.clone(), props.dismissable, props.on_dismiss.clone());
move |_| {
if dismissable {
open.set(false);
for handler in &told {
handler();
}
}
}
});
let mut content = Column::new()
.ref_element(self.content.clone())
.width(FILL)
.padding_bottom(safe_area.bottom)
.padding_left(safe_area.left)
.padding_right(safe_area.right);
content = if fits_content {
content.max_height(large.max(0.0))
} else {
let shown = if dragged && !away {
(room - top).clamp(lowest, highest)
} else {
height
};
content
.height(shown)
.transition(Transition::height().duration(pace).easing(curve))
};
if let Some(build) = &props.content {
content = content.child(build(ctx));
}
for child in ctx.children() {
content = content.child(child.clone());
}
let mut body = Stack::new().width(FILL).child(content.clip());
if style.grabber {
body = body.child(
Row::new()
.width(FILL)
.padding_top(style.grabber_top)
.justify(crate::layout::layout_kind::Justify::Center)
.pointer_events_none()
.child(dress(
SheetNode::Grabber,
Column::new()
.width(style.grabber_width)
.height(style.grabber_height)
.rounded(style.grabber_height / 2.0)
.background(style.grabber_color),
)),
);
}
let panel = Column::new()
.id("sheet")
.width(FILL)
.max_width(style.max_width)
.height(room + UNDER)
.background(style.background)
.rounded(style.corner_radius)
.clip();
let panel = dress(SheetNode::Panel, panel)
.child(body)
.opacity(if reduce_motion && away { 0.0 } else { 1.0 })
.transform(Transform2D::translate(0.0, top))
.transition(Transition::transform().duration(pace).easing(curve))
.transition(Transition::opacity().duration(pace).easing(curve))
.on_click(|_| {})
.on_pan({
let (state, drag, changed) = (self.state.clone(), self.drag.clone(), self.changed.clone());
let (open, detent, settle) = (props.open.clone(), detent.clone(), self.settle.clone());
let (told, found, dismissable) = (props.scroll.clone(), self.scroll.clone(), props.dismissable);
let dismissed = props.on_dismiss.clone();
move |event: PanEvent| {
let mut state = state.lock();
match event.phase {
GesturePhase::Start => {
if state.phase != Phase::Open || event.fingers != 1 {
return;
}
if event.translation_y.abs() <= event.translation_x.abs() {
return;
}
let top = state.tops.get(state.at).copied().unwrap_or(state.room);
let highest = state.tops.iter().copied().fold(f32::INFINITY, f32::min);
let at_highest = top <= highest + 0.5;
let takes = if event.translation_y > 0.0 {
let scroll = told.clone().or_else(|| found.0.lock().clone());
scroll.is_none_or(|scroll| scroll.scroll_y() <= 0.0)
} else {
!at_highest
};
if !takes {
return;
}
event.prevent_default();
event.stop_propagation();
state.held = Some(event.translation_y);
drop(state);
drag.set(0.0);
}
GesturePhase::Change => {
if let Some(from) = state.held {
event.stop_propagation();
drop(state);
drag.set(event.translation_y - from);
}
}
GesturePhase::End => {
let Some(from) = state.held.take() else {
return;
};
event.stop_propagation();
let stands = state.tops.get(state.at).copied().unwrap_or(state.room);
let highest = state.tops.iter().copied().fold(f32::INFINITY, f32::min);
let now = (stands + event.translation_y - from).max(highest);
let thrown = now + event.velocity_y * style.throw;
let mut goes = (None, state.room);
let mut nearest = if dismissable {
(thrown - state.room).abs()
} else {
f32::INFINITY
};
for (index, top) in state.tops.iter().enumerate() {
if (thrown - top).abs() < nearest {
nearest = (thrown - top).abs();
goes = (Some(index), *top);
}
}
let left = goes.1 - now;
state.velocity = if left.abs() > 1.0 {
f64::from((event.velocity_y * style.duration.as_secs_f32() / left).max(0.0))
} else {
0.0
};
state.phase = Phase::Moving;
let at = state.at;
drop(state);
drag.set(NO_DRAG);
settle.restart();
match goes.0 {
Some(index) if index != at => detent.set(index),
Some(_) => changed.update(|version| *version += 1),
None => {
open.set(false);
for handler in &dismissed {
handler();
}
}
}
}
}
}
});
let layer = Stack::new()
.size(FILL, FILL)
.stack_align(StackAlignment::TopCenter)
.child(backdrop)
.child(panel);
let mut modal = Modal::new(layer)
.open_when(true)
.target(Root)
.takes_focus(props.takes_focus);
modal = if props.escape.unwrap_or(props.dismissable) {
let told = props.on_dismiss.clone();
let modal = modal.dismisses(props.open.clone());
if told.is_empty() {
modal
} else {
modal.on_dismiss(move || {
for handler in &told {
handler();
}
})
}
} else {
modal.dismiss_on_escape(false)
};
modal.into()
}
fn after_layout(&self) {
let mut state = self.state.lock();
if state.receded != state.told {
state.told = state.receded;
if let Some(host) = &state.host {
host.receded.set(state.receded);
}
}
if state.phase == Phase::Closed {
return;
}
let mut changed = false;
if self.content.is_attached() {
let height = (self.content.rect().3 - state.padded_by).max(0.0);
if (state.content_height - height).abs() > 0.25 {
state.content_height = height;
changed = true;
}
}
if std::mem::take(&mut state.begin_due) {
self.begin.restart();
}
drop(state);
if changed {
self.changed.update(|version| *version += 1);
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct SheetHostStyle {
pub scale: f32,
pub corner_radius: f32,
pub background: Color,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SheetHostPart {
Root,
}
names!(SheetHostPart { Root => "root" });
const HOST_BLACK: Color = Color::new(0, 0, 0, 255);
impl Themed for SheetHostStyle {
const NAME: &'static str = "phone_sheet_host";
type Renderer = ();
fn recipe() -> Recipe {
Recipe::new().base(SheetHostPart::Root, |s| s.background(HOST_BLACK))
}
}
impl SheetHostStyle {
pub(crate) fn legacy_recipe() -> Recipe {
Self::recipe()
}
}
impl Default for SheetHostStyle {
fn default() -> Self {
let look = EngineLook::of::<Self>(&[]);
Self {
scale: 0.92,
corner_radius: 12.0,
background: look.background(SheetHostPart::Root, HOST_BLACK),
}
}
}
#[derive(Clone)]
pub struct SheetHostProps {
style: SheetHostStyle,
content: SheetContent,
}
impl PartialEq for SheetHostProps {
fn eq(&self, other: &Self) -> bool {
self.style == other.style && Arc::ptr_eq(&self.content, &other.content)
}
}
#[cfg(feature = "devtools")]
impl crate::app::component::DevtoolsInspectable for SheetHostProps {
fn write_info(&self, _buffer: &mut Vec<crate::app::component::ComponentInfo>) {}
}
pub struct SheetHost {
receded: Signal<Receded>,
}
impl SheetHost {
pub fn mount(ctx: &mut Ctx, content: impl Fn(&mut Ctx) -> Element + Send + Sync + 'static) -> Element {
Self::mount_with(ctx, SheetHostStyle::default(), content)
}
pub fn mount_with(
ctx: &mut Ctx,
style: SheetHostStyle,
content: impl Fn(&mut Ctx) -> Element + Send + Sync + 'static,
) -> Element {
ctx.mount::<Self>(SheetHostProps {
style,
content: Arc::new(content),
})
}
}
impl Component for SheetHost {
type Props = SheetHostProps;
fn create(ctx: &mut Ctx) -> Self {
let receded = Signal::new(Receded::NONE);
ctx.provide(Behind {
receded: receded.clone(),
});
Self { receded }
}
fn render(&self, ctx: &mut Ctx) -> impl Into<Element> {
let props = ctx.props::<SheetHostProps>().clone();
let style = props.style;
let receded = self.receded.get();
let window = ctx.window();
let (room, top) = (window.logical_height(), window.safe_area.top);
let scale = 1.0 - (1.0 - style.scale) * receded.share;
let down = receded.share * (top - room * (1.0 - style.scale) / 2.0);
let content = Stack::new()
.size(FILL, FILL)
.rounded(style.corner_radius * receded.share)
.clip()
.transform(Transform2D::translate(0.0, down).then(&Transform2D::scale_uniform(scale)))
.transition(Transition::transform().duration(receded.pace).easing(receded.curve))
.child((props.content)(ctx));
Stack::new()
.size(FILL, FILL)
.background(style.background)
.child(content)
}
}