I have to prove that if every projective $A$ module is free, then the only idempotents of $A$ are $0$ and $1$.
I know that $A$ contains an idempotent implies $A \cong G \times H$, where neither $G$ nor $H$ are zero, but i can’t do anything after that.
Let $A\cong G\times H$ as you said. Then both $G,H$ are projective $A$ modules, since they are summands. By hypothesis, both are free of rank greater or equal to $1$.
But now you have $A\cong A^k$ where $k\geq 2$, and that is not possible for commutative ring since they have the invariant basis number (IBN) property.
Thus the only idempotents can be trivial.