Skip to content

Commit

Permalink
Merge pull request #9 from HUSTLE-APP/Feat/#3
Browse files Browse the repository at this point in the history
Feat/#3 : 대회페이지 구현
  • Loading branch information
WonJuneKim authored Nov 30, 2023
2 parents 4cd1fc1 + ee10a18 commit bf3af18
Show file tree
Hide file tree
Showing 25 changed files with 2,192 additions and 4 deletions.
3 changes: 3 additions & 0 deletions asset/image/icon/basketball.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions asset/image/icon/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import 'package:match/modules/home/view/home_view.dart';
import 'package:match/modules/splash/binding/splash_binding.dart';
import 'package:match/provider/routes/routes.dart';


import 'modules/create/binding/create_binding.dart';
import 'modules/event/binding/event_binding.dart';
import 'modules/match/binding/match_binding.dart';

import 'modules/friendlyMatch/main_match.dart';

import 'provider/routes/pages.dart';
import 'util/const/style/global_color.dart';

Expand Down Expand Up @@ -49,8 +55,8 @@ class MyApp extends StatelessWidget {
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate
],
initialRoute: "/splash",
initialBinding: SplashBinding(),
initialRoute: "/match",
initialBinding: MatchBinding(),
smartManagement: SmartManagement.full,
navigatorKey: Get.key,
);
Expand Down
27 changes: 27 additions & 0 deletions lib/model/event/event.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class Event {
final String eventId;
final String thumbnail;
final String title;
final String smallTitle;
final String startDate;
final String endDate;

Event({
required this.eventId,
required this.thumbnail,
required this.title,
required this.smallTitle,
required this.startDate,
required this.endDate,
});
}

// 하드코딩된 이벤트 데이터
final Event hardcodedEvent = Event(
eventId: '1',
thumbnail: 'https://example.com/image.jpg', // 적절한 이미지 URL 사용
title: '가톨릭대학교 총장배',
smallTitle: '가톨릭대학교 체육관',
startDate: '2023-01-01',
endDate: '2023-01-31',
);
9 changes: 9 additions & 0 deletions lib/modules/create/binding/create_binding.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:get/get.dart';
import '../controller/create_controller.dart';

class CreateBinding implements Bindings {
@override
void dependencies() {
Get.put(CreateController());
}
}
34 changes: 34 additions & 0 deletions lib/modules/create/controller/create_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:get/get.dart';

class CreateController extends GetxController {
RxString tournamentName = ''.obs;
RxString tournamentDate = ''.obs;
RxString tournamentLocation = ''.obs;
RxString tournamentTeam = ''.obs;
RxString tournamentHead = ''.obs;

void setTournamentName(String name) {
tournamentName.value = name;
}

void setTournamentDate(String date) {
tournamentDate.value = date;
}
void setTournamentLocation(String location) {
tournamentLocation.value = location;
}
void setTournamentTeam(String team) {
tournamentTeam.value = team;
}
void setTournamentHead(String head) {
tournamentHead.value = head;
}

@override
void onInit() {
super.onInit();
}

// 필요한 다른 메서드들...
}

182 changes: 182 additions & 0 deletions lib/modules/create/view/create_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../util/components/global_app_bar.dart';
import '../../../util/components/global_modal.dart';
import '../../../util/const/style/global_color.dart';
import '../../../util/const/style/global_text_styles.dart';
import '../../event/view/event_view.dart';
import '../../match/view/match_view.dart';
import '../controller/create_controller.dart';

