Example 2 Given the quadratic function
$$
f(x)=4 x^{2}-4 a x+\left(a^{2}-2 a+2\right)
$$

the minimum value on $0 \leqslant x \leqslant 1$ is 2. Find the value of $a$.
(2001, Hunan Province High School Mathematics Olympiad Selection Contest)