Skip to content

Commit 5e3f16c

Browse files
authored
feat: 약 추가, 마음기록 추가 시 팝업 화면 구현 (#70)
약 추가 팝업 -> 구현 완료 마음기록 추가 팝업 -> 경로 및 알림 제외 구현 완료, 추후 구현 예정 (마음 기록 입력 화면 및 백엔드 알림 구현 시 추가 구현해야 합니다.)
1 parent dfb9e94 commit 5e3f16c

File tree

8 files changed

+351
-13
lines changed

8 files changed

+351
-13
lines changed
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:ongi/core/app_colors.dart';
3+
import 'package:flutter_svg/svg.dart';
4+
5+
class AppOrangeBackground extends StatelessWidget {
6+
final Widget child;
7+
const AppOrangeBackground({super.key, required this.child});
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
return Stack(
12+
children: [
13+
Container(color: AppColors.ongiOrange),
14+
Positioned(
15+
left: -45,
16+
bottom: 80,
17+
child: SvgPicture.asset(
18+
'assets/images/logo_white.svg',
19+
width: 380,
20+
fit: BoxFit.contain,
21+
),
22+
),
23+
Positioned.fill(child: child),
24+
],
25+
);
26+
}
27+
}

frontend/ongi/lib/screens/health/add_pill_screen.dart

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:flutter_svg/svg.dart';
33
import 'package:ongi/core/app_colors.dart';
44
import 'package:ongi/widgets/custom_drop_down.dart';
5+
import 'package:ongi/screens/health/pill_update_popup.dart';
56

