156 lines
6.3 KiB
Dart
156 lines
6.3 KiB
Dart
// // packages/feature_common/lib/screens/home_screen.dart
|
|
|
|
// import 'dart:developer';
|
|
// import 'package:flutter/material.dart';
|
|
// import 'package:provider/provider.dart';
|
|
|
|
// // 🔽 [수정] 서비스만 import하고, 모델은 새로 만든 GameInfo를 사용
|
|
// import 'package:service_api/service_api.dart';
|
|
// import '../models/game_info.dart'; // 👈 GameInfo 모델 import
|
|
|
|
// // 🔽 [수정] 내부에서 사용하던 위젯/화면 import
|
|
// import 'ranking_screen.dart';
|
|
// import 'settings_screen.dart';
|
|
// import '../widgets/ad_banner_widget.dart';
|
|
|
|
// class HomeScreen extends StatefulWidget {
|
|
// // 🔽 [수정] 'onStartGame' 대신 'availableGames' 리스트를 주입받음
|
|
// final List<GameInfo> availableGames;
|
|
|
|
// const HomeScreen({
|
|
// super.key,
|
|
// required this.availableGames, // 👈 생성자 변경
|
|
// });
|
|
|
|
// @override
|
|
// State<HomeScreen> createState() => _HomeScreenState();
|
|
// }
|
|
|
|
// class _HomeScreenState extends State<HomeScreen> {
|
|
// // 🔽 [삭제] 스도쿠 전용 상태 변수들 모두 삭제
|
|
// // int _maxUnlockedLevel = 1;
|
|
// // Map<int, (int, int)> _rankHistory = {};
|
|
// // String? _userName;
|
|
// // late String _selectedThemeName;
|
|
// // bool _isLoading = false;
|
|
|
|
// // 🔽 [삭제] 스도쿠 전용 서비스들 삭제
|
|
// // final PuzzleService _puzzleService = PuzzleService();
|
|
// // final IdentityService _identityService = IdentityService();
|
|
|
|
// @override
|
|
// void initState() {
|
|
// super.initState();
|
|
// // 🔽 [삭제] _loadProgress() 등 스도쿠 전용 로직 삭제
|
|
// }
|
|
|
|
// // 🔽 [삭제] _loadProgress 메서드 전체 삭제
|
|
// // Future<void> _loadProgress() async { ... }
|
|
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// context.watch<ThemeNotifier>();
|
|
// final theme = Theme.of(context);
|
|
|
|
// return Scaffold(
|
|
// appBar: AppBar(
|
|
// // 🔽 [수정] 앱 이름은 main.dart에서 설정하므로 여기선 비움
|
|
// title: const Text('게임 센터'),
|
|
// actions: [
|
|
// IconButton(
|
|
// icon: const Icon(Icons.settings_outlined),
|
|
// onPressed: () {
|
|
// Navigator.push(
|
|
// context,
|
|
// MaterialPageRoute(
|
|
// builder: (context) => const SettingsScreen(),
|
|
// ),
|
|
// );
|
|
// },
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// body: LayoutBuilder(
|
|
// builder: (context, constraints) {
|
|
// const double maxContentRatio = 0.6;
|
|
// final double constrainedWidth = (constraints.maxHeight * maxContentRatio) > 500
|
|
// ? 500 : (constraints.maxHeight * maxContentRatio);
|
|
|
|
// return Center(
|
|
// child: ConstrainedBox(
|
|
// constraints: BoxConstraints(maxWidth: constrainedWidth),
|
|
// child: Column(
|
|
// children: [
|
|
// // 🔽 [삭제] 스도쿠 전용 '테마 선택' Dropdown 삭제
|
|
|
|
// // 2. 레벨 선택 리스트 (범용으로 변경)
|
|
// Expanded(
|
|
// // 🔽 [수정] ListView.builder가 주입받은 'widget.availableGames' 사용
|
|
// child: ListView.builder(
|
|
// itemCount: widget.availableGames.length,
|
|
// itemBuilder: (context, index) {
|
|
// final GameInfo game = widget.availableGames[index];
|
|
|
|
// return Card(
|
|
// margin: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 4.0),
|
|
// child: ListTile(
|
|
// leading: Icon(
|
|
// game.icon, // 👈 GameInfo에서 아이콘 가져오기
|
|
// color: theme.primaryColor,
|
|
// ),
|
|
// title: Text(game.name, style: const TextStyle( // 👈 GameInfo에서 이름 가져오기
|
|
// fontSize: 18,
|
|
// fontWeight: FontWeight.bold,
|
|
// )),
|
|
// trailing: const Icon(Icons.play_arrow_rounded),
|
|
|
|
// // 🔽 [수정] onTap에 주입받은 game.onTap 함수 연결
|
|
// onTap: game.onTap,
|
|
// ),
|
|
// );
|
|
// },
|
|
// ),
|
|
// ),
|
|
|
|
// // 3. 랭킹 보기 버튼 (랭킹 스크린은 공통이므로 그대로 둠)
|
|
// Container(
|
|
// margin: const EdgeInsets.fromLTRB(16.0, 0, 16.0, 8.0),
|
|
// // ... (이하 랭킹 보기 버튼 스타일은 동일) ...
|
|
// child: InkWell(
|
|
// onTap: () {
|
|
// // 🔽 [수정] 스도쿠 레벨 대신 기본 랭킹 화면으로
|
|
// Navigator.push(
|
|
// context,
|
|
// MaterialPageRoute(
|
|
// builder: (context) => const RankingScreen(
|
|
// // initialDifficultyName: "중급 (9x9)", // 👈 필요시 하드코딩
|
|
// ),
|
|
// ),
|
|
// );
|
|
// },
|
|
// child: Container(
|
|
// width: double.infinity,
|
|
// padding: const EdgeInsets.symmetric(vertical: 14.0),
|
|
// child: Text(
|
|
// '🏆 전체 랭킹 보기',
|
|
// textAlign: TextAlign.center,
|
|
// style: TextStyle(
|
|
// fontSize: 16,
|
|
// fontWeight: FontWeight.bold,
|
|
// color: theme.colorScheme.onSurfaceVariant,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// // ...
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// );
|
|
// },
|
|
// ),
|
|
// bottomNavigationBar: const AdBannerWidget(),
|
|
// );
|
|
// }
|
|
// } |