Skip to content

Commit

Permalink
refact: add mypage module 주석, refactor
Browse files Browse the repository at this point in the history
mypage binding 삭제(controller 미사용으로 삭제)
cosnt, import 구문, 주석 추가
  • Loading branch information
kimwest00 committed Nov 5, 2023
1 parent 29634eb commit dbe3342
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 175 deletions.
4 changes: 2 additions & 2 deletions lib/modules/event/controller/event_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import '../../../provider/api/util/global_api_field.dart';
import '../../../util/const/style/global_logger.dart';

class EventController extends GetxController {
///* event list
RxList<Event> eventList = <Event>[].obs;

///* pagination 함수
Future<void> getMoreNotice({required int index}) async {
logger.d(
"2: 총 페이지수 : ${EventApi.event.totalCnt ~/ PAGINATION_SIZE}, 불러오고자 하는 페이지: ${index}");
if (!(EventApi.event.totalCnt ~/ PAGINATION_SIZE < index) &&
!EventApi.event.isLast) {
EventApi.event.currentpage = index;
Expand Down
59 changes: 33 additions & 26 deletions lib/modules/event/view/event_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import '../../../util/const/style/global_logger.dart';
import '../../../util/const/style/global_skeleton.dart';
import '../controller/event_controller.dart';

///<h2>이벤트 화면</h2>
///이벤트 탭을 눌렀을때 나오는 화면
class EventScreen extends GetView<EventController> {
const EventScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: [
//*1.제목 header
child: Column(
children: [
///*1.제목 header
Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 8.h)
.copyWith(bottom: 17.h),
Expand All @@ -36,38 +38,43 @@ class EventScreen extends GetView<EventController> {
],
),
),

///*2. event body
///carousel slider로 구성
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 8.h)
.copyWith(bottom: 17.h),
width: double.infinity,
height: double.infinity,
child: Obx(
()=>controller.eventList.isEmpty?CommonSkeleton.event():
CarouselSlider.builder(
itemCount: controller.eventList.length,
itemBuilder: (context, index, realIndex) {
if (index % (PAGINATION_SIZE - 1) == 0 &&
index != 0) {
logger.d("1. getMore 호출!");
Future.wait({
controller.getMoreNotice(
index: index ~/ (PAGINATION_SIZE - 1))
});
}
return EventWidget(event: controller.eventList[index]);
},
options: CarouselOptions(
autoPlay: false,
aspectRatio: 299.w / 445.h,
viewportFraction: 1,
scrollDirection: Axis.vertical),
),
() => controller.eventList.isEmpty
? CommonSkeleton.event()
: CarouselSlider.builder(
itemCount: controller.eventList.length,
itemBuilder: (context, index, realIndex) {
if (index % (PAGINATION_SIZE - 1) == 0 &&
index != 0) {
Future.wait({
controller.getMoreNotice(
index: index ~/ (PAGINATION_SIZE - 1))
});
}
///* event detail 라우팅은 해당 위젯 내부에서 구현
return EventWidget(
event: controller.eventList[index]);
},
options: CarouselOptions(
autoPlay: false,
aspectRatio: 299.w / 445.h,
viewportFraction: 1,
scrollDirection: Axis.vertical),
),
),
),
),
],
),
));
],
),
));
}
}
4 changes: 2 additions & 2 deletions lib/modules/event/widget/event_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import '../../../util/const/style/global_color.dart';
import '../../../util/const/style/global_text_styles.dart';
import '../../home/widget/home_widget.dart';

///<h2>이벤트 아이템 위젯</h2>
class EventWidget extends StatelessWidget {
final Event event;

Expand All @@ -17,8 +18,7 @@ class EventWidget extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Get.toNamed(Routes.event_detail,
arguments: {"eventId": event.eventId});
Get.toNamed(Routes.event_detail, arguments: {"eventId": event.eventId});
},
child: Container(
width: double.infinity,
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/event_detail/view/event_detail_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:match/util/const/style/global_text_styles.dart';

import '../../home/widget/home_widget.dart';

///<h2>이벤트 상세 화면</h2>
///공지사항,알림과 유사한 구조
class EventDetailScreen extends GetView<EventDetailController> {
const EventDetailScreen({super.key});

Expand Down
2 changes: 0 additions & 2 deletions lib/modules/main/binding/main_binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:match/modules/event/controller/event_controller.dart';

import '../../../provider/service/auth_service.dart';
import '../../home/controller/home_controller.dart';
import '../../mypage/controller/mypage_controller.dart';
import '../controller/main_controller.dart';

///<h2>로그인- 회원가입 이후에 실행되는 binding</h2>
Expand All @@ -18,6 +17,5 @@ class MainBiding implements Bindings {
Get.put(HomeController());
Get.lazyPut(() => DonateController());
Get.lazyPut(() => EventController());
Get.lazyPut(() => MypageController());
}
}
12 changes: 0 additions & 12 deletions lib/modules/mypage/binding/mypage_binding.dart

This file was deleted.

9 changes: 9 additions & 0 deletions lib/modules/mypage/binding/nickname_binding.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:get/get.dart';
import 'package:match/modules/mypage/controller/nickname_controller.dart';

class NicknameBinding implements Bindings {
@override
void dependencies() {
Get.put(() => NickNameController());
}
}
10 changes: 0 additions & 10 deletions lib/modules/mypage/controller/mypage_controller.dart

This file was deleted.

4 changes: 3 additions & 1 deletion lib/modules/mypage/controller/nickname_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import '../../../provider/service/auth_service.dart';

class NickNameController extends GetxController {
Rx<TextEditingController> nicknameController =
///*닉네임 변경시 textfield controller
TextEditingController(text: AuthService.to.myProfile.value.nickName).obs;

///*닉네임 변경 가능시, api에 보낼 닉네임
Rx<String> newNickname = "".obs;
///*버튼 활성화 여부
Rx<bool> canChange = false.obs;
}
15 changes: 7 additions & 8 deletions lib/modules/mypage/view/mypage_edit_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';
import 'package:match/modules/mypage/view/mypage_view.dart';
import 'package:match/util/components/global_app_bar.dart';

import '../../../provider/routes/routes.dart';
import '../../../provider/service/auth_service.dart';
import '../../../util/const/global_variable.dart';
Expand Down Expand Up @@ -64,16 +63,16 @@ class MypageEditScreen extends StatelessWidget {
SizedBox(
height: 20.h,
),
PrivacyInfo(
privacyInfo(
title: "이름", value: AuthService.to.myProfile.value.name),
SizedBox(
height: 20.h,
),
PrivacyInfo(
privacyInfo(
title: "휴대폰번호",
value: AuthService.to.myProfile.value.phone,
icon: "phone_edit",
onTap: () async{
onTap: () async {
Get.toNamed(Routes.phone);
},
),
Expand All @@ -85,15 +84,15 @@ class MypageEditScreen extends StatelessWidget {
thickness: 1.h,
color: AppColors.divider1,
),
MypageListTile(title: "결제 수단 관리"),
MypageListTile(title: "로그아웃"),
MypageListTile(title: "탈퇴하기"),
const MypageListTile(title: "결제 수단 관리"),
const MypageListTile(title: "로그아웃"),
const MypageListTile(title: "탈퇴하기"),
]),
);
}
}

Widget PrivacyInfo(
Widget privacyInfo(
{required String title,
required String value,
String? icon,
Expand Down
Loading

0 comments on commit dbe3342

Please sign in to comment.