🏗️ Use actions to decide component rendering

This commit is contained in:
Manuel Cillero 2024-04-15 02:06:39 +02:00
parent 45cb063e52
commit 7d4cf642ff
27 changed files with 125 additions and 304 deletions

View file

@ -13,7 +13,6 @@ pub enum ItemType {
#[derive(AutoDefault, ComponentClasses)]
pub struct Item {
id : OptionId,
renderable : Renderable,
classes : OptionClasses,
item_type : ItemType,
flex_grow : flex::Grow,
@ -33,10 +32,6 @@ impl ComponentTrait for Item {
self.id.get()
}
fn is_renderable(&self, cx: &Context) -> bool {
(self.renderable.check)(cx)
}
fn setup_before_prepare(&mut self, _cx: &mut Context) {
self.alter_classes(
ClassesOp::Prepend,
@ -129,12 +124,6 @@ impl Item {
self
}
#[fn_builder]
pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
self.renderable.check = check;
self
}
#[fn_builder]
pub fn alter_grow(&mut self, grow: flex::Grow) -> &mut Self {
self.flex_grow = grow;