I code on the train using xvkbd on my pinephone. You get used to it. A good editor like vim helps a lot. You're spending most of the time thinking not typing.
I got myself an Anne Pro 2 from banggood for 65 euros and I take it everywhere. It connects to my laptop, tablet and phone.