showUnlockFeatureDialog function

Future<void> showUnlockFeatureDialog(
  1. BuildContext context, {
  2. required AppTheme theme,
  3. required ProductDetails product,
  4. ProductDetails? productSubscription,
  5. bool hasSubscription = false,
  6. String? message,
  7. Color? barrierColor = Colors.black54,
  8. Color? backgroundColor = Colors.white,
  9. void onPurchasePressed()?,
  10. void onSubscriptionPressed()?,
  11. void onClosePressed()?,
})

Shows an "unlock feature" dialog for in-app purchases.

product contains purchase details. Optional styling and callbacks allow customization.

Implementation

Future<void> showUnlockFeatureDialog(
  BuildContext context, {
  required AppTheme theme,
  required ProductDetails product,
  ProductDetails? productSubscription,
  bool hasSubscription = false,
  String? message,
  Color? barrierColor = Colors.black54,
  Color? backgroundColor = Colors.white,
  void Function()? onPurchasePressed,
  void Function()? onSubscriptionPressed,
  void Function()? onClosePressed,
}) {
  return showDialogWithAnimation<void>(
    barrierColor: barrierColor,
    context: context,
    child: UnlockFeatureDialog(
      product: product,
      subscriptionProduct: productSubscription,
      hasSubscription: hasSubscription,
      onClosePressed: onClosePressed,
      onPurchasePressed: onPurchasePressed,
      onSubscriptionPressed: onSubscriptionPressed,
      theme: theme,
    ),
  );
}