A whole lot of stuff

This commit is contained in:
Courtney Arnold 2026-08-18 11:04:58 -05:00
parent faf319322a
commit ad850d2be6
50 changed files with 3013 additions and 213 deletions

View file

@ -5,11 +5,18 @@ import 'screens/main_shell.dart';
import 'screens/user_agreement_screen.dart';
import 'services/app_state.dart';
import 'theme/app_theme.dart';
import 'widgets/ad_free_upsell_dialog.dart';
void main() {
runApp(const FuelTaxTrackerApp());
}
/// A stable handle on the navigator so [AppState.onAdWatched] can show the
/// "remove ads" dialog from wherever the app happens to be — it fires from
/// deep inside a background sync, not from a widget's own build method, so
/// there's no local [BuildContext] to reach for at that point.
final navigatorKey = GlobalKey<NavigatorState>();
class FuelTaxTrackerApp extends StatelessWidget {
const FuelTaxTrackerApp({super.key});
@ -18,13 +25,20 @@ class FuelTaxTrackerApp extends StatelessWidget {
return ChangeNotifierProvider(
create: (_) => AppState()..init(),
child: Consumer<AppState>(
builder: (context, appState, _) => MaterialApp(
title: 'Fuel Tax Tracker',
theme: AppTheme.light,
darkTheme: AppTheme.dark,
themeMode: appState.themeMode,
home: const AppRoot(),
),
builder: (context, appState, _) {
appState.onAdWatched ??= () {
final dialogContext = navigatorKey.currentContext;
if (dialogContext != null) showAdFreeUpsellDialog(dialogContext);
};
return MaterialApp(
navigatorKey: navigatorKey,
title: 'Fuel Tax Tracker',
theme: AppTheme.light,
darkTheme: AppTheme.dark,
themeMode: appState.themeMode,
home: const AppRoot(),
);
},
),
);
}