ResponsiveContainer
Checks if the given reference_width
is less the given breakpoint and then sets shrink
to true
.
Properties
reference_width
: (in length): Defines the reference width for the break point check. Commonly the width of the containers parent.break_point
: (in length): Defines the break point, that is used to evaluatedshrink
(default 444px).shrink
: (out bool): If set totrue
it indicates that one of the children should shrink, commonly theSideBar
.expand_button_width
: (out length): Describes the width of the expand button.expand_shrunken
: (in_out bool): If set totrue
andshrink
istrue
the shrunken element should be expanded as overlay.
Example
import { ResponsiveContainer, SideBar } from "@coop/lib.slint";
export component Example inherits Window {
width: 200px;
height: 25px;
i_container := ResponsiveContainer {
reference_width: parent.width;
if (!self.shrink) : HorizontalLayout {
SideBar {}
Rectangle {
Text {
text: "content";
}
}
}
if (self.shrink) : Rectangle {
Rectangle {
Text {
text: "content";
}
}
SideBar {
x: i_container.expand_shrunken ? _self.width : 0;
}
}
}
}