...
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:feature_common/feature_common.dart';
|
||||
import 'package:service_api/service_api.dart';
|
||||
|
||||
// 각 게임 패키지 import
|
||||
import 'package:feature_game_sudoku/feature_game_sudoku.dart';
|
||||
import 'package:feature_game_mathquiz/feature_game_mathquiz.dart';
|
||||
// ... (나머지 게임들)
|
||||
|
||||
class BrainTrainingHome extends StatelessWidget {
|
||||
const BrainTrainingHome({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('두뇌 건강 지킴이')),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// 1. 상태 체크 카드
|
||||
_buildCheckupCard(context),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 2. 오늘의 추천 코스 (자동 믹스 게임)
|
||||
const Text('오늘의 추천 훈련', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 10),
|
||||
_buildDailyTrainingButton(context),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 3. 게임 아케이드 (자유 선택)
|
||||
const Text('전체 게임', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 10),
|
||||
_buildGameGrid(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCheckupCard(BuildContext context) {
|
||||
return Card(
|
||||
color: Colors.indigo.shade50,
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.health_and_safety, size: 40, color: Colors.indigo),
|
||||
title: const Text('나의 두뇌 건강 체크'),
|
||||
subtitle: const Text('간단한 질문으로 현재 상태를 확인하고\n맞춤형 훈련을 추천받으세요.'),
|
||||
trailing: const Icon(Icons.arrow_forward_ios),
|
||||
onTap: () {
|
||||
// TODO: 체크리스트 화면으로 이동
|
||||
// Navigator.push(context, MaterialPageRoute(builder: (_) => AssessmentScreen()));
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDailyTrainingButton(BuildContext context) {
|
||||
return ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.all(20),
|
||||
backgroundColor: Colors.orange,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
icon: const Icon(Icons.play_circle_fill, size: 32),
|
||||
label: const Text('오늘의 코스 시작하기\n(맞춤형 3종 세트)', textAlign: TextAlign.center, style: TextStyle(fontSize: 18)),
|
||||
onPressed: () {
|
||||
// TODO: Assessment 결과에 따라 선정된 게임들을 순차적으로 실행하는 로직
|
||||
// 예: Sequence -> Math -> ColorMatch 순서로 실행되는 별도 Flow 화면으로 이동
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGameGrid(BuildContext context) {
|
||||
// 모든 게임 리스트
|
||||
final games = [
|
||||
{'name': '스도쿠', 'icon': Icons.grid_3x3, 'dest': const SudokuLobbyScreen()},
|
||||
{'name': '계산 퀴즈', 'icon': Icons.calculate, 'dest': const MathQuizLobbyScreen()},
|
||||
{'name': '순서 기억', 'icon': Icons.onetwothree, 'dest': const SequenceLobbyScreen()},
|
||||
// ... 나머지 게임 추가
|
||||
];
|
||||
|
||||
return GridView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: 1.5,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
),
|
||||
itemCount: games.length,
|
||||
itemBuilder: (context, index) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (_) => games[index]['dest'] as Widget));
|
||||
},
|
||||
child: Card(
|
||||
elevation: 2,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(games[index]['icon'] as IconData, size: 36, color: Colors.blueGrey),
|
||||
const SizedBox(height: 8),
|
||||
Text(games[index]['name'] as String, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user