How to write custom widgets that draw an existing widget when drawing themselves #1834
-
I am essentially trying to create a widget that acts as wrapper which takes a list of rows, adds some virtualization logic, and then tries to render the rows as is. I saw some examples around this and have written my code based on #1720 (comment) My use case is a little different though. I'm not trying to render a primitive like text or image, but rather another widget within this. Based on the source code for row or column widgets, my code should've worked, but it's not drawing anything. Do you see any obvious problems here:
Currently, this code either draws nothing or draws blank. I don't know how I can make the distinction between the two. Any help with this, or better patterns to implement this would be greatly appreciated. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Is this an anti-pattern? Is there some other way to achieve this? |
Beta Was this translation helpful? Give feedback.
I also have a snippet here which you can reference. This is a wrapper widget that tracks then the mouse cursor enters / leaves the widgets bounds:
https://github.com/tarkah/iced-snippets/blob/0df81ba17a844d0125fd4dc5b490f0ef02313c4e/snippets/hover-component/src/main.rs#L117