Although rain can disrupt cricket significantly, roofs would bring several problems including cost, practicality and the effects on both the playing conditions and tactics.
The biggest obstacle to adding roofs to cricket grounds is simply the cost, particularly given a cricket pitch is much bigger than those used in most sports played in stadiums. The roof would also have to be high enough to reduce or remove the risk of the ball hitting the roof. This would not only affect the game (changing a potential outcome of a boundary or a catch) but could be dangerous if a fast-moving ball was deflected directly downwards.
Another objection is that the roof could affect the pitch and conditions. To allow for a natural outsurface and pitch, either the stadium would need either some way for light to get in beneath the roof, or the pitch would need to be removable. Blocking out rain at all times (not just during games) would also make it harder to maintain the grass.
The roof could also affect the amount of moisture in the air and dew on the grass, both of which would affect the playing conditions. This would remove some of the natural variability which forces teams to adopt different batting and bowling tactics and is arguably part of the challenge of playing.
Finally, in multi-innings games, judging and reacting the potential for rain is arguably part of the game and tactics, for example in assessing how aggressively to bat or when to declare. A similar judgement can also apply in one-day and T20 games where a team may need to score more quickly if there’s a risk the game could be decided by the DLS system.
Some games have been played in a stadium with a roof. Several players have hit the roof of the stadium in Melbourne during Big Bash League games. The rules of the competition have changed over the years from this being a dead ball to counting as a six. That’s controversial as a player can get six hitting a shot that would clearly not have cleared the boundary.
https://www.youtube.com/watch?v=Oeo0lBs0yUY
In 2002, a game at the Millennium Stadium in Cardiff used special “Power Cricket” rules. As well as the usual four and six runs for boundaries, hitting the ball into the second tier of seating earned eight and the top tier of seating earned 10. Had a player hit the roof, they would have scored 12. (The format did not catch on, coming at the same time that the more conventional T20 became established.)