2025-01-07 13:38:36 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; // SharedPreferences 임포트
|
|
|
|
import '../views/login/login_page.dart'; // 로그인 페이지 임포트 (상위 디렉토리로 이동)
|
2025-01-25 08:19:02 +00:00
|
|
|
import '../views/user/my_page.dart'; // 마이페이지 임포트 (상위 디렉토리로 이동)
|
2025-01-20 05:45:55 +00:00
|
|
|
import '../views/inquiry/inquiry_to_manager_page.dart'; // 문의하기 페이지 임포트 (상위 디렉토리로 이동)
|
2025-01-07 13:38:36 +00:00
|
|
|
|
|
|
|
void showSettingsDialog(BuildContext context) {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AlertDialog(
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
title: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Container(
|
2025-01-27 15:19:21 +00:00
|
|
|
width: MediaQuery.of(context).size.width * 0.1,
|
2025-01-07 13:38:36 +00:00
|
|
|
child: const Text(
|
|
|
|
'',
|
2025-01-25 08:19:02 +00:00
|
|
|
// 공백 (디자인용)
|
2025-01-07 13:38:36 +00:00
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
2025-01-27 15:19:21 +00:00
|
|
|
width: MediaQuery.of(context).size.width * 0.3,
|
2025-01-07 13:38:36 +00:00
|
|
|
child: const Text(
|
2025-01-25 08:19:02 +00:00
|
|
|
'Settings',
|
|
|
|
// '설정'
|
2025-01-07 13:38:36 +00:00
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
IconButton(
|
|
|
|
icon: const Icon(Icons.close, color: Colors.black),
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
content: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
child: TextButton(
|
|
|
|
onPressed: () {
|
2025-01-25 08:19:02 +00:00
|
|
|
// Navigate to My Page
|
|
|
|
// '내 정보 관리' 페이지로 이동
|
2025-01-07 13:38:36 +00:00
|
|
|
Navigator.of(context).push(
|
2025-01-25 08:19:02 +00:00
|
|
|
MaterialPageRoute(builder: (context) => const MyPage()),
|
2025-01-07 13:38:36 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
style: ButtonStyle(
|
|
|
|
side: MaterialStateProperty.all(const BorderSide(color: Colors.black)),
|
|
|
|
foregroundColor: MaterialStateProperty.all(Colors.black),
|
|
|
|
),
|
2025-01-25 08:19:02 +00:00
|
|
|
child: const Text(
|
|
|
|
'Manage My Info',
|
|
|
|
// '내 정보 관리'
|
|
|
|
),
|
2025-01-07 13:38:36 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
SizedBox(
|
|
|
|
width: double.infinity,
|
2025-01-20 05:45:55 +00:00
|
|
|
child: TextButton(
|
|
|
|
onPressed: () {
|
2025-01-25 08:19:02 +00:00
|
|
|
// Navigate to Inquiry Page
|
|
|
|
// '문의하기' 페이지로 이동
|
2025-01-20 05:45:55 +00:00
|
|
|
Navigator.of(context).push(
|
2025-01-25 08:19:02 +00:00
|
|
|
MaterialPageRoute(builder: (context) => const InquiryToManagerPage()),
|
2025-01-20 05:45:55 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
style: ButtonStyle(
|
|
|
|
side: MaterialStateProperty.all(const BorderSide(color: Colors.black)),
|
|
|
|
foregroundColor: MaterialStateProperty.all(Colors.black),
|
|
|
|
),
|
2025-01-25 08:19:02 +00:00
|
|
|
child: const Text(
|
|
|
|
'Contact Us',
|
|
|
|
// '문의하기'
|
|
|
|
),
|
2025-01-20 05:45:55 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
SizedBox(
|
|
|
|
width: double.infinity,
|
2025-01-07 13:38:36 +00:00
|
|
|
child: TextButton(
|
|
|
|
onPressed: () async {
|
2025-01-25 08:19:02 +00:00
|
|
|
// Logout
|
|
|
|
// '로그아웃' 클릭 시 동작
|
2025-01-07 13:38:36 +00:00
|
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
2025-01-25 08:19:02 +00:00
|
|
|
await prefs.setString('auth_token', '');
|
|
|
|
// auth_token 초기화
|
|
|
|
await prefs.setBool('auto_login', false);
|
|
|
|
// auto_login 초기화
|
|
|
|
|
2025-01-13 06:04:33 +00:00
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
context,
|
2025-01-25 08:19:02 +00:00
|
|
|
MaterialPageRoute(builder: (context) => const LoginPage()),
|
|
|
|
// 로그인 페이지로 이동
|
2025-01-13 06:04:33 +00:00
|
|
|
(route) => false,
|
2025-01-07 13:38:36 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
style: ButtonStyle(
|
|
|
|
side: MaterialStateProperty.all(const BorderSide(color: Colors.black)),
|
|
|
|
foregroundColor: MaterialStateProperty.all(Colors.black),
|
|
|
|
),
|
2025-01-25 08:19:02 +00:00
|
|
|
child: const Text(
|
|
|
|
'Logout',
|
|
|
|
// '로그아웃'
|
|
|
|
),
|
2025-01-07 13:38:36 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
2025-01-25 08:19:02 +00:00
|
|
|
}
|