History of Scottish Gaelic
All surviving dialects are Highland and/or Hebridean dialects. Dialects of Lowland Gaelic have become defunct since the demise of Galwegian Gaelic, originally spoken in Galloway, which seems to have been the last Lowland dialect and which survived into the Modern Period. By the 18th century Lowland Gaelic had been largely replaced by Lowland Scots across much of Lowland Scotland. According to a reference in "The Carrick Covenanters " by James Crichton, the last place in the Lowlands where Scottish Gaelic was still spoken was the village of Barr in Carrick: only a few miles inland to the east of Girvan, but at one time very isolated. Crichton gives neither date nor details.
Gaels
Since then, the Gaelic language has gradually diminished in most of Ireland and Scotland. The 19th century was the turning point as The Great Hunger in Ireland, and across the Irish Sea the Highland Clearances, caused mass emigration (leading to Anglicisation, but also a large diaspora). The language was rolled back to the Gaelic strongholds of the north west of Scotland, the west of Ireland and Cape Breton Island in Nova Scotia.