The lights going out in the middle of dinner have both a literal meaning, Tom did not pay the electric bill, and a figurative meaning, it is a foreshadowing of what will happen to Amanda and Laura at the end of the play.
During the dinner with the gentleman caller, Jim, the lights go out because Tom has neglected, on purpose, to pay the electric bill, using the money instead to pay his dues as a Merchant Seaman. Tom is planning to leave his mother and sister very soon.
The foreshadowing occurs because Williams gives us an indication of what will happen to Amanda and Laura, they will be left both literally and figuratively in the dark when Tom abandons them.
Amanda and Laura depend on Tom for financial support, when he walks out on them, they are stranded in the dark, with no money to pay the electric bill, and no options.
Laura is left with darkness when Jim, the gentleman caller, admits to being engaged to another girl. Her one chance at happiness is cut short. Laura is abandoned by her brother, who can no longer put up with their mother's nagging and demanding ways.
Amanda's world goes dark as she is shocked and saddened by learning of Jim's status as an engaged man and Tom's abrupt and angry exit from the apartment.
The lights go out only after dinner is over,"Amanda: Well we got through dinner." Sc.VII.
The entire scene is charged with romance,"the air outside becomes pale and luminous as the moon breaks out." and Jim remarks,"candlelight is my favorite kind of light" to which Amanda adds,"that shows you are romantic."
Next Amanda leaves Jim and Laura alone in candlelight.This scene "is the climax of her secret life." The secret being she had a crush on him while at high school. In this scene, Jim helps Laura overcome her shyness and cures her of her 'inferiority complex' and helps her to forget that she is a cripple: "being disappointed is one thing and being discouraged is something else "Jim's smile lights Laura with a warmth and charm which lights her inwardly with altar candles." Finally he dances with her and kisses her on the lips.
But the very next instant he tells her that he is engaged to Betty. For a moment it seems that Laura is going to have another of her nervous breakdowns but she quickly recovers and confidently presents him with the glass unicorn which he broke when dancing with her. It is a symbolic gesture which proves that Laura has been cured of her 'inferiority complex.' The scene ends with Amanda comforting Laura and Laura blowing out the candles.
Tom might have deserted his family, but Laura is now confident that she can face life all alone without relying on her "glass menagerie."