This commit is contained in:
lunaticbum 2025-12-12 13:27:49 +09:00
parent de84353fc5
commit 03a7ed2ef2
13 changed files with 333 additions and 2 deletions

View File

@ -45,7 +45,7 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
</dict>
</plist>

View File

@ -0,0 +1,31 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.flutter-plugins-dependencies
/build/
/coverage/

View File

@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "adc901062556672b4138e18a4dc62a4be8f4b3c2"
channel: "stable"
project_type: package

View File

@ -0,0 +1,3 @@
## 0.0.1
* TODO: Describe initial release.

View File

@ -0,0 +1 @@
TODO: Add your license here.

View File

@ -0,0 +1,39 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/to/develop-packages).
-->
TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
## Features
TODO: List what your package can do. Maybe include images, gifs, or videos.
## Getting started
TODO: List prerequisites and provide or point to information on how to
start using the package.
## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
```dart
const like = 'sample';
```
## Additional information
TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.

View File

@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@ -0,0 +1,5 @@
/// A Calculator.
class Calculator {
/// Returns [value] plus 1.
int addOne(int value) => value + 1;
}

View File

@ -0,0 +1,21 @@
enum CognitiveArea {
memory, //
calculation, // /
attention, //
perception, // /
}
//
enum BrainGameType {
sequence(CognitiveArea.memory, '순서 기억'), // feature_game_sequence
cardFlip(CognitiveArea.memory, '카드 뒤집기'), // feature_game_cardflip
mathQuiz(CognitiveArea.calculation, '암산 퀴즈'), // feature_game_mathquiz
sudoku(CognitiveArea.calculation, '스도쿠'), // feature_game_sudoku
colorMatch(CognitiveArea.attention, '색상 매칭'), // feature_game_colormatch
findDiff(CognitiveArea.perception, '다른 그림 찾기'), // feature_game_finddiff
spider(CognitiveArea.perception, '스파이더 카드'); // feature_game_spider
final CognitiveArea area;
final String label;
const BrainGameType(this.area, this.label);
}

View File

@ -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)),
],
),
),
);
},
);
}
}

View File

@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import '../models/cognitive_type.dart';
class AssessmentService {
// (Yes = 1, )
Map<CognitiveArea, int> calculateWeaknesses(Map<String, bool> answers) {
Map<CognitiveArea, int> scoreMap = {
CognitiveArea.memory: 0,
CognitiveArea.calculation: 0,
CognitiveArea.attention: 0,
CognitiveArea.perception: 0,
};
// ID와
// :
if (answers['q_memory_1'] == true) scoreMap[CognitiveArea.memory] = (scoreMap[CognitiveArea.memory] ?? 0) + 1;
// ...
return scoreMap;
}
//
List<BrainGameType> generateDailyCourse(Map<CognitiveArea, int> weaknesses) {
List<BrainGameType> course = [];
// 1. 1 ( )
CognitiveArea weakest = weaknesses.entries.reduce((a, b) => a.value > b.value ? a : b).key;
course.add(BrainGameType.values.firstWhere((g) => g.area == weakest));
// 2. 2 ( )
List<BrainGameType> others = BrainGameType.values.where((g) => g.area != weakest).toList()..shuffle();
course.addAll(others.take(2));
return course;
}
}

View File

@ -0,0 +1,54 @@
name: feature_brain_trainer
description: "A new Flutter package project."
version: 0.0.1
homepage:
environment:
sdk: ^3.9.2
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/to/asset-from-package
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/to/font-from-package

View File

@ -0,0 +1,12 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:feature_brain_trainer/feature_brain_trainer.dart';
void main() {
test('adds one to input values', () {
final calculator = Calculator();
expect(calculator.addOne(2), 3);
expect(calculator.addOne(-7), -6);
expect(calculator.addOne(0), 1);
});
}