Image Picker: Why conditions based on the widget are not working?