Skip to main content

background_linear_gradient

Function background_linear_gradient 

Source
pub fn background_linear_gradient(
    view: &ViewHandle,
    colors: &[Color],
    start: (f64, f64),
    end: (f64, f64),
) -> ViewHandle
Expand description

Apply .background(LinearGradient(colors:startPoint:endPoint:)).

Examples found in repository?
examples/ios_app.rs (lines 102-107)
100fn ui() -> views::ViewHandle {
101    views::zstack(&[
102        views::background_linear_gradient(
103            &views::color(0.0, 0.0, 0.0, 0.0),
104            &[Color::new(0.06, 0.07, 0.16, 1.0), Color::new(0.24, 0.07, 0.33, 1.0)],
105            (0.0, 0.0),
106            (1.0, 1.0),
107        ),
108        views::scroll(&views::padding(
109            &views::vstack_spacing(
110                &[
111                    header(),
112                    section("Typography", typography()),
113                    section("Shapes", shapes()),
114                    section("Controls", controls()),
115                    section("Symbols", symbols()),
116                    section("Effects", effects()),
117                    section("Layout", layout()),
118                ],
119                18.0,
120            ),
121            16.0,
122        )),
123    ])
124}