Skip to content

Commit

Permalink
♻️refacotr : #53 유저 언어 및 주석
Browse files Browse the repository at this point in the history
  • Loading branch information
seochan99 committed Apr 11, 2024
1 parent aa6d9fd commit 88ed4b2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 18 deletions.
2 changes: 0 additions & 2 deletions lib/main_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'package:earlips/utilities/style/color_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:get/get.dart';
import 'package:earlips/bindings/root_binding.dart';
import 'views/root/root_screen.dart';
import 'utilities/app_routes.dart';

class MainApp extends StatelessWidget {
Expand Down
8 changes: 8 additions & 0 deletions lib/viewModels/study/date_study_screen_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:intl/intl.dart';

/// 학습 세션 데이터 모델
/// 세션 유형, 생성 날짜, 텍스트, 인덱스를 가지고 있음
/// 세션 유형은 0: 음소, 1: 단어, 2: 문장
/// 세션 인덱스는 세션의 순서를 나타냄
class LearningSession {
final int type; // 세션 유형 (음소, 단어, 문장)
final String createdDate; // 세션 생성 날짜
Expand All @@ -15,6 +19,10 @@ class LearningSession {
required this.index});
}

/// 날짜별 학습 세션 데이터를 가져오는 뷰 모델
/// 파이어스토어에서 날짜별 학습 세션 데이터를 가져옴
/// 세션 데이터는 LearningSession 객체로 변환하여 반환
/// 세션 데이터가 없을 경우 빈 리스트를 반환
class DateStudyViewModel {
final DateTime date;
final FirebaseFirestore _firestore = FirebaseFirestore.instance;
Expand Down
6 changes: 6 additions & 0 deletions lib/viewModels/user/user_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';

/// **UserViewModel**
/// [FirebaseAuth][FirebaseFirestore]를 사용하여 사용자 정보를 가져오는 뷰 모델
/// 사용자 정보를 가져오는 동안 로딩 상태를 관리하고, 사용자 정보를 저장하는 변수를 관리
/// 사용자 정보를 가져오는 동안 에러가 발생하면 에러 처리 로직을 추가할 수 있음
/// 사용자 정보를 가져오는 동안 로딩 상태를 관리하고, 사용자 정보를 저장하는 변수를 관리
/// 사용자 정보를 가져오는 동안 에러가 발생하면 에러 처리 로직을 추가할 수 있음
class UserViewModel extends GetxController {
final FirebaseAuth _auth = FirebaseAuth.instance;
final FirebaseFirestore _firestore = FirebaseFirestore.instance;
Expand Down
30 changes: 14 additions & 16 deletions lib/views/home/home_head_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:math';
import 'package:earlips/viewModels/user/user_viewmodel.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_utils/src/extensions/internacionalization.dart';

final messages = [
'message1',
Expand Down Expand Up @@ -44,33 +43,32 @@ class HomeHeaderWidget extends StatelessWidget {
margin: const EdgeInsets.only(left: 20.0),
child: Row(
mainAxisSize: MainAxisSize.min, // Row의 크기를 내용물에 맞게 조정
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.only(right: 8.0), // 점과 텍스트 사이의 간격 조정
height: 10.0, // 점의 높이
width: 10.0, // 점의 너비
decoration: const BoxDecoration(
color: Colors.green, // 점의 색상을 초록색으로 설정
shape: BoxShape.circle, // 원형으로 점을 만듭니다
shape: BoxShape.circle,
),
),
// Use ViewModel data
isLoggedIn
? Obx(() =>
Text(
'${vm.learningLanguage.value} - ${vm.nickname.value}',
style: const TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis,
),
)
? Obx(
() => Text(
'${vm.systemLanguage.value} - ${vm.nickname.value}',
style: const TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis,
),
)
: Text(
'${'homeLanguage'.tr} - ${'homeHeaderGuest'.tr}',
style: const TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis,
)



'${'homeLanguage'.tr} - ${'homeHeaderGuest'.tr}',
style: const TextStyle(fontSize: 12),
overflow: TextOverflow.ellipsis,
)
],
),
)
Expand Down
5 changes: 5 additions & 0 deletions lib/views/study/date_study_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';

/// * A widget that has a [DateTime] and shows the study record of that date.
/// It shows the study record of the date passed as an argument.
/// * If there is no study record, it shows a message and a button to go to the study screen.
/// * If there is a study record, it shows the study record in a list.
/// * If you click on the study record, it moves to the word screen.
class DateStudyScreen extends StatelessWidget {
final DateTime date;

Expand Down

0 comments on commit 88ed4b2

Please sign in to comment.