Gamma-ray burst flares: Ultraviolet/optical flaring. I