Ad and purchases enabled (still need actual testing)

This commit is contained in:
Courtney Arnold 2026-08-16 18:27:56 -05:00
parent 2fcc6dcab7
commit faf319322a
35 changed files with 1676 additions and 34 deletions

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import '../services/app_state.dart';
@ -46,6 +47,49 @@ class SettingsScreen extends StatelessWidget {
),
),
const SizedBox(height: 16),
Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Ads', style: Theme.of(context).textTheme.titleMedium),
const SizedBox(height: 8),
if (appState.adsCurrentlyDisabled) ...[
Text(
'Ads are disabled until '
'${DateFormat.yMMMd().format(appState.adFreeUntil!.toLocal())}.',
style: Theme.of(context).textTheme.bodyMedium,
),
] else ...[
Text(
'This app shows a single ad, at most once per app session, right '
'before syncing your data to the cloud.',
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 12),
if (appState.purchaseError != null) ...[
Text(
appState.purchaseError!,
style: TextStyle(color: Theme.of(context).colorScheme.error),
),
const SizedBox(height: 8),
],
FilledButton.icon(
onPressed: () => context.read<AppState>().buyAdFreeYear(),
icon: const Icon(Icons.block),
label: Text(
appState.adFreeYearPriceLabel == null
? 'Remove Ads for a Year'
: 'Remove Ads for a Year — ${appState.adFreeYearPriceLabel}',
),
),
],
],
),
),
),
const SizedBox(height: 16),
Card(
child: Padding(
padding: const EdgeInsets.all(16),