polycore icon indicating copy to clipboard operation
polycore copied to clipboard

Added Container widget.

Open the-allanc opened this issue 1 year ago • 3 comments

This wraps an existing widget, but allows for the wrapped widget to be swapped out for another (or even removed).

the-allanc avatar Mar 27 '23 23:03 the-allanc

Hey, thanks for your PR!

I like the idea of conditional rendering via composable widgets. However, I'm not quite sure how your Container could be used. I tried refactoring the existing Drive widget, which already does conditional rendering, but it turned out to be quite complicated. Could you add a demonstration, preferably in the /examples directory?

While thinking about your code I also found some possible simplifications for the existing :layout methods. You may need to adjust your own Container:layout method accordingly. Basically container widgets no longer insert themselves into the returned children list but always include their direct children. Here is the relevant commit: ecac1fe23848b8c39fcab6cd256be7a9b71efcad

philer avatar Mar 31 '23 01:03 philer

I've rebased off your master branch, and added an example based roughly on the sort of thing that I'm using Polycore for.

I've not yet looked at the code to see whether it needs some changes relating to your changes to dealing with children widgets in layout methods.

the-allanc avatar Apr 02 '23 22:04 the-allanc

I've updated my merge request, as the setting of background colours wasn't working initially after I rebased.

the-allanc avatar Apr 10 '23 17:04 the-allanc