Draw a Rectangle
In the Property Inspector, far left, set the W textfield parameter to 1 (1 pixel wide)
Then set the Fill > Gradient > Linear
Select the Gradient Tool on the Toolbar then mouseover the shape/gradient line and you will see the 'rotation' handler arrow icon. When you do, click and drag to rotate.
Or with the Gradient Tool active, click and drag in any direction to redraw it.