fn icon(ctx: WidgetContext) -> WidgetNode {
    // we use `portals_context_box` to allow this context box properly calculate context widget
    // relative to the portals container.
    make_widget!(portals_context_box)
        // pass pivot props to context box,
        .with_props(ctx.props.read_cloned_or_default::<PivotBoxProps>())
        .with_props(ContextBoxProps {
            // read bool props value and use it to tell if context widget is gonna be shown.
            show: ctx.props.read_cloned_or_default::<bool>(),
        })
        // put colored image box as content widget.
        .named_slot(
            "content",
            make_widget!(image_box).with_props(ImageBoxProps {
                material: ImageBoxMaterial::Color(ImageBoxColor {
                    color: ctx.props.read_cloned_or_default::<Color>(),
                    ..Default::default()
                }),
                width: ImageBoxSizeValue::Exact(100.0),
                height: ImageBoxSizeValue::Exact(100.0),
                ..Default::default()
            }),
        )
        // put gray image box as context widget.
        .named_slot(
            "context",
            make_widget!(image_box).with_props(ImageBoxProps {
                material: ImageBoxMaterial::Color(ImageBoxColor {
                    color: Color {
                        r: 0.25,
                        g: 0.25,
                        b: 0.25,
                        a: 1.0,
                    },
                    ..Default::default()
                }),
                width: ImageBoxSizeValue::Exact(150.0),
                height: ImageBoxSizeValue::Exact(50.0),
                ..Default::default()
            }),
        )
        .into()
}
// custom icon component composed out of icon image as its content and context image that we show
// when bool props value is true.
custom icon component composed out of icon image as its content and context image that we show
when bool props value is true.
custom icon component composed out of icon image as its content and context image that we show when bool props value is true .
fn icon(ctx: WidgetContext) -> WidgetNode {
    // we use `portals_context_box` to allow this context box properly calculate context widget
    // relative to the portals container.
    make_widget!(portals_context_box)
        // pass pivot props to context box,
        .with_props(ctx.props.read_cloned_or_default::<PivotBoxProps>())
        .with_props(ContextBoxProps {
            // read bool props value and use it to tell if context widget is gonna be shown.
            show: ctx.props.read_cloned_or_default::<bool>(),
        })
        // put colored image box as content widget.
        .named_slot(
            "content",
            make_widget!(image_box).with_props(ImageBoxProps {
                material: ImageBoxMaterial::Color(ImageBoxColor {
                    color: ctx.props.read_cloned_or_default::<Color>(),
                    ..Default::default()
                }),
                width: ImageBoxSizeValue::Exact(100.0),
                height: ImageBoxSizeValue::Exact(100.0),
                ..Default::default()
            }),
        )
        // put gray image box as context widget.
        .named_slot(
            "context",
            make_widget!(image_box).with_props(ImageBoxProps {
                material: ImageBoxMaterial::Color(ImageBoxColor {
                    color: Color {
                        r: 0.25,
                        g: 0.25,
                        b: 0.25,
                        a: 1.0,
                    },
                    ..Default::default()
                }),
                width: ImageBoxSizeValue::Exact(150.0),
                height: ImageBoxSizeValue::Exact(50.0),
                ..Default::default()
            }),
        )
        .into()
}
fn icon ( ctx : WidgetContext ) -> WidgetNode { // we use `portals_context_box` to allow this context box properly calculate context widget // relative to the portals container. make_widget ! ( portals_context_box ) // pass pivot props to context box, . with_props ( ctx . props . read_cloned_or_default :: < PivotBoxProps > ( ) ) . with_props ( ContextBoxProps { // read bool props value and use it to tell if context widget is gonna be shown. show : ctx . props . read_cloned_or_default :: < bool > ( ) , } ) // put colored image box as content widget. . named_slot ( " " , make_widget ! ( image_box ) . with_props ( ImageBoxProps { material : ImageBoxMaterial :: Color ( ImageBoxColor { color : ctx . props . read_cloned_or_default :: < Color > ( ) , .. Default :: default ( ) } ) , width : ImageBoxSizeValue :: Exact ( 100.0 ) , height : ImageBoxSizeValue :: Exact ( 100.0 ) , .. Default :: default ( ) } ) , ) // put gray image box as context widget. . named_slot ( " " , make_widget ! ( image_box ) . with_props ( ImageBoxProps { material : ImageBoxMaterial :: Color ( ImageBoxColor { color : Color { r : 0.25 , g : 0.25 , b : 0.25 , a : 1.0 , } , .. Default :: default ( ) } ) , width : ImageBoxSizeValue :: Exact ( 150.0 ) , height : ImageBoxSizeValue :: Exact ( 50.0 ) , .. Default :: default ( ) } ) , ) . into ( ) }
custom icon component composed out of icon image as its content and context image that we show
when bool props value is true.
custom icon component composed out of icon image as its content and context image that we show when bool props value is true .
ctx
WidgetContext
ctx
WidgetContext