Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: 디자인 수정 및 프로필 설정 api 연동 (미완) #53

Merged
merged 15 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions economic_fe/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
14 changes: 13 additions & 1 deletion economic_fe/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ plugins {
id "dev.flutter.flutter-gradle-plugin"
}

def dotenvFile = rootProject.file('.env')
def dotenvProps = new Properties()

if (dotenvFile.exists()) {
dotenvFile.withReader { reader ->
dotenvProps.load(reader)
}
}

android {
namespace = "com.example.economic_fe"
compileSdk = flutter.compileSdkVersion
Expand All @@ -39,7 +48,10 @@ android {
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
manifestPlaceholders += [KAKAO_NATIVE_APP_KEY: project.env.get("NATIVE_APP_KEY")]
// manifestPlaceholders += [KAKAO_NATIVE_APP_KEY: project.env.get("NATIVE_APP_KEY")]
manifestPlaceholders += [
KAKAO_NATIVE_APP_KEY: dotenvProps['NATIVE_APP_KEY'] ?: "default_key"
]
}

buildTypes {
Expand Down
9 changes: 0 additions & 9 deletions economic_fe/lib/data/models/user_model.dart

This file was deleted.

34 changes: 34 additions & 0 deletions economic_fe/lib/data/models/user_profile.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
class UserProfile {
String nickname;
String businessType;
String job;
String ageRange;
String gender;
String? profileIntro;
bool isLearningAlarmAllowed;
bool isCommunityAlarmAllowed;

UserProfile({
required this.nickname,
required this.businessType,
required this.job,
required this.ageRange,
required this.gender,
this.profileIntro,
this.isLearningAlarmAllowed = false,
this.isCommunityAlarmAllowed = false,
});

Map<String, dynamic> toJson() {
return {
'nickname': nickname,
'businessType': businessType,
'job': job,
'ageRange': ageRange,
'gender': gender,
'profileIntro': profileIntro,
'isLearningAlarmAllowed': isLearningAlarmAllowed,
'isCommunityAlarmAllowed': isCommunityAlarmAllowed,
};
}
}
28 changes: 19 additions & 9 deletions economic_fe/lib/data/services/remote_data_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,36 @@ class RemoteDataSource {
/// API POST
///
/// 데이터 생성시 사용
static Future<dynamic> _postApi(String endPoint, String? jsonData) async {
/// authToken을 포함하도록 수정
static Future<dynamic> postApi(
String endPoint,
Map<String, dynamic> jsonData,
) async {
String apiUrl = '$baseUrl/$endPoint';
Map<String, String> headers = {'Content-Type': 'application/json'};
// String requestBody = jsonData;
debugPrint('POST 요청: $endPoint');
String authToken = dotenv.env['AUTHORIZATION_KEY']!; // 환경 변수에서 가져오기
Map<String, String> headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer $authToken',
};

try {
final response =
await http.post(Uri.parse(apiUrl), headers: headers, body: jsonData);
final response = await http.post(
Uri.parse(apiUrl),
headers: headers,
body: jsonEncode(jsonData),
);

if (response.statusCode == 200) {
debugPrint('POST 요청 성공');
return response.statusCode;
} else {
debugPrint('POST 요청 실패: (${response.statusCode})${response.body}');
debugPrint('POST 요청 실패: (${response.statusCode}) ${response.body}');
}

// 예외 처리를 위한 status code 반환
return response.statusCode;
} catch (e) {
debugPrint('POST 요청 중 예외 발생: $e');
return;
return null;
}
}

Expand Down
76 changes: 0 additions & 76 deletions economic_fe/lib/data/services/user_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,82 +35,6 @@ import 'package:economic_fe/view/screens/test_page.dart';
import 'package:get/get.dart';
import 'package:get/get_navigation/src/routes/get_route.dart';

// class UserRouter {
// static GoRouter getRouter() {
// return GoRouter(
// initialLocation: '/', // 초기 경로 설정
// routes: [
// GoRoute(
// path: '/',
// builder: (context, state) => const OnboardingPage(), // 홈 페이지
// ),
// GoRoute(
// path: '/onboarding',
// builder: (context, state) => const OnboardingCardPage(),
// ),
// GoRoute(
// path: '/test',
// builder: (context, state) => const TestPage(),
// routes: [
// GoRoute(
// path: 'multi',
// builder: (context, state) => const TestMultipleChoicePage(),
// ),
// GoRoute(
// path: 'ox',
// builder: (context, state) => const TestOxPage(),
// ),
// ],
// ),
// GoRoute(
// path: '/leveltest_result',
// builder: (context, state) => const LeveltestResultPage(),
// ),
// GoRoute(
// path: '/login',
// builder: (context, state) => const LoginPage(),
// ),
// GoRoute(
// path: '/profile_setting',
// builder: (context, state) => const ProfileSettingPage(),
// routes: [
// GoRoute(
// path: 'basic',
// builder: (context, state) => const BasicInfoPage(),
// ),
// GoRoute(
// path: 'job',
// builder: (context, state) => const JobSelectPage(),
// ),
// GoRoute(
// path: 'part',
// builder: (context, state) => const PartSelectPage(),
// ),
// ],
// ),
// GoRoute(
// path: '/home',
// builder: (context, state) => const HomePage(),
// ),
// GoRoute(
// path: '/learning_list',
// builder: (context, state) => const LearningListPage(),
// routes: [
// GoRoute(
// path: 'quiz_level',
// builder: (context, state) => const LevelSelectPage(),
// routes: [
// GoRoute(
// path: 'quiz',
// builder: (context, state) => const QuizPage(),
// )
// ])
// ]),
// ],
// );
// }
// }

// GetX의 라우터를 사용하는 방식
class UserRouter {
static List<GetPage> getPages() {
Expand Down
35 changes: 0 additions & 35 deletions economic_fe/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import 'package:economic_fe/data/services/user_router.dart';
import 'package:economic_fe/view/screens/onboarding/onboarding_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart';
import 'package:kakao_flutter_sdk_user/kakao_flutter_sdk_user.dart';

Future<void> main() async {
Expand All @@ -17,38 +14,6 @@ Future<void> main() async {
runApp(const RippleApp());
}

// class MyApp extends StatelessWidget {
// const MyApp({super.key});

// // This widget is the root of your application.
// @override
// Widget build(BuildContext context) {
// // return GetMaterialApp(
// // title: '경제 지식 앱',
// // theme: ThemeData(
// // primarySwatch: Colors.blue,
// // ),
// // home: const Text("test11"),
// // );
// // return OnboardingPage();
// // return const MaterialApp(
// // home: OnboardingPage(),
// // );
// runApp(const RippleApp());
// }
// }

// class RippleApp extends StatelessWidget {
// const RippleApp({super.key});

// @override
// Widget build(BuildContext context) {
// return MaterialApp.router(
// routerConfig: UserRouter.getRouter(),
// );
// }
// }

class RippleApp extends StatelessWidget {
const RippleApp({super.key});

Expand Down
43 changes: 23 additions & 20 deletions economic_fe/lib/view/screens/community/community_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CommunityPage extends StatelessWidget {
child: GestureDetector(
onTap: () => controller.toTalkDetailPage(),
child: Container(
width: 328,
width: MediaQuery.of(context).size.width - 32,
height: 122,
decoration: ShapeDecoration(
image: DecorationImage(
Expand Down Expand Up @@ -587,21 +587,24 @@ class TalkListItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// 경제톡톡 이미지
GestureDetector(
onTap: onTap,
child: Container(
width: 97,
height: 118,
decoration: ShapeDecoration(
image: const DecorationImage(
image: AssetImage('assets/talk_image_sample.png'),
fit: BoxFit.cover,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(7),
Padding(
padding: const EdgeInsets.only(right: 12),
child: GestureDetector(
onTap: onTap,
child: Container(
width: 97,
height: 118,
decoration: ShapeDecoration(
image: const DecorationImage(
image: AssetImage('assets/talk_image_sample.png'),
fit: BoxFit.cover,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(7),
),
),
),
),
Expand All @@ -610,9 +613,9 @@ class TalkListItem extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
width: 219,
child: Row(
SizedBox(
width: MediaQuery.of(context).size.width - (32 + 97 + 12),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
Expand Down Expand Up @@ -644,10 +647,10 @@ class TalkListItem extends StatelessWidget {
),
GestureDetector(
onTap: onTap,
child: const SizedBox(
width: 219,
child: SizedBox(
width: MediaQuery.of(context).size.width - (32 + 97 + 12),
height: 60,
child: Flexible(
child: const Flexible(
child: Text(
'현재 경제 상황에서 가장 중요한 투자 전략은 무엇이라고 생각하나요? 현재 경제 상황에서 가장 중요한 투자 전략...',
style: TextStyle(
Expand Down
12 changes: 0 additions & 12 deletions economic_fe/lib/view/screens/community/talk_detail_page.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:economic_fe/data/models/community/comment.dart';
import 'package:economic_fe/view/theme/palette.dart';
import 'package:economic_fe/view/widgets/chatbot_fab.dart';
import 'package:economic_fe/view/widgets/community/comment_widget.dart';
import 'package:economic_fe/view/widgets/custom_app_bar.dart';
import 'package:economic_fe/view_model/community/talk_detail_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
Expand Down Expand Up @@ -40,16 +38,6 @@ class TalkDetailPage extends StatelessWidget {
),
),
centerTitle: true,
actions: [
// 더보기 버튼
Padding(
padding: const EdgeInsets.only(right: 16),
child: GestureDetector(
onTap: () {},
child: const Icon(Icons.more_horiz),
),
),
],
),
body: Stack(
children: [
Expand Down
Loading