Refactored methods flowLayout() nextItem() and widget()

Added test to verify the layout items can contain child elements