59 lines
1.7 KiB
Dart
59 lines
1.7 KiB
Dart
|
|
// apps/app_spider/lib/main.dart
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:google_mobile_ads/google_mobile_ads.dart';
|
||
|
|
import 'package:provider/provider.dart';
|
||
|
|
|
||
|
|
// [C] 공통 서비스
|
||
|
|
import 'package:service_api/service_api.dart';
|
||
|
|
// [A] 공통 UI 셸 (인트로 화면)
|
||
|
|
import 'package:feature_common/feature_common.dart';
|
||
|
|
// [B] 스파이더 게임 (로비 화면)
|
||
|
|
import 'package:feature_game_spider/feature_game_spider.dart';
|
||
|
|
|
||
|
|
void main() async {
|
||
|
|
WidgetsFlutterBinding.ensureInitialized();
|
||
|
|
await MobileAds.instance.initialize();
|
||
|
|
|
||
|
|
runApp(
|
||
|
|
// [C] service_api의 ThemeNotifier를 앱 최상단에 등록
|
||
|
|
MultiProvider(
|
||
|
|
providers: [
|
||
|
|
// 1. 기존 ThemeNotifier
|
||
|
|
ChangeNotifierProvider(
|
||
|
|
// 🔽 [수정] .loadTheme() 호출 (앱 시작 시 테마 로드)
|
||
|
|
create: (_) => ThemeNotifier(),
|
||
|
|
),
|
||
|
|
|
||
|
|
// 🔽 [신규] SessionNotifier 추가
|
||
|
|
ChangeNotifierProvider(
|
||
|
|
create: (_) => SessionNotifier(),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
child: const MyApp(),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
class MyApp extends StatelessWidget {
|
||
|
|
const MyApp({super.key});
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
final themeNotifier = context.watch<ThemeNotifier>();
|
||
|
|
|
||
|
|
return MaterialApp(
|
||
|
|
title: '스파이더 솔리테어', // 👈 앱 제목
|
||
|
|
theme: themeNotifier.currentTheme,
|
||
|
|
darkTheme: themeNotifier.currentDarkTheme,
|
||
|
|
themeMode: themeNotifier.currentThemeMode,
|
||
|
|
debugShowCheckedModeBanner: false,
|
||
|
|
|
||
|
|
// [A] feature_common의 IntroScreen을 첫 화면으로 설정
|
||
|
|
home: IntroScreen(
|
||
|
|
// 🔽 [핵심 조립]
|
||
|
|
// Intro가 끝나면 [B]의 SpiderLobbyScreen으로 이동
|
||
|
|
nextScreenBuilder: (context) => const SpiderLobbyScreen(),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|