refactor imageGallery widget