use fission::prelude::*;
fission_component! {
pub UnreadMessageCard<()> {
props {
content: Widget,
unread: bool,
}
}
view(card, _state, cx) {
let inset = cx.view.env().theme.tokens.spacing.s;
} =>
ZStack(
children: [
card.content.clone(),
if card.unread {
Positioned(
top: inset,
right: inset,
child: Tag(label: cx.tr("message.unread")),
)
},
],
)
}
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
id | Option<WidgetId> | Stable widget identity. | Defaults to None. |
left | Option<f32> | Distance from the parent's left edge. | Defaults to None. |
top | Option<f32> | Distance from the parent's top edge. | Defaults to None. |
right | Option<f32> | Distance from the parent's right edge. | Defaults to None. |
bottom | Option<f32> | Distance from the parent's bottom edge. | Defaults to None. |
width | Option<f32> | Explicit width for the child region. | Defaults to None. |
height | Option<f32> | Explicit height for the child region. | Defaults to None. |
child | Option<Widget> | The positioned child. | Defaults to None. |