refine widget rendering and add sample