How to use speech-to-text offline?
There are two apps involved in this case. First one is Voice-To-Text engine app. Other one is Google app.

The app you start by hitting the mic on keyboard is the former one. It normally relies on Internet to work, however, can be made to work offline too. I can't explain the reason of the long wait though. Maybe it tries to connect to internet first and then, when it fails, it switches back to working offline method.

The app that you start by saying Ok Google is the latter one in this case. It also uses Voice-To-Text engine in the background, however, it uses the input it receives from your microphone, directly to start a Google search. Which is impossible to perform when offline, and therefore, it fails.