linebender / druid

A data-first Rust-native UI design toolkit.
https://linebender.org/druid/
Apache License 2.0
9.45k stars 569 forks source link

When I use Image Widget, I want to initialize the image when creating it. How can I get the variables in AppState #2314

Open weilai2918 opened 1 year ago

weilai2918 commented 1 year ago

I have a question. When I use Image Widget, I want to initialize the image to get the variables in ImageList when creating it. Thank you for your answer `fn image_list() -> impl Widget{

let image_buf = ImageBuf::from_file("E:/bizhi/00.jpg").unwrap();
let image_show = Image::new(image_buf).fill_mode(FillStrat::Contain).controller(ImageController{});
let size_box_image = SizedBox::new(image_show).height(50.).width(50.);

Flex::row()
    .with_flex_spacer(10.)
    .with_child(size_box_image)
    .with_flex_spacer(10.)

}` Change the address E:/bizhi/00.jpg to the variable in ImageList Thank you for your answer