I think you can measure the size values inside the build() method of root page, because root page in most cases won't rebuild so it won't gain the performance
Then store these values in global variables, which can be accessed anywhere in the app
Or even write down values to local storage and then read it next time without recalculation