Answering the question, "do betta fish require sunlight?" is yes; however, there are certain key details you must keep in mind before exposing your betta to sunlight.
First and foremost, keep in mind that bettas are diurnal fish. This means they are most active during the daytime hours and prefer light sources that reflect their natural habitat, such as subdued lighting, indirect illumination from overhead branches or plants, or diffused through water surfaces. Direct sunlight should be avoided as it will heat the water up quickly while depriving it of oxygen, leading to stress or death in your betta fish.
Overly stimulating lighting conditions can overstimulate betta fish, putting them at greater risk for illness - this may range from simple bacterial infections to more serious conditions like septicemia or tuberculosis. Stressed bettas will become less likely to eat and their immune systems weaken over time as their defenses weaken further.
As a rule, aim to maintain a daily light cycle with 12 hours of darkness and 8 hours of light; this will replicate their natural habitat's light cycles and promote their health. Without an ideal lighting regimen in place, bettas may stop eating regularly, lose color pigmentation from their scales, become dull in coloration over time, and may affect their spawning behavior negatively.