-2

I'm new to flutter,I've designed my app using fixed dimensions. What's the easiest way to resize scaffold according to screen size (different phone screen size).

2
  • 1
    You need to research first if you do not find this solution then post it here. Please read this article stackoverflow.com/help/how-to-ask Aug 31, 2021 at 11:18
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Sep 2, 2021 at 19:37

4 Answers 4

2

You can use MediaQuery.of(context).size inside build method.

build(BuildContext) {
   final Size size = MediaQuery.of(context).size;
}

Then use it like this:

SizedBox(
   height: size.height,
   width: size.width * 0.85,
),

Another options are using external libraries like GetX or ScreenUtils

0

You go through official documentation here

And use MediaQuery.of() Responsive, Adaptive classes/Widgets

0

To resize your screens/widgets you can use MediaQuery.

You can use it like ->

screenHeight: MediaQuery.of(context).size.height,
screenWidth: MediaQuery.of(context).size.width,

Then you can scale it like ->

Container(
        width: MediaQuery.of(context).size.width* 0.5,
)

If you multiply with 0.5, that means, you want to use 50% of screen width.

0

Packages and sources :

https://pub.dev/packages/responsive_framework https://flutter.dev/docs/development/ui/layout/adaptive-responsive

You can check height and width by MediaQuery. Example :

double _height =  MediaQuery.of(context).size.height;
double _width =  MediaQuery.of(context).size.width;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.