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 showAdFreeUpsellDialog(BuildContext context) { return showDialog( context: context, builder: (context) => AlertDialog( title: const Text('Tired of Ads?'), content: Consumer( 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().buyAdFreeYear(); }, child: const Text('Remove Ads'), ), ], ), ); }