2026-06-02 23:28:39 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2026-06-04 02:30:03 +02:00
|
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
|
import 'l10n/app_localizations.dart';
|
|
|
|
|
import 'state/settings_provider.dart';
|
2026-06-02 23:28:39 +02:00
|
|
|
import 'theme/app_theme.dart';
|
|
|
|
|
import 'widgets/app_shell.dart';
|
|
|
|
|
|
2026-06-04 02:30:03 +02:00
|
|
|
class OciDeckApp extends ConsumerWidget {
|
2026-06-02 23:28:39 +02:00
|
|
|
const OciDeckApp({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
2026-06-04 02:30:03 +02:00
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
final languageCode = ref.watch(
|
|
|
|
|
settingsProvider.select((s) => s.languageCode),
|
|
|
|
|
);
|
2026-06-06 20:41:24 +02:00
|
|
|
final appearance = ref.watch(
|
|
|
|
|
settingsProvider.select((s) => s.appAppearanceProfile),
|
|
|
|
|
);
|
2026-06-04 08:17:12 +02:00
|
|
|
AppLocalizations.setActiveLanguageCode(languageCode);
|
2026-06-02 23:28:39 +02:00
|
|
|
return MaterialApp(
|
|
|
|
|
title: 'OciDeck',
|
2026-06-06 20:41:24 +02:00
|
|
|
theme: AppTheme.fromProfile(appearance),
|
2026-06-02 23:28:39 +02:00
|
|
|
debugShowCheckedModeBanner: false,
|
2026-06-04 08:17:12 +02:00
|
|
|
locale: AppLocalizations.materialLocaleFor(languageCode),
|
2026-06-04 02:30:03 +02:00
|
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
|
|
|
localizationsDelegates: const [
|
|
|
|
|
AppLocalizations.delegate,
|
|
|
|
|
GlobalMaterialLocalizations.delegate,
|
|
|
|
|
GlobalCupertinoLocalizations.delegate,
|
|
|
|
|
GlobalWidgetsLocalizations.delegate,
|
|
|
|
|
],
|
2026-06-02 23:28:39 +02:00
|
|
|
home: const AppShell(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|