class CreateTournamentScreen extends StatelessWidget {
final CreateController controller = Get.put(CreateController());

CreateTournamentScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
// 아이콘 디렉토리
final String iconDir = "assets/icons/";

// 텍스트 컨트롤러들
return Scaffold(
appBar: CommonAppBar.basic("대회 생성"),
body: SingleChildScrollView( // SingleChildScrollView 추가
child: Padding(
padding: EdgeInsets.all(16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // 왼쪽으로 정렬
children: <Widget>[
SizedBox(height: 10.h),
Text(
"대회명",
style: AppTextStyles.L1Medium13,
),
SizedBox(height: 10.h),
CupertinoTextField(
// 대회명 입력 필드
controller: TextEditingController(text: controller.tournamentName.value),
placeholder: '대회명을 입력해주세요',
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 12.w),
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: AppColors.grey1),
),
cursorColor: AppColors.black,
style: AppTextStyles.T1Bold13.copyWith(color: AppColors.grey8),
),
SizedBox(height: 26.h),
Text(
"대회 기간",
style: AppTextStyles.L1Medium13,
),
SizedBox(height: 10.h),
CupertinoTextField(
// 대회 기간 입력 필드
controller: TextEditingController(text: controller.tournamentDate.value),
placeholder: '대회 기간을 입력해주세요',
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 12.w),
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: AppColors.grey1),
),
cursorColor: AppColors.black,
style: AppTextStyles.T1Bold13.copyWith(color: AppColors.grey8),
),
SizedBox(height: 26.h),
Text(
"대회 장소",
style: AppTextStyles.L1Medium13,
),
SizedBox(height: 10.h),
CupertinoTextField(
// 대회 기간 입력 필드
controller: TextEditingController(text: controller.tournamentLocation.value),
placeholder: '대회 장소를 입력해주세요',
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 12.w),
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: AppColors.grey1),
),
cursorColor: AppColors.black,
style: AppTextStyles.T1Bold13.copyWith(color: AppColors.grey8),
),
SizedBox(height: 26.h),
Text(
"동아리 명",
style: AppTextStyles.L1Medium13,
),
SizedBox(height: 10.h),
CupertinoTextField(
// 대회 기간 입력 필드
controller: TextEditingController(text: controller.tournamentTeam.value),
placeholder: '동아리 명을 입력해주세요',
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 12.w),
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: AppColors.grey1),
),
cursorColor: AppColors.black,
style: AppTextStyles.T1Bold13.copyWith(color: AppColors.grey8),
),
SizedBox(height: 26.h),
Text(
"대표자 명",
style: AppTextStyles.L1Medium13,
),
SizedBox(height: 10.h),
CupertinoTextField(
// 대회 기간 입력 필드
controller: TextEditingController(text: controller.tournamentHead.value),
placeholder: '대표자 명을 입력해주세요',
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 12.w),
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: AppColors.grey1),
),
cursorColor: AppColors.black,
style: AppTextStyles.T1Bold13.copyWith(color: AppColors.grey8),
),
SizedBox(height: 16.h),
// 기타 위젯들...
Padding(
padding: EdgeInsets.symmetric(vertical: 24.h),
child: Row(
children: [
Expanded( // 버튼의 가로 크기를 확장합니다.
child: ElevatedButton(
onPressed: () {
// CommonDialog 모달 표시
showDialog(
context: context,
builder: (BuildContext context) {
return CommonDialog(
title: "대회 신청 확인",
subtitle: "대회에 신청하시겠습니까?",
onGrant: () async {
// 확인 버튼을 눌렀을 때의 작업
Get.to(() => const MatchScreen());
},
grantText: "확인",
);
},
);
},
style: ElevatedButton.styleFrom(
primary: Colors.blue,
padding: EdgeInsets.symmetric(vertical: 12.h),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
),
child: Text(
"신청하기",
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
),
),
),
),
],
),
),
// 기타 위젯들...
],
),
),
),
);
}
}

// AppColors, AppTextStyles 등 필요한 스타일을 정의합니다.
25 changes: 25 additions & 0 deletions lib/modules/event/controller/event_controller.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
import 'package:get/get.dart';

// import '../../../model/event/event.dart';
// import '../../../provider/api/event_api.dart';
// 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(int index) async {
// if (!EventApi.event.isLast) {
// eventList.addAll(await EventApi.getEventList(getMore: true));
// }
// }
//
// @override
// void onInit() async {
// super.onInit();
// eventList.assignAll(await EventApi.getEventList());
// }
// }


class EventController extends GetxController {
Rx<int> selectIdx = 0.obs;
@override
void onInit() {
super.onInit();
Expand Down
60 changes: 59 additions & 1 deletion lib/modules/event/view/event_view.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,73 @@
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:match/modules/event/widget/event_widget.dart';
// import 'package:match/provider/api/util/pagination_function.dart';
import 'package:match/util/const/style/global_text_styles.dart';

// import '../../../provider/api/util/global_api_field.dart';
import '../../../util/components/global_app_bar.dart';
import '../../../util/components/global_widget.dart';
// 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: Text('event'),
appBar: CommonAppBar.basic("진행중인 경기"),
body: SafeArea(
child: Column(
children: [
///*1.제목 header
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 8.h)
// .copyWith(bottom: 17.h),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// "진행중인 경기",
// style: AppTextStyles.T1Bold16,
// textAlign: TextAlign.center,
// ),
// // alarmButton()
// ],
// ),
// ),

///*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: CarouselSlider.builder(
itemCount: 5, // 예시로 5개의 위젯을 표시합니다.
itemBuilder: (context, index, realIndex) {
// EventWidget 호출을 하드코딩된 데이터로 수정합니다.
return EventWidget(); // 여기서 event 매개변수를 제거했습니다.
},
options: CarouselOptions(
autoPlay: false,
aspectRatio: 299.w / 445.h,
viewportFraction: 1,
scrollDirection: Axis.vertical,
),
),
),
),
],
),
),
);
}
}
Loading

0 comments on commit bf3af18

Please sign in to comment.