polycore
polycore copied to clipboard
Added Container widget.
This wraps an existing widget, but allows for the wrapped widget to be swapped out for another (or even removed).
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
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.
I've updated my merge request, as the setting of background colours wasn't working initially after I rebased.