getCrossAxisCount function

int getCrossAxisCount(
  1. BuildContext context, {
  2. double itemWidth = 250.0,
})

Implementation

int getCrossAxisCount(BuildContext context, {double itemWidth = 250.0}) {
  final _size = MediaQuery.of(context).size;
  var _count = (_size.width / itemWidth).round();
  if (_count <= 0) return 1;
  return _count;
}