how to make widget stretch to the size of the cube

how to make this widget stretch to the size of the cube, in the sense that it is not larger than the object, but at the same time, so that it does not go inside it, you need the widget to show the boundaries of the object



I need it to look like this: