def METHOD_NAME(self, e):
    if e.control.border:
        e.control.border = None
        if e.control.image in self.selected_images:
            self.selected_images.remove(e.control.image)
        e.control.update()
    else:
        e.control.border = ft.border.all(2, e.page.tertiary_color)
        self.selected_images.append(e.control.image)
        e.control.update()