Refactor Custompage to WidgetPage.