1. A driver circuit for an LED (light-emitting diode) lamp, comprising:a transformer having a primary winding and a secondary winding;
a dimmer circuit coupled to a power source and the primary winding for varying an input voltage to the primary winding;
a power switch coupled to the primary winding for controlling a current flow in the primary winding;
an output rectifying circuit coupled to the secondary winding and the LED lamp for providing an output current to the LED lamp;
a controller coupled to the dimmer circuit to receive an average input voltage signal from the dimmer circuit, the controller being coupled to a control terminal of the power switch and configured to vary the output current according to the average input voltage signal.