Skip to main content

makepad_example_ui_zoo/
tab_image.rs

1use crate::{
2    makepad_widgets::*,
3};
4
5live_design!{
6    use link::theme::*;
7    use link::shaders::*;
8    use link::widgets::*;
9    use crate::layout_templates::*;
10
11    pub DemoImage = <UIZooTabLayout_B> {
12        desc = {
13            <Markdown> { body: dep("crate://self/resources/image.md") } 
14        }
15        demos = {
16            <H4> { text: "Default" }
17            <View> {
18                show_bg: true, draw_bg: { color: (THEME_COLOR_D_1)}, width: Fill, height: 150, flow: Down,
19                <Image> { source: dep("crate://self/resources/ducky.png" ) }
20            }
21
22            <Hr> {}
23            <H4> { text: "min_height" }
24            <View> {
25                show_bg: true, draw_bg: { color: (THEME_COLOR_D_1)}, width: Fill, height: 150,
26                <Image> { height: Fill, source: dep("crate://self/resources/ducky.png" ), min_height: 100 }
27            }
28
29            <Hr> {}
30            <H4> { text: "width_scale" }
31            <View> {
32                show_bg: true, draw_bg: { color: (THEME_COLOR_D_1)}, width: Fill, height: 150,
33                <Image> { width: Fill, source: dep("crate://self/resources/ducky.png" ), width_scale: 1.1 }
34            }
35
36            <Hr> {}
37            <H4> { text: "fit: Stretch" }
38            <View> {
39                show_bg: true, draw_bg: { color: (THEME_COLOR_D_1)}, width: Fill, height: 150,
40                <Image> { width: Fill, height: Fill, source: dep("crate://self/resources/ducky.png"), fit: Stretch }
41            }
42
43
44            <Hr> {}
45            <H4> { text: "fit: Horizontal" }
46            <View> {
47                show_bg: true, draw_bg: { color: (THEME_COLOR_D_1)}, width: Fill, height: 150,
48                <Image> { width: Fill, height: Fill, source: dep("crate://self/resources/ducky.png" ), fit: Horizontal }
49            }
50
51            <Hr> {}
52            <H4> { text: "fit: Vertical" }
53            <View> {
54                show_bg: true, draw_bg: { color: (THEME_COLOR_D_1)}, width: Fill, height: 150,
55                <Image> { width: Fill, height: Fill, source: dep("crate://self/resources/ducky.png" ), fit: Vertical }
56            }
57
58            <Hr> {}
59            <H4> { text: "fit: Smallest" }
60            <View> {
61                show_bg: true, draw_bg: { color: (THEME_COLOR_D_1)}, width: Fill, height: 150,
62                <Image> { width: Fill, height: Fill, source: dep("crate://self/resources/ducky.png" ), fit: Smallest }
63            }
64            
65            <Hr> {}
66            <H4> { text: "fit: Biggest" }
67            <View> {
68                show_bg: true, draw_bg: { color: (THEME_COLOR_D_1)}, width: Fill, height: 150,
69                <Image> { width: Fill, height: Fill, source: dep("crate://self/resources/ducky.png" ), fit: Biggest }
70            }
71
72        }
73    }
74}