67
class AddPillScreen extends StatefulWidget {
78
const AddPillScreen({super.key});
@@ -14,12 +15,7 @@ class _AddPillScreenState extends State<AddPillScreen> {
1415
Set<String> selectedDays = <String>{};
1516
final List<String> days = ['일', '월', '화', '수', '목', '금', '토'];
1617
String selectedFrequency = '하루 세 번';
17-
final List<String> frequencies = [
18-
'하루 한 번',
19-
'하루 두 번',
20-
'하루 세 번',
21-
'하루 네 번',
22-
];
18+
final List<String> frequencies = ['하루 한 번', '하루 두 번', '하루 세 번', '하루 네 번'];
2319
String selectedTime = '08:00';
2420
final List<String> times = [
2521
'00:00',
@@ -96,7 +92,11 @@ class _AddPillScreenState extends State<AddPillScreen> {
9692
children: [
9793
const SizedBox(height: 150),
9894
Padding(
99-
padding: const EdgeInsets.only(left: 40, right: 40, top: 10),
95+
padding: const EdgeInsets.only(
96+
left: 40,
97+
right: 40,
98+
top: 10,
99+
),
100100
child: TextField(
101101
//controller: _passwordCtrl,
102102
keyboardType: TextInputType.visiblePassword,
@@ -155,7 +155,9 @@ class _AddPillScreenState extends State<AddPillScreen> {
155155
final isSelected = selectedDays.contains(day);
156156
final isLastItem = index == days.length - 1;
157157
return Padding(
158-
padding: EdgeInsets.only(right: isLastItem ? 40 : 12),
158+
padding: EdgeInsets.only(
159+
right: isLastItem ? 40 : 12,
160+
),
159161
child: GestureDetector(
160162
onTap: () {
161163
setState(() {
@@ -239,9 +241,12 @@ class _AddPillScreenState extends State<AddPillScreen> {
239241
itemCount: selectedTimes.length,
240242
itemBuilder: (context, index) {
241243
final time = selectedTimes[index];
242-
final isLastItem = index == selectedTimes.length - 1;
244+
final isLastItem =
245+
index == selectedTimes.length - 1;
243246
return Padding(
244-
padding: EdgeInsets.only(right: isLastItem ? 40 : 12),
247+
padding: EdgeInsets.only(
248+
right: isLastItem ? 40 : 12,
249+
),
245250
child: Container(
246251
padding: const EdgeInsets.symmetric(
247252
horizontal: 16,
@@ -308,14 +313,25 @@ class _AddPillScreenState extends State<AddPillScreen> {
308313
),
309314
),
310315
Container(
311-
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 40, top: 20),
316+
padding: const EdgeInsets.only(
317+
left: 20,
318+
right: 20,
319+
bottom: 40,
320+
top: 20,
321+
),
312322
child: SizedBox(
313323
width: double.infinity,
314324
height: 72,
315325
child: ElevatedButton(
316326
onPressed: () {
327+
Navigator.pushReplacement(
328+
context,
329+
MaterialPageRoute(
330+
builder: (context) => PillUpdatePopup(),
331+
),
332+
);
317333
print('약 정보 등록');
318-
Navigator.of(context).pop();
334+
// Navigator.of(context).pop();
319335
},
320336
style: ElevatedButton.styleFrom(
321337
backgroundColor: AppColors.ongiOrange,
@@ -341,7 +357,10 @@ class _AddPillScreenState extends State<AddPillScreen> {
341357
top: 80,
342358
right: 30,
343359
child: IconButton(
344-
icon: SvgPicture.asset('assets/images/close_icon_black.svg', width: 28),
360+
icon: SvgPicture.asset(
361+
'assets/images/close_icon_black.svg',
362+
width: 28,
363+
),
345364
onPressed: () {
346365
Navigator.of(context).pop();
347366
},
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:ongi/core/app_orange_background.dart';
3+
import 'package:ongi/core/app_colors.dart';
4+
import 'package:flutter_svg/svg.dart';
5+
6+
class PillUpdatePopup extends StatelessWidget {
7+
const PillUpdatePopup({super.key});
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
return Scaffold(
12+
backgroundColor: Colors.transparent,
13+
body: AppOrangeBackground(
14+
child: Stack(
15+
children: [
16+
Positioned(
17+
top: 80,
18+
right: 30,
19+
child: IconButton(
20+
icon: SvgPicture.asset(
21+
'assets/images/close_icon_white.svg',
22+
width: 28,
23+
),
24+
onPressed: () {
25+
Navigator.of(context).pop();
26+
},
27+
iconSize: 36,
28+
),
29+
),
30+
Padding(
31+
padding: const EdgeInsets.only(left: 30, top: 160, right: 30),
32+
child: Column(
33+
crossAxisAlignment: CrossAxisAlignment.start,
34+
children: [
35+
const Text(
36+
'새로운 약\n복용 일정이',
37+
style: TextStyle(
38+
fontSize: 60,
39+
fontWeight: FontWeight.w200,
40+
height: 1.2,
41+
color: Colors.white,
42+
),
43+
),
44+
const Text(
45+
'추가되었어요!',
46+
style: TextStyle(
47+
fontSize: 60,
48+
fontWeight: FontWeight.w800,
49+
height: 1.2,
50+
color: Colors.white,
51+
),
52+
),
53+
Padding(
54+
padding: const EdgeInsets.only(
55+
left: 10,
56+
top: 180,
57+
right: 10,
58+
),
59+
child: ElevatedButton(
60+
style: ElevatedButton.styleFrom(
61+
padding: const EdgeInsets.symmetric(vertical: 8),
62+
minimumSize: const Size(double.infinity, 35),
63+
backgroundColor: Colors.white,
64+
shape: RoundedRectangleBorder(
65+
borderRadius: BorderRadius.circular(20),
66+
),
67+
),
68+
onPressed: () {
69+
Navigator.of(context).pop();
70+
},
71+
child: const Text(
72+
'확인하기!',
73+
style: TextStyle(
74+
fontSize: 33,
75+
fontWeight: FontWeight.w400,
76+
color: AppColors.ongiOrange,
77+
),
78+
),
79+
),
80+
),
81+
],
82+
),
83+
),
84+
],
85+
),
86+
),
87+
);
88+
}
89+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:ongi/core/app_orange_background.dart';
3+
import 'package:ongi/core/app_colors.dart';
4+
import 'package:flutter_svg/svg.dart';
5+
6+
class PhotoRemindPopup extends StatelessWidget {
7+
const PhotoRemindPopup({super.key});
8+
9+
@override
10+
Widget build(BuildContext context) {
11+
return Scaffold(
12+
backgroundColor: Colors.transparent,
13+
body: AppOrangeBackground(
14+
child: Stack(
15+
children: [
16+
Positioned(
17+
top: 80,
18+
right: 30,
19+
child: IconButton(
20+
icon: SvgPicture.asset(
21+
'assets/images/close_icon_white.svg',
22+
width: 28,
23+
),
24+
onPressed: () {
25+
Navigator.of(context).pop();
26+
},
27+
iconSize: 36,
28+
),
29+
),
30+
Padding(
31+
padding: const EdgeInsets.only(left: 30, top: 160, right: 30),
32+
child: Column(
33+
crossAxisAlignment: CrossAxisAlignment.start,
34+
children: [
35+
const Text(
36+
'가족들이',
37+
style: TextStyle(
38+
fontSize: 60,
39+
fontWeight: FontWeight.w200,
40+
height: 1.2,
41+
color: Colors.white,
42+
),
43+
),
44+
const Text(
45+
'사진을\n올리지\n않았어요!',
46+
style: TextStyle(
47+
fontSize: 60,
48+
fontWeight: FontWeight.w800,
49+
height: 1.2,
50+
color: Colors.white,
51+
),
52+
),
53+
Padding(
54+
padding: const EdgeInsets.only(
55+
left: 10,
56+
top: 170,
57+
right: 10,
58+
),
59+
child: Column(
60+
crossAxisAlignment: CrossAxisAlignment.start,
61+
children: [
62+
const Text(
63+
'가족들에게 푸시 알림을 전송할까요?',
64+
style: TextStyle(
65+
fontSize: 10,
66+
fontWeight: FontWeight.w300,
67+
color: Colors.white,
68+
),
69+
),
70+
const SizedBox(height: 12),
71+
ElevatedButton(
72+
style: ElevatedButton.styleFrom(
73+
padding: const EdgeInsets.symmetric(vertical: 8),
74+
minimumSize: const Size(double.infinity, 35),
75+
backgroundColor: Colors.white,
76+
shape: RoundedRectangleBorder(
77+
borderRadius: BorderRadius.circular(20),
78+
),
79+
),
80+
onPressed: () {
81+
Navigator.of(context).pop(); // 마음 기록 입력 화면 완성하고 수정
82+
},
83+
child: const Text(
84+
'재촉하기!',
85+
style: TextStyle(
86+
fontSize: 33,
87+
fontWeight: FontWeight.w400,
88+
color: AppColors.ongiOrange,
89+
),
90+
),
91+
),
92+
],
93+
),
94+
),
95+
],
96+
),
97+
),
98+
],
99+
),
100+
),
101+
);
102+
}
103+
}

0 commit comments

Comments
 (0)