Foods that cause bloating in general will also cause bloating on a flight. Foods that can cause bloating from gas production include anything with certain artificial sweeteners (like maltitol, which cannot be properly digested by gut bacteria), fruits (due to fructose), beans, etc. Other foods can cause bloating due to water retention - basically anything with a high salt content, like french fries. The main issue with flying is dehydration: the recirculated air is kept quite dry, which can lead to reduced body water unless you make sure to drink plenty of water throughout the flight. (The only downside to drinking plenty of water is that you'll likely have to use the tiny airplane bathrooms, but you'll still feel better overall if you stay hydrated.) You're also sitting down for a long time, which can reduce circulation, so it can be helpful to wear compression stockings and to stand up occasionally to stretch your legs. Finally, you should avoid alcohol, because alcohol is dehydrating (e.g. see https://gastrolyte.com.au/dehydration/dehydration-and-alcohol/).
Summary - Eat foods that are low in salt and do not contain artificial sweeteners; Drink plenty of water; Wear compression stockings and be sure to move your legs / stand up and walk as much as possible; Avoid alcohol during the flight.