You're searching for a simple answer to a fairly complicated question since as Luke noted in some places and amongst certain groups muzzleloading long rifles of various types never went out of style, be they percussion or flint lock.
Henry Leman who started making long rifles in the 1830's was still making them and selling them into the 1880's. Both his Leman guns as well as his cheaper line sold under the name Conestoga Rifles Works were being sold at least as late as 1885. Leman refused to make breech loaders according to his biographers - he passed on in 1887.
in 1885, the Jos. C. Grubb catalogue for that year included "Half stock Leman rifles with and without a patch box,, with extra prices on bores smaller than 150 and barrels over 42 inches long."
The same catalog notes the price differences
his regular rifles are listed in a price range from $10.25 to $11.25, while the Conestoga rifles sold for $7.75 to $9.50, the full stock with a patch box being cheaper than a half stock with a patch box.
J. P Gemmer who bought the Hawken shop in the 1860's continued to make at least a few caplock Hawken style mountain rifles at times up until the 1890's - the shop closed in 1915.
While not rifles, the Hudson Bay Company continued to sell smoothbore flint lock trade guns until the late 1930's with some stock remaining into the late 1940's.
Last but not least I learned to shoot cap lock muzzleloaders from my Great Uncle in 1961. A Marine veteran of WW1, he refused to own a cartridge rifle or shotgun - he had seen to much death and destruction wrought by "modern" weapons at Belleau Wood and other battles and swore he would never pick up another "modern" gun in his life.
He also felt he needed nothing more than his pride and joy, a late (1880's) New York built gun with a replacement barrel in 45 caliber made by the great Harry Pope. His only other gun was an 1870's double hammer 12 bore muzzleloader. He filled his larder each year until his death in the late 1960's with those two guns. He also refused to have indoor toilets, considering them unsanitary. After about 1962 he did have a flush toilet, but it was in the old outhouse 75' from the main house and the only reason he had it installed was the county regs which had "outlawed" standard out houses.
In general though muzzleloaders were considered old fashioned in most areas by the 1880's, but still thousands of muzzleloading rifles, cap lock revolvers, and shotguns were around for much longer than that.