-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from bunju20/develop
- Loading branch information
Showing
4 changed files
with
100 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,3 +66,5 @@ flutter { | |
} | ||
|
||
dependencies {} | ||
|
||
apply plugin: 'com.google.gms.google-services' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
import 'package:flutter/foundation.dart'; | ||
|
||
import 'package:flutter_sound/flutter_sound.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'dart:convert'; // JSON 데이터를 다루기 위해 필요 | ||
class AnalyzeViewModel with ChangeNotifier { | ||
List<String> userWord = []; | ||
List<String> userSenten = []; | ||
List<int> wrongWordIndexes = []; | ||
List<double> wrongFastIndexes = []; | ||
|
||
final List<String> userWord = [ | ||
"가", "나", "다", "어쩌구", "저쩌구", "입니다", "나는", "매일", "조깅을", "합니다", | ||
"플러터로", "앱", "개발을", "배우고", "있어요", "이것은", "더미", "텍스트입니다", | ||
"데이터를", "시각화하는", "것은", "중요합니다" | ||
]; | ||
final List<String> userSenten = [ | ||
"가 나 다 어쩌구 저쩌구 입니다.", | ||
"나는 매일 조깅을 합니다.", | ||
"플러터로 앱 개발을 배우고 있어요.", | ||
"이것은 더미 텍스트입니다.", | ||
"데이터를 시각화하는 것은 중요합니다.", | ||
]; | ||
final List<int> wrongWordIndexes = [2, 14]; // "다", "앱"을 가리킴 | ||
final List<int> wrongFastIndexes = [1, 3]; // 두 번째와 네 번째 문장을 가리킴 | ||
void updateData(Map<String, dynamic> data) { | ||
userWord = List<String>.from(data['user_word'] as List<dynamic>? ?? []); | ||
userSenten = List<String>.from(data['user_sentence'] as List<dynamic>? ?? []); | ||
wrongWordIndexes = List<int>.from(data['wrong'] as List<dynamic>? ?? []); | ||
wrongFastIndexes = (data['speed'] as List<dynamic>? ?? []).map((e) { | ||
|
||
// ViewModel 초기화 | ||
AnalyzeViewModel() { | ||
// 필요한 초기화 로직 추가 | ||
if (e is double) { | ||
return e; | ||
} else if (e is int) { | ||
return e.toDouble(); | ||
} else { | ||
// 로그 출력 또는 오류 처리 | ||
print("Warning: Invalid type in 'speed' list, defaulting to 0.0"); | ||
return 0.0; // 기본값 | ||
} | ||
}).toList(); | ||
notifyListeners(); // 데이터가 업데이트되면 리스너들에게 알립니다. | ||
} | ||
|
||
// 여기에 필요한 기능을 추가하세요. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters