I've dealt with gnats in the entirety of my admittedly short growing tenure. They've never done anything to my plants except poo on the leaves, but never the flowers. I've read that you can place potato slices on the soil and they will attract and concentrate the larvae, then remove the potatoes. There's also something called neem oil that kills insects in the soil. I'm yet to try any approach because they are nothing more than annoying so far.