공개페이지 완료

This commit is contained in:
2025-11-10 14:14:08 +09:00
parent 2ce0b81483
commit ac43ddb55e
67 changed files with 3220 additions and 224696 deletions
+26 -22
View File
@@ -54,6 +54,7 @@ class MyApp extends StatelessWidget {
}
});
final initial = WidgetsBinding.instance.platformDispatcher.defaultRouteName;
return MaterialApp(
navigatorKey: navigatorKey, // 인증 오류 처리를 위한 전역 네비게이터 키
title: '볼링 매니저',
@@ -150,29 +151,12 @@ class MyApp extends StatelessWidget {
Locale('en', 'US'),
],
locale: const Locale('ko', 'KR'),
// 전역 레이아웃 래퍼: 큰 화면에서 최대 폭 제한 및 좌우 패딩 적용
builder: (context, child) {
const double maxWidth = 1200;
return Container(
alignment: Alignment.topCenter,
color: Theme.of(context).colorScheme.background,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: maxWidth),
child: child,
),
),
);
},
home: authService.isAuthenticated ? const HomeScreen() : const LoginScreen(),
routes: {
'/login': (context) => const LoginScreen(),
'/profile': (context) => const ProfileScreen(),
ClubSettingsScreen.routeName: (context) => const ClubSettingsScreen(),
},
// NOTE: 웹 딥링크 초기 빌드 시 child가 null일 수 있어 단순 패스 처리
builder: (context, child) => child ?? const SizedBox.shrink(),
initialRoute: initial,
onGenerateRoute: (settings) {
final name = settings.name ?? '';
// 공용 이벤트 딥링크 우선 처리
if (name.startsWith('/p/')) {
final hash = name.substring(3);
return MaterialPageRoute(
@@ -187,7 +171,27 @@ class MyApp extends StatelessWidget {
settings: settings,
);
}
return null;
if (name == '/login') {
return MaterialPageRoute(builder: (_) => const LoginScreen(), settings: settings);
}
if (name == '/profile') {
return MaterialPageRoute(builder: (_) => const ProfileScreen(), settings: settings);
}
if (name == ClubSettingsScreen.routeName) {
return MaterialPageRoute(builder: (_) => const ClubSettingsScreen(), settings: settings);
}
// 루트('/') 진입 시에만 홈/로그인 분기
if (name == '/' || name.isEmpty) {
return MaterialPageRoute(
builder: (_) => authService.isAuthenticated ? const HomeScreen() : const LoginScreen(),
settings: settings,
);
}
// 알 수 없는 경로는 루트로 포워딩
return MaterialPageRoute(
builder: (_) => authService.isAuthenticated ? const HomeScreen() : const LoginScreen(),
settings: settings,
);
},
);
},