True, flux is integral of dot product of electric field and \vec{da}, that's an infinitesimal element of a surface. But if you change shape of your surface, let's say you move some part of surface away from charges, the flux through the part of your surface that you didn't touch stays the same, so if something changes, it changes on that part of your surface that you ''touched''. You moved part of your surface away from charges so area of that part is now bigger than it was, BUT also the electric field doesn't have the same value that it had on ''old'' surface. Since that part of surface is further from charges, electric field has a smaller value but their product is the same. (surface area raises, field decreases). Especially for one point charge and a spherical gaussian surface, field decreases as 1/r^2 , and surface area increases as r^2, so their product is constant.