When I am in editor mode, my container which holds all the dashboard information fills the whole page with margins on all four sides.
The same for a modal located in the heads, it spans the full width of the page.
However when I shift to preview mode and the page width increases, the containers stays as the same with as it was in editor mode, the header also doesn’t take the full width of the page.
Good news, this is expected behavior rather than a bug, and it's a quick fix. It comes down to your app's Max width setting, which caps and centers the canvas. In the editor it's drawn at that width so it looks full, but in preview on a wider screen the content stays capped, which is what's leaving those side margins. Your header behaves the same way for the same reason.
Here's how to change it:
To adjust the maximum width of the canvas, open the Inspector and update the Max width setting. This setting accepts pixel and percentage values, or you can set it to none so it uses 100% of the viewport. The default max width is 1200px. On desktops, regardless of the value, an 800px minimum is enforced.
More detail in the docs here. Let me know if that does the trick!