Home > Mobile >  How can I make responsive app that work in every device?
How can I make responsive app that work in every device?

Time:04-05

I have used ScreenUtilInit() in my flutter application. In that designSize: Size(360, 690) or designSize:ScreenUtil.defaultSize, what should I put. And what is advantages in both?

CodePudding user response:

You can get the size of your actual displayable widget with MediaQuery class.

double card_width = MediaQuery.of(context).size.width * 15 / 16;

double card_height = MediaQuery.of(context).size.height / 4;

CodePudding user response:

There are two basic approaches to creating Flutter apps with responsive design:

  • Use the LayoutBuilder class From its builder property, you get a BoxConstraints object

  • Use the MediaQuery.of() method in your build functions This gives you the size, orientation, etc, of your current app

  • Related