Sharp diameter bound on the spectral gap for quantum graphs