A whole lot of stuff
This commit is contained in:
parent
faf319322a
commit
ad850d2be6
50 changed files with 3013 additions and 213 deletions
40
lib/widgets/ad_free_upsell_dialog.dart
Normal file
40
lib/widgets/ad_free_upsell_dialog.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../services/app_state.dart';
|
||||
|
||||
/// Shown right after a user watches the app's one ad placement (see
|
||||
/// [AdService.showGateAd] / [AppState.syncNow]) — not on every sync, only
|
||||
/// the moment an ad was actually just shown to them, since that's when the
|
||||
/// "you could skip these" pitch is most relevant. Purely informational: it
|
||||
/// doesn't block or delay the sync that triggered it, which is already
|
||||
/// proceeding underneath it by the time this appears.
|
||||
Future<void> showAdFreeUpsellDialog(BuildContext context) {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Tired of Ads?'),
|
||||
content: Consumer<AppState>(
|
||||
builder: (context, appState, _) => Text(
|
||||
appState.adFreeYearPriceLabel == null
|
||||
? "You can remove ads for a full year with a single one-time purchase."
|
||||
: 'You can remove ads for a full year for '
|
||||
'${appState.adFreeYearPriceLabel} — a single one-time purchase.',
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Not Now'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
context.read<AppState>().buyAdFreeYear();
|
||||
},
|
||||
child: const Text('Remove Ads'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue