showPaywall method

bool showPaywall(
  1. BuildContext context, {
  2. String? fontFamily,
})

Shows the paywall modal for this offering

This method will display the paywall UI if a paywall is available for this offering. Returns true if the paywall was shown, false if no paywall is available.

Implementation

bool showPaywall(BuildContext context, {String? fontFamily}) {
  if (paywall == null) {
    SdkLogger.debug('No paywall available for this offering');
    return false;
  }

  showModalBottomSheet(
    context: context,
    isScrollControlled: true,
    useSafeArea: true,
    backgroundColor: Colors.transparent,
    builder: (BuildContext context) {
      return PaywallModal(paywall: paywall!, fontFamily: fontFamily);
    },
  );

  return true;
}