From 2567d38ca6d8fc2998de01a2db5aeb2f0766292f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=A5=EC=8A=B9=ED=98=B8?= Date: Thu, 3 Aug 2023 01:01:08 +0900 Subject: [PATCH 1/7] fix: timetable translate --- assets/translations/en.json | 4 + assets/translations/ko.json | 4 + lib/pages/main_page.dart | 1 + lib/pages/timetable_page.dart | 6 +- lib/widgets/lecture_group_block.dart | 121 +++++++++++------------ lib/widgets/lecture_group_block_row.dart | 39 +++++--- lib/widgets/lecture_search.dart | 52 ++++++---- 7 files changed, 130 insertions(+), 97 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 15de115c..be3e1071 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -59,6 +59,10 @@ "ask_delete_tab": "Do you really want to delete {}?", "my_tab": "My Table", "tab": "Table {}", + "dialog": { + "add_lecture": "Add Lecture", + "ask_add_lecture": "There is a lecture with overlapping hours. If added, the lecture will be deleted.\nDo you want to add new lecture to the timetable?" + }, "tab_menu": { "copy": "Copy Timetable", "export_img": "Share as Image", diff --git a/assets/translations/ko.json b/assets/translations/ko.json index b17b4968..592a3286 100644 --- a/assets/translations/ko.json +++ b/assets/translations/ko.json @@ -59,6 +59,10 @@ "ask_delete_tab": "{}을(를) 정말 삭제하시겠습니까?", "my_tab": "내 시간표", "tab": "시간표 {}", + "dialog": { + "add_lecture": "수업 추가", + "ask_add_lecture": "시간이 겹치는 수업이 있습니다. 추가하시면 해당 수업은 삭제됩니다.\n시간표에 추가하시겠습니까?" + }, "tab_menu": { "copy": "시간표 복제하기", "export_img": "이미지로 내보내기", diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index 88eee7ab..742e8f29 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -140,6 +140,7 @@ class _MainPageState extends State { borderRadius: BorderRadius.vertical(top: Radius.circular(16.0)), child: Container( + color: OTLColor.grayF, constraints: const BoxConstraints.expand(), child: CustomScrollView( reverse: true, diff --git a/lib/pages/timetable_page.dart b/lib/pages/timetable_page.dart index 5f39a167..6a0a3888 100644 --- a/lib/pages/timetable_page.dart +++ b/lib/pages/timetable_page.dart @@ -95,7 +95,11 @@ class _TimetablePageState extends State { GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { - OTLNavigator.push(context, LectureSearchPage()); + OTLNavigator.push( + context, + LectureSearchPage( + openKeyboard: false, + )); }, child: Padding( padding: diff --git a/lib/widgets/lecture_group_block.dart b/lib/widgets/lecture_group_block.dart index 75fbe087..eecf62e9 100644 --- a/lib/widgets/lecture_group_block.dart +++ b/lib/widgets/lecture_group_block.dart @@ -1,5 +1,7 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:otlplus/constants/color.dart'; +import 'package:otlplus/constants/text_styles.dart'; import 'package:otlplus/models/lecture.dart'; import 'package:otlplus/widgets/lecture_group_block_row.dart'; @@ -11,6 +13,8 @@ class LectureGroupBlock extends StatelessWidget { @override Widget build(BuildContext context) { + final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); + if (lectures.isEmpty) { return Container( margin: const EdgeInsets.only(bottom: 6.0), @@ -22,71 +26,66 @@ class LectureGroupBlock extends StatelessWidget { child: Text("There is no lecture."), ); } - return ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: ColoredBox( - color: Color(0xFFEEEEEE), - child: Padding( - padding: EdgeInsets.fromLTRB(12, 8, 12, 8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 4.0), - child: Wrap( - alignment: WrapAlignment.spaceBetween, - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - Wrap( - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - Text( - lectures.first.commonTitle, - style: const TextStyle( - fontSize: 14.0, fontWeight: FontWeight.bold), - ), - SizedBox( - width: 4, - ), - Text( - lectures.first.oldCode, - style: const TextStyle(fontSize: 14.0), - ), - ], - ), - Text.rich( - TextSpan( - style: const TextStyle( - fontSize: 10.0, - color: Color(0xFF999999), - ), - children: [ - TextSpan( - text: lectures.first.departmentCode, - ), - const TextSpan(text: " / "), - TextSpan(text: lectures.first.type), - ], - ), + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(8.0)), + color: OTLColor.grayE, + ), + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 4.0), + child: Wrap( + alignment: WrapAlignment.spaceBetween, + crossAxisAlignment: WrapCrossAlignment.end, + children: [ + Wrap( + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Text( + isEn + ? lectures.first.commonTitleEn + : lectures.first.commonTitle, + style: bodyBold, + ), + const SizedBox(width: 4), + Text(lectures.first.oldCode, style: bodyRegular), + ], + ), + Text.rich( + TextSpan( + style: labelRegular.copyWith(color: OTLColor.grayA), + children: [ + TextSpan(text: lectures.first.departmentCode), + const TextSpan(text: " / "), + TextSpan( + text: + isEn ? lectures.first.typeEn : lectures.first.type, ), ], ), ), - Padding( - padding: EdgeInsets.symmetric(vertical: 4.0), - child: SizedBox( - height: 1, - child: ColoredBox( - color: Color(0xFFDADADA), - ), - ), - ), - ...lectures.map((lecture) => LectureGroupBlockRow( - lecture: lecture, - onLongPress: () => onLongPress(lecture), - )), - ]), - ), + ], + ), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 4.0), + child: SizedBox( + height: 1, + child: ColoredBox( + color: Color(0xFFDADADA), + ), + ), + ), + ...lectures.map( + (lecture) => LectureGroupBlockRow( + lecture: lecture, + onLongPress: () => onLongPress(lecture), + ), + ), + ], ), ); } diff --git a/lib/widgets/lecture_group_block_row.dart b/lib/widgets/lecture_group_block_row.dart index b816bd5e..4e54cc16 100644 --- a/lib/widgets/lecture_group_block_row.dart +++ b/lib/widgets/lecture_group_block_row.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:otlplus/constants/color.dart'; +import 'package:otlplus/constants/text_styles.dart'; import 'package:otlplus/extensions/lecture.dart'; import 'package:otlplus/models/lecture.dart'; import 'package:otlplus/widgets/responsive_button.dart'; @@ -27,6 +28,7 @@ class _LectureGroupBlockRowState extends State { RegExp exp = new RegExp(r"[^A-Z]"); @override Widget build(BuildContext context) { + final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); final alreadyAdded = context.select((model) => model.currentTimetable.lectures.any((lec) => lec.oldCode == widget.lecture.oldCode && @@ -59,21 +61,27 @@ class _LectureGroupBlockRowState extends State { padding: const EdgeInsets.fromLTRB(8, 6, 0, 6), child: Wrap( children: [ - Text.rich(TextSpan(children: [ + Text.rich( TextSpan( - text: widget.lecture.classTitle, - style: TextStyle( - fontSize: 14.0, fontWeight: FontWeight.bold)), - WidgetSpan( - child: SizedBox( - width: 8, - ), + children: [ + TextSpan( + text: widget.lecture.classTitle, + style: bodyBold, + ), + WidgetSpan( + child: const SizedBox(width: 8), + ), + WidgetSpan( + child: Text( + isEn + ? widget.lecture.professorsStrShortEn + : widget.lecture.professorsStrShort, + style: bodyRegular, + ), + ) + ], ), - WidgetSpan( - child: Text(widget.lecture.professorsStrShort, - style: TextStyle( - fontSize: 14.0, color: Colors.black54))) - ])) + ) ], ), ), @@ -135,9 +143,8 @@ class _LectureGroupBlockRowState extends State { context: context, barrierDismissible: false, builder: (context) => AlertDialog( - title: const Text("수업 추가"), - content: const Text( - "시간이 겹치는 수업이 있습니다. 추가하시면 해당 수업은 삭제됩니다.\n시간표에 추가하시겠습니까?"), + title: Text("timetable.dialog.add_lecture".tr()), + content: Text("timetable.dialog.ask_add_lecture".tr()), actions: [ IconTextButton( padding: EdgeInsets.all(12), diff --git a/lib/widgets/lecture_search.dart b/lib/widgets/lecture_search.dart index df61e93f..3c379a3e 100644 --- a/lib/widgets/lecture_search.dart +++ b/lib/widgets/lecture_search.dart @@ -29,7 +29,7 @@ class _LectureSearchState extends State { return WillPopScope( onWillPop: widget.onClosed, child: ColoredBox( - color: Colors.white, + color: OTLColor.grayF, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -38,14 +38,17 @@ class _LectureSearchState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 0, 12), - child: ClipRRect( + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 0, 12), + child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(8.0)), child: BackgroundButton( - onTap: () => - OTLNavigator.push(context, LectureSearchPage()), - color: Color(0xFFF9F0F0), + onTap: () => OTLNavigator.push( + context, + LectureSearchPage( + openKeyboard: true, + )), + color: OTLColor.pinksLight, child: Padding( padding: EdgeInsets.all(8.0), child: SizedBox( @@ -54,22 +57,29 @@ class _LectureSearchState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - SvgPicture.asset('assets/icons/search.svg', - height: 24.0, - width: 24.0, - colorFilter: ColorFilter.mode( - OTLColor.pinksMain, BlendMode.srcIn)), + SvgPicture.asset( + 'assets/icons/search.svg', + height: 24.0, + width: 24.0, + colorFilter: ColorFilter.mode( + OTLColor.pinksMain, + BlendMode.srcIn, + ), + ), SizedBox(width: 12.0), Flexible( - child: context - .watch() - .lectureSearchquery), + child: context + .watch() + .lectureSearchquery, + ), ], ), ), ), - )), - )), + ), + ), + ), + ), IconTextButton( padding: EdgeInsets.fromLTRB(8, 12, 16, 12), icon: Icons.close_outlined, @@ -86,7 +96,9 @@ class _LectureSearchState extends State { : Scrollbar( controller: _scrollController, child: _buildListView( - searchModel.lectures ?? [[]], _scrollController), + searchModel.lectures ?? [[]], + _scrollController, + ), ), ), ], @@ -96,7 +108,9 @@ class _LectureSearchState extends State { } ListView _buildListView( - List> lectures, ScrollController scrollController) { + List> lectures, + ScrollController scrollController, + ) { return ListView.separated( padding: EdgeInsets.fromLTRB(16, 0, 16, 12), controller: scrollController, From d730c43d08ff4bc0bae3747c2cacedc7ad9572b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=A5=EC=8A=B9=ED=98=B8?= Date: Thu, 3 Aug 2023 01:27:18 +0900 Subject: [PATCH 2/7] fix: timetable translate 2 --- assets/translations/en.json | 4 ++-- assets/translations/ko.json | 2 +- lib/pages/timetable_page.dart | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index be3e1071..fafbee93 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -55,8 +55,8 @@ "remained_datetime": "D-{} days {} hours {} minutes" }, "timetable": { - "ask_delete_lecture": "Are you delete class '{}'?", - "ask_delete_tab": "Do you really want to delete {}?", + "ask_delete_lecture": "Do you want to delete class '{}'?", + "ask_delete_tab": "Do you really want to delete '{}'?", "my_tab": "My Table", "tab": "Table {}", "dialog": { diff --git a/assets/translations/ko.json b/assets/translations/ko.json index 592a3286..eb0da1cf 100644 --- a/assets/translations/ko.json +++ b/assets/translations/ko.json @@ -56,7 +56,7 @@ }, "timetable": { "ask_delete_lecture": "'{}' 수업을 삭제하시겠습니까?", - "ask_delete_tab": "{}을(를) 정말 삭제하시겠습니까?", + "ask_delete_tab": "'{}'을(를) 정말 삭제하시겠습니까?", "my_tab": "내 시간표", "tab": "시간표 {}", "dialog": { diff --git a/lib/pages/timetable_page.dart b/lib/pages/timetable_page.dart index 6a0a3888..24b7984b 100644 --- a/lib/pages/timetable_page.dart +++ b/lib/pages/timetable_page.dart @@ -171,10 +171,14 @@ class _TimetablePageState extends State { } Timetable _buildTimetable( - BuildContext context, List lectures, bool isExamTime) { + BuildContext context, + List lectures, + bool isExamTime, + ) { bool isFirst = true; final tempLecture = context.select((model) => model.tempLecture); + final isEn = EasyLocalization.of(context)?.currentLocale == Locale('en'); return Timetable( lectures: (tempLecture == null) ? lectures : [...lectures, tempLecture], @@ -209,7 +213,7 @@ class _TimetablePageState extends State { builder: (context) => AlertDialog( title: Text("common.delete".tr()), content: Text("timetable.ask_delete_lecture").tr( - args: [lecture.title], + args: [isEn ? lecture.titleEn : lecture.title], ), actions: [ IconTextButton( From 73751668d386ca4e42896221ccd01a242a48c630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=A5=EC=8A=B9=ED=98=B8?= Date: Thu, 3 Aug 2023 18:46:49 +0900 Subject: [PATCH 3/7] fix: reviews-syncronize --- lib/main.dart | 4 +-- lib/pages/review_page.dart | 34 +++++++++++-------- lib/providers/hall_of_fame_model.dart | 17 +++++----- ...w_model.dart => latest_reviews_model.dart} | 19 ++++++----- 4 files changed, 41 insertions(+), 33 deletions(-) rename lib/providers/{review_model.dart => latest_reviews_model.dart} (64%) diff --git a/lib/main.dart b/lib/main.dart index 3bd9f187..d9465d03 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,7 +21,7 @@ import 'package:otlplus/providers/auth_model.dart'; import 'package:otlplus/providers/course_detail_model.dart'; import 'package:otlplus/providers/info_model.dart'; import 'package:otlplus/providers/lecture_detail_model.dart'; -import 'package:otlplus/providers/review_model.dart'; +import 'package:otlplus/providers/latest_reviews_model.dart'; import 'package:otlplus/providers/lecture_search_model.dart'; import 'package:otlplus/providers/timetable_model.dart'; import 'package:otlplus/utils/create_material_color.dart'; @@ -66,7 +66,7 @@ void main() { ), ChangeNotifierProvider(create: (_) => LectureSearchModel()), ChangeNotifierProvider(create: (_) => CourseSearchModel()), - ChangeNotifierProvider(create: (_) => ReviewModel()), + ChangeNotifierProvider(create: (_) => LatestReviewsModel()), ChangeNotifierProvider(create: (_) => LikedReviewModel()), ChangeNotifierProvider(create: (_) => HallOfFameModel()), ChangeNotifierProvider(create: (_) => CourseDetailModel()), diff --git a/lib/pages/review_page.dart b/lib/pages/review_page.dart index b937630c..9176f1eb 100644 --- a/lib/pages/review_page.dart +++ b/lib/pages/review_page.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:otlplus/pages/course_detail_page.dart'; -import 'package:otlplus/models/review.dart'; import 'package:otlplus/providers/hall_of_fame_model.dart'; import 'package:otlplus/utils/navigator.dart'; import 'package:otlplus/widgets/hall_of_fame_control.dart'; @@ -8,7 +7,7 @@ import 'package:otlplus/widgets/otl_scaffold.dart'; import 'package:otlplus/widgets/review_mode_control.dart'; import 'package:provider/provider.dart'; import 'package:otlplus/providers/course_detail_model.dart'; -import 'package:otlplus/providers/review_model.dart'; +import 'package:otlplus/providers/latest_reviews_model.dart'; import 'package:otlplus/widgets/review_block.dart'; class ReviewPage extends StatefulWidget { @@ -23,9 +22,6 @@ class _ReviewPageState extends State { Widget build(BuildContext context) { final _selectedMode = context.select((m) => m.selectedMode); - final latestReviews = - context.select>((m) => m.reviews); - final hallOfFames = context.watch().hallOfFames(); return OTLLayout( leading: ReviewModeControl( @@ -45,12 +41,12 @@ class _ReviewPageState extends State { child: NotificationListener( onNotification: (scrollNotification) { if (_selectedMode == 1) { - final reviewModel = context.read(); + final reviewModel = context.read(); if (!reviewModel.isLoading && scrollNotification.metrics.pixels == scrollNotification.metrics.maxScrollExtent) { - reviewModel.loadReviews(); + reviewModel.loadLatestReviews(); } return true; @@ -60,7 +56,7 @@ class _ReviewPageState extends State { if (!hallOfFameModel.isLoading && scrollNotification.metrics.pixels == scrollNotification.metrics.maxScrollExtent) { - hallOfFameModel.loadHallOfFames(); + hallOfFameModel.loadHallOfFame(); } return true; @@ -71,9 +67,7 @@ class _ReviewPageState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - _selectedMode == 1 - ? _buildLatestReviews(latestReviews) - : _buildHallOfFames(hallOfFames), + _selectedMode == 1 ? BuildLatestsReviews() : BuildHallOfFame() ], ), ), @@ -81,14 +75,20 @@ class _ReviewPageState extends State { ), ); } +} + +class BuildLatestsReviews extends StatelessWidget { + const BuildLatestsReviews({Key? key}) : super(key: key); - Widget _buildLatestReviews(latestReviews) { + @override + Widget build(BuildContext context) { final _scrollController = context.watch().scrollController; + final latestReviews = context.watch().latestReviews; return Expanded( child: RefreshIndicator( onRefresh: () async { - await context.read().clear(); + await context.read().clear(); }, child: Scrollbar( child: CustomScrollView( @@ -132,9 +132,15 @@ class _ReviewPageState extends State { ), ); } +} + +class BuildHallOfFame extends StatelessWidget { + const BuildHallOfFame({Key? key}) : super(key: key); - Widget _buildHallOfFames(hallOfFames) { + @override + Widget build(BuildContext context) { final _scrollController = context.watch().scrollController; + final hallOfFames = context.watch().hallOfFame; return Expanded( child: RefreshIndicator( diff --git a/lib/providers/hall_of_fame_model.dart b/lib/providers/hall_of_fame_model.dart index c81a917e..bbd242a1 100644 --- a/lib/providers/hall_of_fame_model.dart +++ b/lib/providers/hall_of_fame_model.dart @@ -19,6 +19,7 @@ class HallOfFameModel extends ChangeNotifier { Semester? get semeseter => _semester; void setSemester(Semester? semester) { _semester = semester; + notifyListeners(); // 1. Animate Immediately But Error Prone // _scrollController.animateTo( @@ -40,16 +41,16 @@ class HallOfFameModel extends ChangeNotifier { ); } - List _hallOfFames = []; - List hallOfFames() { - if (_hallOfFames.length == 0 && !_isLoading) loadHallOfFames(); - return _hallOfFames; + List _hallOfFame = []; + List get hallOfFame { + if (_hallOfFame.length == 0 && !_isLoading) loadHallOfFame(); + return _hallOfFame; } Future clear() async { - _hallOfFames.clear(); + _hallOfFame.clear(); _page = 0; - await loadHallOfFames(); + await loadHallOfFame(); // 2. Animate Slowly But Safe _scrollController.animateTo( @@ -59,7 +60,7 @@ class HallOfFameModel extends ChangeNotifier { ); } - Future loadHallOfFames() async { + Future loadHallOfFame() async { _isLoading = true; try { @@ -82,7 +83,7 @@ class HallOfFameModel extends ChangeNotifier { }); } final rawReviews = response.data as List; - _hallOfFames.addAll(rawReviews.map((review) => Review.fromJson(review))); + _hallOfFame.addAll(rawReviews.map((review) => Review.fromJson(review))); _page++; _isLoading = false; notifyListeners(); diff --git a/lib/providers/review_model.dart b/lib/providers/latest_reviews_model.dart similarity index 64% rename from lib/providers/review_model.dart rename to lib/providers/latest_reviews_model.dart index 166a8589..4e86ee86 100644 --- a/lib/providers/review_model.dart +++ b/lib/providers/latest_reviews_model.dart @@ -3,26 +3,26 @@ import 'package:otlplus/constants/url.dart'; import 'package:otlplus/dio_provider.dart'; import 'package:otlplus/models/review.dart'; -class ReviewModel extends ChangeNotifier { +class LatestReviewsModel extends ChangeNotifier { int _page = 0; int get page => _page; bool _isLoading = false; bool get isLoading => _isLoading; - List _reviews = []; - List get reviews { - if (_reviews.length == 0 && !_isLoading) loadReviews(); - return _reviews; + List _latestReviews = []; + List get latestReviews { + if (_latestReviews.length == 0 && !_isLoading) loadLatestReviews(); + return _latestReviews; } Future clear() async { - _reviews.clear(); + _latestReviews.clear(); _page = 0; - await loadReviews(); + await loadLatestReviews(); } - Future loadReviews() async { + Future loadLatestReviews() async { _isLoading = true; try { @@ -33,7 +33,8 @@ class ReviewModel extends ChangeNotifier { "limit": 10, }); final rawReviews = response.data as List; - _reviews.addAll(rawReviews.map((review) => Review.fromJson(review))); + _latestReviews + .addAll(rawReviews.map((review) => Review.fromJson(review))); _page++; _isLoading = false; notifyListeners(); From aad911cd12633b4010a8523f80331da391fbe5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=A5=EC=8A=B9=ED=98=B8?= Date: Fri, 4 Aug 2023 18:09:08 +0900 Subject: [PATCH 4/7] fix: timetable translate 3 --- assets/translations/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index fafbee93..2a32af4e 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -61,7 +61,7 @@ "tab": "Table {}", "dialog": { "add_lecture": "Add Lecture", - "ask_add_lecture": "There is a lecture with overlapping hours. If added, the lecture will be deleted.\nDo you want to add new lecture to the timetable?" + "ask_add_lecture": "There is a lecture with overlapping hours. If added, the previous lecture will be deleted.\nDo you want to add new lecture to the timetable?" }, "tab_menu": { "copy": "Copy Timetable", From 0b9b63480b375783ef799faedde518e8deb0e32c Mon Sep 17 00:00:00 2001 From: star Date: Sun, 6 Aug 2023 18:28:36 +0900 Subject: [PATCH 5/7] fix: review block expand text translation --- assets/translations/en.json | 3 ++- assets/translations/ko.json | 3 ++- lib/widgets/expandable_text.dart | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 2a32af4e..f73234ec 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -117,7 +117,8 @@ "load": "Load", "speech": "Speech", "like": "Like", - "report": "Report" + "report": "Report", + "expand": "more" }, "user": { "name": "Name", diff --git a/assets/translations/ko.json b/assets/translations/ko.json index eb0da1cf..52f0d213 100644 --- a/assets/translations/ko.json +++ b/assets/translations/ko.json @@ -117,7 +117,8 @@ "load": "널널", "speech": "강의", "like": "추천", - "report": "신고하기" + "report": "신고하기", + "expand": "더 보기" }, "user": { "name": "이름", diff --git a/lib/widgets/expandable_text.dart b/lib/widgets/expandable_text.dart index 19779df8..5df05919 100644 --- a/lib/widgets/expandable_text.dart +++ b/lib/widgets/expandable_text.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart' as _; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -25,11 +26,11 @@ class ExpandableTextState extends State { TextSpan expandButton = TextSpan( children: [ TextSpan( - text: "..", + text: ".. ", style: widget.style, ), TextSpan( - text: " 더보기", + text: "review.expand".tr(), style: (widget.style ?? TextStyle()).copyWith(color: Colors.black45), recognizer: TapGestureRecognizer() From efb8049ab957090ef116ccd4f46932fc8efac531 Mon Sep 17 00:00:00 2001 From: star Date: Sun, 6 Aug 2023 18:41:29 +0900 Subject: [PATCH 6/7] fix: lecture detail page translation --- assets/translations/en.json | 2 ++ assets/translations/ko.json | 2 ++ lib/pages/lecture_detail_page.dart | 9 +++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index f73234ec..76a99f5e 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -59,6 +59,8 @@ "ask_delete_tab": "Do you really want to delete '{}'?", "my_tab": "My Table", "tab": "Table {}", + "add_lecture": "Add Lecture", + "remove_lecture": "Remove Lecture", "dialog": { "add_lecture": "Add Lecture", "ask_add_lecture": "There is a lecture with overlapping hours. If added, the previous lecture will be deleted.\nDo you want to add new lecture to the timetable?" diff --git a/assets/translations/ko.json b/assets/translations/ko.json index 52f0d213..1ec81329 100644 --- a/assets/translations/ko.json +++ b/assets/translations/ko.json @@ -59,6 +59,8 @@ "ask_delete_tab": "'{}'을(를) 정말 삭제하시겠습니까?", "my_tab": "내 시간표", "tab": "시간표 {}", + "add_lecture": "시간표에 추가", + "remove_lecture": "시간표에서 제거", "dialog": { "add_lecture": "수업 추가", "ask_add_lecture": "시간이 겹치는 수업이 있습니다. 추가하시면 해당 수업은 삭제됩니다.\n시간표에 추가하시겠습니까?" diff --git a/lib/pages/lecture_detail_page.dart b/lib/pages/lecture_detail_page.dart index 6c3487e0..98e34f2a 100644 --- a/lib/pages/lecture_detail_page.dart +++ b/lib/pages/lecture_detail_page.dart @@ -113,9 +113,8 @@ class LectureDetailPage extends StatelessWidget { context: context, barrierDismissible: false, builder: (context) => AlertDialog( - title: const Text("수업 추가"), - content: const Text( - "시간이 겹치는 수업이 있습니다. 추가하시면 해당 수업은 삭제됩니다.\n시간표에 추가하시겠습니까?"), + title: Text("timetable.dialog.add_lecture".tr()), + content: Text("timetable.dialog.ask_add_lecture".tr()), actions: [ IconTextButton( padding: EdgeInsets.all(12), @@ -144,7 +143,9 @@ class LectureDetailPage extends StatelessWidget { ); } }, - text: isAdded ? "시간표에서 제거" : "시간표에 추가", + text: isAdded + ? "timetable.remove_lecture".tr() + : "timetable.add_lecture".tr(), textStyle: const TextStyle(fontSize: 12.0), icon: isAdded ? Icons.close : Icons.add, iconSize: 14, From 11fec86459e0a80616087b182a139ab3bd1c4c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=A5=EC=8A=B9=ED=98=B8?= Date: Mon, 7 Aug 2023 14:50:41 +0900 Subject: [PATCH 7/7] minor design change --- lib/pages/review_page.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pages/review_page.dart b/lib/pages/review_page.dart index 9176f1eb..22d57c2d 100644 --- a/lib/pages/review_page.dart +++ b/lib/pages/review_page.dart @@ -36,7 +36,7 @@ class _ReviewPageState extends State { ), body: Card( shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical(top: Radius.circular(16.0)), + borderRadius: BorderRadius.only(topRight: Radius.circular(16.0)), ), child: NotificationListener( onNotification: (scrollNotification) { @@ -67,7 +67,7 @@ class _ReviewPageState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - _selectedMode == 1 ? BuildLatestsReviews() : BuildHallOfFame() + _selectedMode == 1 ? LatestReviewsPage() : HallOfFamePage() ], ), ), @@ -77,8 +77,8 @@ class _ReviewPageState extends State { } } -class BuildLatestsReviews extends StatelessWidget { - const BuildLatestsReviews({Key? key}) : super(key: key); +class LatestReviewsPage extends StatelessWidget { + const LatestReviewsPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -134,8 +134,8 @@ class BuildLatestsReviews extends StatelessWidget { } } -class BuildHallOfFame extends StatelessWidget { - const BuildHallOfFame({Key? key}) : super(key: key); +class HallOfFamePage extends StatelessWidget { + const HallOfFamePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) {