widget can be null, in which case it should clear the content