What is the best way to handle with screen sizes in Flutter? You can use the BuildContext context with a MediaQuery to get the current devices screen size and can set the size of your widgets based on that value.
For example:
1 2 3 4 5 | // set width to 40% of the screen width var width = MediaQuery.of(context).size.width * 0.4; // set height to 40% of the screen height var height = MediaQuery.of(context).size.height * 0.4; |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.