Keep the top layer of soil dry, use watering sticks to deliver water to the roots of your plants.
Fungus gnats feed of decomposing matter of organic materials. This means instead of potting mix/compost use perlite mix. Fungus gnats larvae lives in a top layer of your soil mix, use sand so that they won’t have decomposing matter to feed off.
Catch the adult flies: sticky paper traps; containers with vinegar + dish soap; electric bug zapper