Dear RevenueCat, Thank you for the Paywall functionality.
How can I customise the close button color in Swift?
Close button color
Thanks for the link, I am looking forward to it.
To address my issue I created a Stateless Widget and used ```PaywallView()```
The following is my code just in case it will help someone else with the same issue.
class Paywall extends StatelessWidget {
const Paywall({super.key});
static const String route = '/paywall';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
actions: [
IconButton.filledTonal(
onPressed: () => Navigator.of(context).pop(),
icon: const Icon(Icons.close),
style: ButtonStyle(
foregroundColor: MaterialStatePropertyAll(ThemeColors.white),
backgroundColor: MaterialStatePropertyAll(
Theme.of(context).primaryColor.withOpacity(0.4)),
),
),
],
),
extendBodyBehindAppBar: true,
body: SafeArea(
top: false,
child: PaywallView(
// Optional Offering object obtained through getOfferings
// offering: offering,
onRestoreCompleted: (CustomerInfo customerInfo) {
// Optional listener. Called when a restore has been completed.
// This may be called even if no entitlements have been granted.
},
onDismiss: () {
// Dismiss the paywall, i.e. remove the view, navigate to another screen, etc.
// Will be called when the close button is pressed (if enabled) or when a purchase succeeds.
Navigator.of(context).pop();
},
),
),
);
}
}
Any answers on how to change the Close Button in Flutter?
This is very important, depending on the Image being used, the close button cannot be seen, this would cause users to be frustrated.
Thanks...
I would also like to know how to change the color of the close button in Flutter using
await RevenueCatUI.presentPaywallIfNeeded(
entitlementIdentifier,
displayCloseButton: true);
Alternatively you can override it using the SwiftUI modifier:
PaywallView(displayCloseButton: true)
.tintColor(Color.blue)
We’ll add a note for this in the documentation 👍
If you would like to specify the color of the Close button outside of the Paywall functionality, it does use your app’s tint color, so you could specify its color through that as well. Here is the documentation for tintColor.
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.