Its been a while since I have been trying to get a working flatpak manifest. I finally succeeded. I have made a pull request for it on flathub. I am pretty sure there can some optimizations that can be done. Please have a look. The pull request is here.