Skip to content

Commit

Permalink
add setting screen
Browse files Browse the repository at this point in the history
  • Loading branch information
jwson-automation committed Aug 27, 2024
1 parent b763054 commit e362817
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 100 deletions.
58 changes: 29 additions & 29 deletions lib/core/TopScreen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:blueberry_flutter_template/feature/map/PoliceMapScreen.dart';
import 'package:blueberry_flutter_template/feature/mypage/MyPageScreen.dart';
import 'package:blueberry_flutter_template/feature/send/SendMessageScreen.dart';
import 'package:blueberry_flutter_template/feature/setting/SettingScreen.dart';
import 'package:blueberry_flutter_template/feature/voiceOutput/VoiceOutputScreen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
Expand All @@ -26,7 +25,7 @@ class TopScreen extends ConsumerWidget {
final List<Widget> pages = [
const VoiceOutputScreen(),
const SendMessageScreen(),
const MyPageScreen(),
const SettingScreen(),
];

return Scaffold(
Expand Down Expand Up @@ -67,36 +66,37 @@ class CustomBottomNavigationBar extends StatelessWidget {
return Material(
color: Colors.transparent,
child: InkWell(
onTap: () => onPageChanged(index),
customBorder: const CircleBorder(),
child: Container(
width: 100,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 30,
height: 30,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: index == currentIndex ? Colors.blue : Colors.grey,
),
),
const SizedBox(height: 3,),
if (index == currentIndex)
onTap: () => onPageChanged(index),
customBorder: const CircleBorder(),
child: Container(
width: 100,
height: 100,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 20,
height: 6,
width: 30,
height: 30,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10)
shape: BoxShape.circle,
color:
index == currentIndex ? Colors.blue : Colors.grey,
),
),
],
),
)
),
const SizedBox(
height: 3,
),
if (index == currentIndex)
Container(
width: 20,
height: 6,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10)),
),
],
),
)),
);
}),
),
Expand Down
67 changes: 0 additions & 67 deletions lib/feature/mypage/MyPageScreen.dart

This file was deleted.

77 changes: 77 additions & 0 deletions lib/feature/setting/SettingScreen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import 'package:blueberry_flutter_template/utils/DialogHelpers.dart';
import 'package:flutter/material.dart';

class SettingScreen extends StatelessWidget {
static const name = 'MyPageScreen';

const SettingScreen({super.key});

@override
Widget build(BuildContext context) {
// _settings 리스트 초기화
final List<Map<String, dynamic>> settingData = [
{
'title': '주변 경찰서 위치 확인하기',
'icon': Icons.location_on,
'onTap': () {
// 프로필 수정 화면으로 이동하는 코드
showErrorDialog(context, '아직 준비중인 기능입니다.');
},
},
{
'title': '경찰 순찰 빈도 및 일정',
'icon': Icons.person,
'onTap': () {
// 알림 설정 화면으로 이동하는 코드
showErrorDialog(context, '아직 준비중인 기능입니다.');
},
},
{
'title': '여성 안심 귀가 서비스',
'icon': Icons.safety_check,
'onTap': () {
// 계정 관리 화면으로 이동하는 코드
showErrorDialog(context, '아직 준비중인 기능입니다.');
},
},
// 더 많은 설정 항목 추가 가능
];

return Scaffold(
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: ListView.builder(
shrinkWrap: true,
itemCount: settingData.length,
itemBuilder: (context, index) {
return ListTile(
title: SettingListTile(context, settingData[index]['title'],
settingData[index]['onTap'], settingData[index]['icon']),
);
}),
),
));
}
}

Widget SettingListTile(
BuildContext, String title, Function onTap, IconData icon) {
return Padding(
padding: const EdgeInsets.fromLTRB(0, 20.0, 0, 0),
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(10.0),
),
child: ListTile(
leading: Icon(icon, color: Colors.black, size: 40.0),
title: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(title, style: const TextStyle(fontSize: 20.0)),
),
onTap: () => onTap(),
),
),
);
}
2 changes: 1 addition & 1 deletion lib/services/FirestoreService.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FirestoreService {
.doc(userId)
.set({'imageUrl': imageUrl});
} catch (e) {
throw Exception('Failed to create mypage image: $e');
throw Exception('Failed to create setting image: $e');
}
}
}
4 changes: 3 additions & 1 deletion lib/utils/AppStrings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ class AppStrings {
static const String nickNameTextWidgetdefaultNickName = '닉네임';
static const String nickNameTextWidgetError = '오류';

//MyPageScreen.dart
//SettingScreen.dart
static const String myPageTitle = '내 페이지';
static const String loginButtonText = '로그인';
static const String logoutButtonText = '로그아웃';
static const String welcomeBackText = '다시 오신 것을 환영합니다!';
static const String signUpButtonText = '회원가입';
static const String errorTitle = '오류';
static const String showSuccessDialogTitle = '성공';
static const String showErrorDialogTitle = '오류';
static const String okButtonText = '확인';
static const String loggedInMessage = '로그인 되었습니다.';
static const String passwordForgot = '비밀번호를 잊어버렸나요?';
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/DialogHelpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void showSuccessDialog(BuildContext context, String message) {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text(AppStrings.okButtonText),
title: const Text(AppStrings.showSuccessDialogTitle),
content: Text(message),
actions: <Widget>[
TextButton(
Expand All @@ -27,7 +27,7 @@ void showErrorDialog(BuildContext context, String message) {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text(AppStrings.errorTitle),
title: const Text(AppStrings.showErrorDialogTitle),
content: Text(message),
actions: <Widget>[
TextButton(
Expand Down

0 comments on commit e362817

Please sign in to comment.