pub fn env<S: Clone + Default + 'static, V: View, F: Fn(S, &mut Context) -> V + 'static>(
f: F
) -> impl View
Expand description
Reads from the environment.
15
16
17
18
19
20
21
22
fn my_control() -> impl View {
env(|t, _| {
circle().color(match t {
MyControlType::Chill => AZURE_HIGHLIGHT,
MyControlType::Agro => RED_HIGHLIGHT,
})
})
}