2026-03-04 21:00:00 +01:00
|
|
|
// ===========================================================================
|
|
|
|
|
// FILE: lib/main.dart
|
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
2026-02-27 23:35:54 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2026-03-05 15:00:00 +01:00
|
|
|
import 'package:flutter/foundation.dart';
|
2026-02-27 23:35:54 +01:00
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'core/theme_manager.dart';
|
|
|
|
|
import 'logic/game_controller.dart';
|
|
|
|
|
import 'ui/home/home_screen.dart';
|
2026-03-04 18:00:01 +01:00
|
|
|
import 'services/storage_service.dart';
|
2026-03-05 15:00:00 +01:00
|
|
|
import 'services/audio_service.dart';
|
2026-02-27 23:35:54 +01:00
|
|
|
import 'package:firebase_core/firebase_core.dart';
|
2026-03-04 19:00:00 +01:00
|
|
|
import 'package:firebase_auth/firebase_auth.dart';
|
2026-02-27 23:35:54 +01:00
|
|
|
import 'firebase_options.dart';
|
2026-03-05 15:00:00 +01:00
|
|
|
import 'package:firebase_app_check/firebase_app_check.dart';
|
|
|
|
|
|
|
|
|
|
// --- IMPORT PER IL SUPPORTO MULTILINGUA ---
|
|
|
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
|
|
|
import 'package:tetraq/l10n/app_localizations.dart';
|
2026-02-27 23:35:54 +01:00
|
|
|
|
|
|
|
|
void main() async {
|
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
|
|
|
|
|
await Firebase.initializeApp(
|
|
|
|
|
options: DefaultFirebaseOptions.currentPlatform,
|
|
|
|
|
);
|
|
|
|
|
|
2026-03-04 19:00:00 +01:00
|
|
|
await FirebaseAppCheck.instance.activate(
|
|
|
|
|
androidProvider: kDebugMode ? AndroidProvider.debug : AndroidProvider.playIntegrity,
|
|
|
|
|
appleProvider: kDebugMode ? AppleProvider.debug : AppleProvider.deviceCheck,
|
|
|
|
|
);
|
|
|
|
|
|
2026-03-04 18:00:01 +01:00
|
|
|
try {
|
|
|
|
|
await FirebaseAuth.instance.signInAnonymously();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
debugPrint("Errore Auth: $e");
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-27 23:35:54 +01:00
|
|
|
await StorageService.instance.init();
|
2026-03-04 21:00:00 +01:00
|
|
|
await AudioService.instance.init();
|
|
|
|
|
|
2026-02-27 23:35:54 +01:00
|
|
|
runApp(
|
|
|
|
|
MultiProvider(
|
|
|
|
|
providers: [
|
|
|
|
|
ChangeNotifierProvider(create: (_) => ThemeManager()),
|
|
|
|
|
ChangeNotifierProvider(create: (_) => GameController()),
|
|
|
|
|
],
|
|
|
|
|
child: const TetraQApp(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class TetraQApp extends StatelessWidget {
|
|
|
|
|
const TetraQApp({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return MaterialApp(
|
|
|
|
|
title: 'TetraQ',
|
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
|
theme: ThemeData(
|
|
|
|
|
fontFamily: 'Roboto',
|
|
|
|
|
useMaterial3: true,
|
|
|
|
|
),
|
2026-03-05 15:00:00 +01:00
|
|
|
|
|
|
|
|
// --- BIVIO DELLE LINGUE ATTIVATO! ---
|
|
|
|
|
// Flutter si occuperà di caricare automaticamente tutte le lingue
|
|
|
|
|
// che hai generato tramite lo script.
|
|
|
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
|
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
|
|
|
// ------------------------------------
|
|
|
|
|
|
2026-02-27 23:35:54 +01:00
|
|
|
home: const HomeScreen(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|