Resizes the widget to fit its container
resize()
Description
This method recalculates and applies the size and position of the widget to fit its container. It handles responsive behavior and ensures the widget displays correctly when its container size changes.
The method triggers the 'resize' event before and after resizing.
The method returns the time taken to resize in milliseconds.