AdSize.getAdaptiveBanner constructor

AdSize.getAdaptiveBanner(
  1. double maxWidth
)

Adaptive banner ads have a fixed aspect ratio for the maximum width. The adaptive size calculates the optimal height for that width with an aspect ratio similar to 320x50.

Width of the current device can be found using: MediaQuery.of(context).size.width.

Be sure to take into account applicable safe areas.

Implementation

AdSize.getAdaptiveBanner(double maxWidth)
    : width = maxWidth.truncate(),
      height = 0,
      _mode = 2;