Example for measuring text

Is there an example somewhere how to measure widget or text size? I seem to have some knowledge gaps because I can’t figure out how to use a renderer to measure text. My goal is creating a column (possibly through a custom widget), where all elements (in my case buttons with text) have the size of the largest element