First the former. Mahatma Gandhi, no doubt, played a stellar role in the Indian Freedom Struggle. There were others, lesser known leaders, throughout the country who played a great role in it as well. Was the entire Indian Freedom struggle non-violent? Clearly not. And did non-violence on one side necessarily result in non-violence on the other? Clearly not. Jalianwala Bagh is just one of the many examples. Having said that the non-violence did strike a chord with the masses in providing their voice to the struggle. Did non-violence win us freedom? Highly unlikely even though your school books would say so.
Clearly, the struggle was not all about non-violence.
And secondly, it was also becoming expensive for the British to hold onto their 'empire'. Clement Attlee who led the post war labour government wanted to get rid of British colonies.
Attlee's solutions were to make India independent, to pull out of Palestine, to nationalize major industries and begin socialized medicine, and to turn to the sympathetic liberal government of President Harry Truman to pay for it all.
Thus it was that alongwith India - Sri Lanka (1948) and Burma (again, 1948) got independence at about the same time. Also, remember that there were still French (Pondicherry 1954) and Portuguese (Goa 1961) parts of India that continued to remain in India - perhaps unaffected by the so called freedom movement! So, what gives? Clearly economics! And by the way, to get some princely states to access, our army was sent, not flower vendors.
Now about Nelson Mandela. This was very interesting. Mandela was in prison post what is famously known as the Rivonia Trial. And a slightly simpler explanation (though badly spelt) here,
Mandella was an educated lawyer and was brought to stand trial in 1963 at the age of 45, for plotting to overthrow the government of South Africa by violence. He was convicted of sabbotoge - several bombs that went off were blamed on the African National Congress (ANC) of which he was the leader. Several people were killed and he was imprisoned for murder and sabbatoge. He remained in prison for 27 years.
Mandella was offered a full release in 1988 - on condition that he renounce violence. Having been a lawyer for over 2 decades, Mandella noted that prisoners cannot enter into contracts - only free men can negotiate, so he refused a full release - unless it had absolutly no conditions. This set the movement to free Nelson Mandela!
Now that these two examples are out of the way, let us ask ourselves this question again, can a war be won purely by non violence?