toPdfCrossAxisCount method

int toPdfCrossAxisCount(
  1. BoxConstraints constraints
)

Gets the cross axis count of the SliverGridDelegate.

Implementation

int toPdfCrossAxisCount(BoxConstraints constraints) {
  switch (runtimeType) {
    case SliverGridDelegateWithFixedCrossAxisCount:
      return (this as SliverGridDelegateWithFixedCrossAxisCount)
          .crossAxisCount;
    case SliverGridDelegateWithMaxCrossAxisExtent:
      final maxCrossAxisExtent =
          (this as SliverGridDelegateWithMaxCrossAxisExtent)
              .maxCrossAxisExtent;
      return (constraints.maxWidth / maxCrossAxisExtent).ceil();
    default:
      throw Exception('Unsupported SliverGridDelegate: $runtimeType');
  }
}