showNativeMediumWithLayout static method

Widget showNativeMediumWithLayout(
  1. BuildContext context,
  2. NativeHolder nativeHolder
)

Implementation

static Widget showNativeMediumWithLayout(
    BuildContext context, NativeHolder nativeHolder) {
  if (isTestDevice) {
    return const SizedBox();
  }

  return FutureBuilder<bool>(
    future: AdmobUtils.isNetworkConnected(),
    builder: (context, snapshot) {
      if (snapshot.hasData && snapshot.data == true) {
        // If connected, display the native ad view.
        return AdmobUtils.nativeView(
            nativeHolder, NativeAdmobType.NATIVE_SMALL);
      } else {
        // If not connected or error, return an empty SizedBox.
        return const SizedBox();
      }
    },
  );
}