Skip to content
Open
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
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:label="routine_ade"
android:label="루틴에이드"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/routineade"
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true">
<activity
Expand Down
Binary file removed android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/new-icons/ice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/new-icons/onBoarding1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/new-icons/onBoarding2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/new-icons/onBoarding3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/new-icons/onBoarding4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 75 additions & 14 deletions lib/RoutineAdeIntro/ProfileSetting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:kakao_flutter_sdk_user/kakao_flutter_sdk_user.dart';
import 'package:http/http.dart' as http;
import '../routine_home/MyRoutinePage.dart';
import 'package:routine_ade/routine_user/token.dart'; // 토큰 가져오는 곳
import 'package:routine_ade/routine_user/token.dart';

class ProfileSetting extends StatefulWidget {
const ProfileSetting({super.key});
Expand All @@ -17,6 +17,59 @@ class ProfileSetting extends StatefulWidget {
class _ProfileSettingState extends State<ProfileSetting> {
File? _imageFile;
final ImagePicker _picker = ImagePicker();
String? _kakaoProfileImageUrl;
String? _apiProfileImageUrl;

@override
void initState() {
super.initState();
_loadProfileImage(); // 프로필 이미지 로드
}

Future<void> _loadProfileImage() async {
await _loadKakaoProfile();
await _getApiProfileImage(); // API로 프로필 이미지 불러오기
}

Future<void> _getApiProfileImage() async {
const url = 'http://15.164.88.94/users/isFirst';

try {
// API 호출을 위한 GET 요청
final response = await http.get(
Uri.parse(url),
headers: {'Authorization': 'Bearer $token'}, // 토큰 추가
);

if (response.statusCode == 200) {
// 서버로부터 응답을 받은 경우
final data = json.decode(response.body);
setState(() {
_apiProfileImageUrl = data['profileImage']; // API에서 프로필 이미지 URL 받아오기
});
} else {
print('Failed to get profile image: ${response.statusCode}');
}
} catch (e) {
print('Error during profile image fetch: $e');
}
}

// 카카오 프로필 이미지 불러오기
Future<void> _loadKakaoProfile() async {
try {
User user = await UserApi.instance.me(); // 카카오 사용자 정보 불러오기
setState(() {
_kakaoProfileImageUrl =
user.kakaoAccount?.profile?.profileImageUrl; // 프로필 이미지 URL 저장
});
} catch (error) {
print('Failed to load Kakao profile: $error');
setState(() {
_kakaoProfileImageUrl = null;
});
}
}

Future<void> _pickImage() async {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
Expand Down Expand Up @@ -62,13 +115,13 @@ class _ProfileSettingState extends State<ProfileSetting> {
}

Future<void> _registerUserInfo() async {
const url = 'http://15.164.88.94/users/infos'; // API URL
const url = 'http://15.164.88.94/users/infos';

// POST 요청 준비
final request = http.MultipartRequest('POST', Uri.parse(url));

// 토큰 확인 및 추가
if (token == null || token.isEmpty) {
if (token.isEmpty) {
print('Token is missing.');
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('토큰이 없습니다. 다시 로그인해주세요.')),
Expand All @@ -85,7 +138,8 @@ class _ProfileSettingState extends State<ProfileSetting> {

// 선택한 이미지가 있으면 파일로 추가
if (_imageFile != null) {
request.files.add(await http.MultipartFile.fromPath('image', _imageFile!.path));
request.files
.add(await http.MultipartFile.fromPath('image', _imageFile!.path));
}

try {
Expand All @@ -108,11 +162,12 @@ class _ProfileSettingState extends State<ProfileSetting> {
} else {
// 실패 시 서버에서 보낸 오류 메시지 출력
final errorBody = utf8.decode(responseData.bodyBytes);
print('Failed to register user info. Status code: ${response.statusCode}');
print(
'Failed to register user info. Status code: ${response.statusCode}');
print('Response body: $errorBody');

ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('정보 등록 실패: 이미 사용 중인 닉네임입니다.')),
const SnackBar(content: Text('정보 등록 실패: 이미 사용 중인 닉네임입니다.')),
);
}
} catch (e) {
Expand All @@ -123,7 +178,6 @@ class _ProfileSettingState extends State<ProfileSetting> {
}
}


@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -159,8 +213,15 @@ class _ProfileSettingState extends State<ProfileSetting> {
radius: 50,
backgroundImage: _imageFile != null
? FileImage(_imageFile!)
: const AssetImage('assets/images/defaultProfile.png')
as ImageProvider,
: (_kakaoProfileImageUrl != null &&
_kakaoProfileImageUrl!.isNotEmpty
? NetworkImage(_kakaoProfileImageUrl!)
: (_apiProfileImageUrl != null &&
_apiProfileImageUrl!.isNotEmpty
? NetworkImage(_apiProfileImageUrl!)
: const AssetImage(
'assets/images/defaultProfile.png')))
as ImageProvider,
),
Positioned(
bottom: 0,
Expand Down Expand Up @@ -192,13 +253,13 @@ class _ProfileSettingState extends State<ProfileSetting> {
counterText: '', // 글자수 카운터 삭제
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
borderSide: const BorderSide(
color: Colors.black, // 기본 테두리 검은색
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
borderSide: const BorderSide(
color: Colors.black, // 포커스 시 테두리 검은색
width: 2.0,
),
Expand Down Expand Up @@ -234,13 +295,13 @@ class _ProfileSettingState extends State<ProfileSetting> {
counterText: '', // 글자수 카운터 삭제
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
borderSide: const BorderSide(
color: Colors.black, // 기본 테두리 검은색
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
borderSide: const BorderSide(
color: Colors.black, // 포커스 시 테두리 검은색
width: 2.0,
),
Expand Down
83 changes: 38 additions & 45 deletions lib/RoutineAdeIntro/RoutineAde1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class RoutineAde1 extends StatefulWidget {

class _RoutineAde1State extends State<RoutineAde1> {
final List<String> imgList = [
"assets/images/tap-bar/routine02.png",
"assets/images/tap-bar/group02.png",
"assets/images/tap-bar/statistics02.png",
"assets/images/tap-bar/more02.png",
"assets/images/new-icons/onBoarding1.png",
"assets/images/new-icons/onBoarding2.png",
"assets/images/new-icons/onBoarding3.png",
"assets/images/new-icons/onBoarding4.png",
];

int _currentIndex = 0; // 현재 선택된 이미지 인덱스
Expand All @@ -45,30 +45,7 @@ class _RoutineAde1State extends State<RoutineAde1> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Spacer(),
// Image.asset(
// 'assets/images/new-icons/RoutineAde.png',
// width: 100,
// height: 100,
// ),
// const SizedBox(height: 20),
// const Text(
// '더 나은 하루, 루틴 에이드',
// style: TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.bold,
// color: Colors.black,
// ),
// ),
// const SizedBox(height: 8),
// Text(
// '루틴으로 더 나은 일상을\n함께 관리해보세요!',
// textAlign: TextAlign.center,
// style: TextStyle(
// fontSize: 14,
// color: Colors.grey[700],
// ),
// ),
const SizedBox(height: 50),
const SizedBox(height: 100),

// Carousel Slider 부분
CarouselSlider(
Expand All @@ -81,19 +58,24 @@ class _RoutineAde1State extends State<RoutineAde1> {
_currentIndex = index; // 슬라이드가 바뀔 때 현재 인덱스 업데이트
});
},
enableInfiniteScroll: false, // 무한 스크롤 비활성화
),
items: imgList.map((item) => Container(
child: Center(
child: Image.asset(
item,
fit: BoxFit.contain,
width: 1000,
),
),
)).toList(),
items: imgList
.map((item) => Container(
child: Center(
child: Image.asset(
item,
fit: BoxFit.contain,
width: 1000,
),
),
))
.toList(),
),

SizedBox(height: 50,),
const SizedBox(
height: 50,
),

// 인디케이터 부분
Row(
Expand All @@ -106,24 +88,32 @@ class _RoutineAde1State extends State<RoutineAde1> {
child: Container(
width: 12.0,
height: 12.0,
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 4.0),
margin: const EdgeInsets.symmetric(
vertical: 10.0, horizontal: 4.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _currentIndex == entry.key
? Colors.blueAccent // 현재 인덱스일 경우 채워진 동그라미
: Colors.grey, // 그렇지 않은 경우 빈 동그라미
? Colors.grey // 현재 인덱스일 경우 채워진 동그라미
: Colors.grey[300], // 그렇지 않은 경우 빈 동그라미
),
),
);
}).toList(),
),

const Spacer(),
const SizedBox(height: 10),
const Text(
"sns로 간편 가입하기 !",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: SizedBox(
width: double.infinity,
height: 150,
height: 100,
child: GestureDetector(
onTap: () {
// WebView 페이지로 이동
Expand All @@ -135,13 +125,16 @@ class _RoutineAde1State extends State<RoutineAde1> {
},
child: Image.asset(
"assets/images/new-icons/kakaoTalk.png",
width: 200,
width: 250,
height: 200,
fit: BoxFit.contain,
),
),
),
),
const SizedBox(
height: 10,
),
],
),
),
Expand Down
Loading