linebender / linebender/druid

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

Open
#2,314 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the fn image_list() example and the ImageList, Image, ImageBuf, and ImageController types mentioned in the issue. Trace how AppState or ImageList data reaches widget construction. Done means the image path can come from ImageList instead of the hardcoded E:/bizhi/00.jpg path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.