Created
August 24, 2020 18:53
-
-
Save kirshiyin89/30bee44e1d2a693ccb9de8a84af7fc68 to your computer and use it in GitHub Desktop.
A utility class for the screen size.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
int determineCrossAxisCount(BuildContext context) { | |
int _crossAxisCount = 1; | |
final double screenWidthSize = MediaQuery.of(context).size.width; | |
if (screenWidthSize > 820) { | |
_crossAxisCount = 4; | |
} else if (screenWidthSize > 720) { | |
_crossAxisCount = 3; | |
} else if (screenWidthSize > 520) { | |
_crossAxisCount = 2; | |
} else { | |
_crossAxisCount = 1; | |
} | |
return _crossAxisCount; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment