AdSize.getSmartBanner constructor

AdSize.getSmartBanner(
  1. BuildContext context
)

Smart ad size selects the optimal dimensions depending on the device type. For mobile devices, it returns 320x50, while for tablets, it returns 728x90. In the UI, these banners occupy the same amount of space regardless of device type.

Implementation

factory AdSize.getSmartBanner(BuildContext context) {
  final isTablet = (MediaQuery.of(context).size.shortestSide > 720.0);
  return isTablet ? AdSize.leaderboard : AdSize.banner;
}