In-app purchase

This commit is contained in:
Hillel Coren 2022-10-12 19:27:50 +03:00
parent a4840854da
commit f9165a8701
1 changed files with 18 additions and 11 deletions

View File

@ -27,6 +27,7 @@ class UpgradeDialog extends StatefulWidget {
} }
class _UpgradeDialogState extends State<UpgradeDialog> { class _UpgradeDialogState extends State<UpgradeDialog> {
final _scrollController = ScrollController();
final InAppPurchase _inAppPurchase = InAppPurchase.instance; final InAppPurchase _inAppPurchase = InAppPurchase.instance;
StreamSubscription<List<PurchaseDetails>> _subscription; StreamSubscription<List<PurchaseDetails>> _subscription;
List<ProductDetails> _products = <ProductDetails>[]; List<ProductDetails> _products = <ProductDetails>[];
@ -115,6 +116,7 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
iosPlatformAddition.setDelegate(null); iosPlatformAddition.setDelegate(null);
} }
_subscription.cancel(); _subscription.cancel();
_scrollController.dispose();
super.dispose(); super.dispose();
} }
@ -124,18 +126,23 @@ class _UpgradeDialogState extends State<UpgradeDialog> {
final List<Widget> stack = <Widget>[]; final List<Widget> stack = <Widget>[];
if (_queryProductError == null) { if (_queryProductError == null) {
stack.add( stack.add(
ListView( Scrollbar(
children: <Widget>[ thumbVisibility: true,
if (Platform.isIOS) controller: _scrollController,
Padding( child: ListView(
padding: const EdgeInsets.only(bottom: 16), controller: _scrollController,
child: Text( children: <Widget>[
'Payment will be charged to iTunes Account at confirmation of purchase. Subscription automatically renews unless auto-renew is turned off at least 24-hours before the end of the current period. Account will be charged for renewal within 24-hours prior to the end of the current period, and identify the cost of the renewal. Subscriptions may be managed by the user and auto-renewal may be turned off by going to the user\'s Account Settings after purchase.', if (Platform.isIOS)
style: TextStyle(fontSize: 12, color: Colors.grey), Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Text(
'Payment will be charged to iTunes Account at confirmation of purchase. Subscription automatically renews unless auto-renew is turned off at least 24-hours before the end of the current period. Account will be charged for renewal within 24-hours prior to the end of the current period, and identify the cost of the renewal. Subscriptions may be managed by the user and auto-renewal may be turned off by going to the user\'s Account Settings after purchase.',
style: TextStyle(fontSize: 12, color: Colors.grey),
),
), ),
), _buildProductList(),
_buildProductList(), ],
], ),
), ),
); );
} else { } else {