'How to stop resizing of widgets when resizing browser page in Flutter Web

How do you stop the automatic resizing/responsiveness of widgets in Flutter Web.

Is there a way to use a Widget wrapped around the Scaffold, for example, that stops widgets from resizing when page window is resized?

I have a unique use case where responsiveness is not required (although I am aware that responsive design is best usually).



Solution 1:[1]

You can give a fix height and width of that particular widget like this

SizedBox(
      height: 300,
      width: 300,
      child: your_widget,
    );

And wrap parent widget with SingleChildScrollView

Solution 2:[2]

You can use kIsWeb this will identify if you are running on mobile or web app. You still have the same output for responsive layout on mobile and web but it will differ on running either web or mobile.

import 'package:flutter/foundation.dart';

kIsWeb ? WebWidget : MobileWidget

Solution 3:[3]

I know it is a bit late, but this is what worked for me:

return Center(
    child: Row(
  mainAxisAlignment: MainAxisAlignment.center,
  children: [
    Container(
        width: 1000, //fixed width that you need
           child: <your widget that you don't want to resize>,
              ),
             ]
            ),
           )

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hemal Moradiya
Solution 2 Raine Dale Holgado
Solution 3 Greg