0
0
Fluttermobile~5 mins

MediaQuery for responsiveness in Flutter - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is MediaQuery in Flutter?

MediaQuery is a widget that provides information about the size and orientation of the screen or parent widget. It helps make apps responsive by adapting UI to different screen sizes.

Click to reveal answer
beginner
How do you get the screen width using MediaQuery?

You use MediaQuery.of(context).size.width to get the current screen width in logical pixels.

Click to reveal answer
beginner
Why is responsiveness important in mobile apps?

Responsiveness ensures the app looks good and works well on different devices, like phones and tablets, by adjusting layouts and sizes automatically.

Click to reveal answer
intermediate
What does MediaQuery.of(context).orientation return?

It returns the current screen orientation as either Orientation.portrait or Orientation.landscape.

Click to reveal answer
intermediate
How can MediaQuery help with font size adjustments?

You can use MediaQuery.of(context).textScaleFactor to scale text size according to user preferences or screen size, improving readability.

Click to reveal answer
Which Flutter code gets the screen height using MediaQuery?
AMediaQuery.of(context).size.height
BMediaQuery.height(context)
CMediaQuery.screenHeight
DMediaQuery.getHeight()
What does MediaQuery.of(context).padding provide?
AThe size of the keyboard
BThe margin around the app
CThe safe area padding like status bar or notch
DThe app's background color
How can you check if the device is in landscape mode?
AMediaQuery.of(context).orientation == Orientation.landscape
BMediaQuery.orientation == 'landscape'
CMediaQuery.landscape == true
DMediaQuery.of(context).isLandscape()
Why should you avoid hardcoding sizes in Flutter apps?
ABecause hardcoded sizes increase app size
BBecause hardcoded sizes don't adapt to different screen sizes
CBecause hardcoded sizes improve battery life
DBecause hardcoded sizes make the app faster
Which property helps scale text size according to user settings?
AMediaQuery.fontSize
BMediaQuery.scaleText
CMediaQuery.textSize
DMediaQuery.of(context).textScaleFactor
Explain how MediaQuery helps make a Flutter app responsive.
Think about how the app can adjust layout and text based on device info.
You got /4 concepts.
    Describe a simple example of using MediaQuery to adjust a widget's width.
    Imagine you want a box to be half the screen width.
    You got /3 concepts.