I had the same problem, and found the key here: https://stackoverflow.com/questions/64018802/tabview-tabitem-running-code-on-selection-or-adding-an-ontapgesture
I created a github gist for my solution here: https://gist.github.com/eegrok/9ccfcf060aab1e065651d0e2f70fd46c