Skip to content

Commit d1f68bc

Browse files
authored
Merge pull request #349 from DevKor-github/342-feature-약속-삭제-확인-팝업-생성
Update dialog components and localization for modal changes
2 parents 59987a1 + 8369498 commit d1f68bc

31 files changed

Lines changed: 1239 additions & 809 deletions

lib/l10n/app_en.arb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,18 @@
375375
"@deleteAnyway": {
376376
"description": "Button label to proceed with deletion anyway"
377377
},
378+
"scheduleDeleteConfirmTitle": "Are you sure you want to delete this appointment?",
379+
"@scheduleDeleteConfirmTitle": {
380+
"description": "Title of schedule delete confirmation dialog"
381+
},
382+
"scheduleDeleteConfirmDescription": "Once deleted, this appointment cannot be restored.",
383+
"@scheduleDeleteConfirmDescription": {
384+
"description": "Description of schedule delete confirmation dialog"
385+
},
386+
"deleteScheduleConfirmAction": "Delete appointment",
387+
"@deleteScheduleConfirmAction": {
388+
"description": "Button text to confirm schedule deletion"
389+
},
378390
"deleteFeedbackTitle": "We hope to meet you again with a better service",
379391
"@deleteFeedbackTitle": {
380392
"description": "Delete feedback modal title"
@@ -448,4 +460,4 @@
448460
"description": "Button text to open app settings"
449461
}
450462

451-
}
463+
}

lib/l10n/app_ko.arb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
"keepUsing": "계속 사용할게요",
117117
"deleteAnyway": "그래도 탈퇴할게요"
118118
,
119+
"scheduleDeleteConfirmTitle": "정말 약속을 삭제할까요?",
120+
"scheduleDeleteConfirmDescription": "약속을 삭제하면 다시 되돌릴 수 없어요.",
121+
"deleteScheduleConfirmAction": "약속 삭제",
119122
"deleteFeedbackTitle": "더 좋은 서비스로 다시 만나요",
120123
"deleteFeedbackDescription": "더 나은 온타임이 될 수 있도록,\n어떤 점이 불편하셨는지\n알려주시면 감사하겠습니다.",
121124
"deleteFeedbackPlaceholder": "탈퇴하시는 이유를 알려주세요.",
@@ -143,4 +146,4 @@
143146
"openNotificationSettings": "설정에서 알림 허용",
144147
"openNotificationSettingsDescription": "알림 권한이 거부되었습니다.\n설정에서 직접 알림을 허용해주세요.",
145148
"openSettings": "설정 열기"
146-
}
149+
}

lib/l10n/app_localizations.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,24 @@ abstract class AppLocalizations {
596596
/// **'Delete anyway'**
597597
String get deleteAnyway;
598598

599+
/// Title of schedule delete confirmation dialog
600+
///
601+
/// In en, this message translates to:
602+
/// **'Are you sure you want to delete this appointment?'**
603+
String get scheduleDeleteConfirmTitle;
604+
605+
/// Description of schedule delete confirmation dialog
606+
///
607+
/// In en, this message translates to:
608+
/// **'Once deleted, this appointment cannot be restored.'**
609+
String get scheduleDeleteConfirmDescription;
610+
611+
/// Button text to confirm schedule deletion
612+
///
613+
/// In en, this message translates to:
614+
/// **'Delete appointment'**
615+
String get deleteScheduleConfirmAction;
616+
599617
/// Delete feedback modal title
600618
///
601619
/// In en, this message translates to:

lib/l10n/app_localizations_en.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,17 @@ class AppLocalizationsEn extends AppLocalizations {
295295
@override
296296
String get deleteAnyway => 'Delete anyway';
297297

298+
@override
299+
String get scheduleDeleteConfirmTitle =>
300+
'Are you sure you want to delete this appointment?';
301+
302+
@override
303+
String get scheduleDeleteConfirmDescription =>
304+
'Once deleted, this appointment cannot be restored.';
305+
306+
@override
307+
String get deleteScheduleConfirmAction => 'Delete appointment';
308+
298309
@override
299310
String get deleteFeedbackTitle =>
300311
'We hope to meet you again with a better service';

lib/l10n/app_localizations_ko.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ class AppLocalizationsKo extends AppLocalizations {
275275
@override
276276
String get deleteAnyway => '그래도 탈퇴할게요';
277277

278+
@override
279+
String get scheduleDeleteConfirmTitle => '정말 약속을 삭제할까요?';
280+
281+
@override
282+
String get scheduleDeleteConfirmDescription => '약속을 삭제하면 다시 되돌릴 수 없어요.';
283+
284+
@override
285+
String get deleteScheduleConfirmAction => '약속 삭제';
286+
278287
@override
279288
String get deleteFeedbackTitle => '더 좋은 서비스로 다시 만나요';
280289

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,31 @@
11
import 'package:flutter/material.dart';
2-
import 'package:on_time_front/presentation/shared/components/custom_alert_dialog.dart';
3-
import 'package:on_time_front/presentation/shared/components/modal_button.dart';
42
import 'package:on_time_front/l10n/app_localizations.dart';
3+
import 'package:on_time_front/presentation/shared/components/modal_wide_button.dart';
4+
import 'package:on_time_front/presentation/shared/components/two_action_dialog.dart';
55

66
Future<void> showPreparationCompletionDialog({
77
required BuildContext context,
88
required VoidCallback onFinish,
99
}) async {
10-
return showDialog(
11-
context: context,
12-
barrierDismissible: false,
13-
builder: (dialogContext) {
14-
return CustomAlertDialog(
15-
title: Text(
16-
AppLocalizations.of(dialogContext)!.areYouRunningLate,
17-
),
18-
content: Text(
19-
AppLocalizations.of(dialogContext)!.runningLateDescription,
20-
),
21-
actionsAlignment: MainAxisAlignment.spaceBetween,
22-
actions: [
23-
ModalButton(
24-
onPressed: () {
25-
Navigator.of(dialogContext).pop();
26-
},
27-
text: AppLocalizations.of(dialogContext)!.continuePreparing,
28-
color: Theme.of(dialogContext).colorScheme.primaryContainer,
29-
textColor: Theme.of(dialogContext).colorScheme.primary,
30-
),
31-
ModalButton(
32-
onPressed: () {
33-
Navigator.of(dialogContext).pop();
34-
onFinish();
35-
},
36-
text: AppLocalizations.of(dialogContext)!.finishPreparation,
37-
color: Theme.of(dialogContext).colorScheme.primary,
38-
textColor: Theme.of(dialogContext).colorScheme.surface,
39-
),
40-
],
41-
);
42-
},
10+
final l10n = AppLocalizations.of(context)!;
11+
final result = await showTwoActionDialog(
12+
context,
13+
config: TwoActionDialogConfig(
14+
title: l10n.areYouRunningLate,
15+
description: l10n.runningLateDescription,
16+
barrierDismissible: false,
17+
secondaryAction: DialogActionConfig(
18+
label: l10n.continuePreparing,
19+
variant: ModalWideButtonVariant.neutral,
20+
),
21+
primaryAction: DialogActionConfig(
22+
label: l10n.finishPreparation,
23+
variant: ModalWideButtonVariant.primary,
24+
),
25+
),
4326
);
27+
28+
if (result == DialogActionResult.primary) {
29+
onFinish();
30+
}
4431
}

lib/presentation/alarm/screens/schedule_start_screen.dart

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import 'package:go_router/go_router.dart';
55
import 'package:flutter_bloc/flutter_bloc.dart';
66
import 'package:on_time_front/presentation/app/bloc/schedule/schedule_bloc.dart';
77
import 'package:on_time_front/l10n/app_localizations.dart';
8-
import 'package:on_time_front/presentation/shared/components/custom_alert_dialog.dart';
9-
import 'package:on_time_front/presentation/shared/components/modal_button.dart';
8+
import 'package:on_time_front/presentation/shared/components/modal_wide_button.dart';
9+
import 'package:on_time_front/presentation/shared/components/two_action_dialog.dart';
1010
import 'package:on_time_front/presentation/shared/constants/app_colors.dart';
1111

1212
class ScheduleStartScreen extends StatefulWidget {
@@ -22,14 +22,29 @@ class ScheduleStartScreen extends StatefulWidget {
2222
}
2323

2424
class _ScheduleStartScreenState extends State<ScheduleStartScreen> {
25-
void _showModal(BuildContext context) {
26-
showDialog(
27-
context: context,
28-
barrierDismissible: false,
29-
builder: (BuildContext context) {
30-
return _ScheduleStartScreenModal();
31-
},
25+
Future<void> _showModal(BuildContext context) async {
26+
final l10n = AppLocalizations.of(context)!;
27+
28+
final result = await showTwoActionDialog(
29+
context,
30+
config: TwoActionDialogConfig(
31+
title: l10n.confirmLeave,
32+
description: l10n.confirmLeaveDescription,
33+
barrierDismissible: false,
34+
secondaryAction: DialogActionConfig(
35+
label: l10n.leave,
36+
variant: ModalWideButtonVariant.neutral,
37+
),
38+
primaryAction: DialogActionConfig(
39+
label: l10n.stay,
40+
variant: ModalWideButtonVariant.primary,
41+
),
42+
),
3243
);
44+
45+
if (result == DialogActionResult.secondary && context.mounted) {
46+
context.go('/home');
47+
}
3348
}
3449

3550
bool _isFiveMinutesBefore() {
@@ -122,7 +137,7 @@ class _ScheduleStartScreenState extends State<ScheduleStartScreen> {
122137
right: 10,
123138
child: IconButton(
124139
icon: const Icon(Icons.close),
125-
onPressed: () => _showModal(context),
140+
onPressed: () async => _showModal(context),
126141
),
127142
),
128143
],
@@ -177,31 +192,3 @@ class _ScheduleStartScreenState extends State<ScheduleStartScreen> {
177192
);
178193
}
179194
}
180-
181-
class _ScheduleStartScreenModal extends StatelessWidget {
182-
@override
183-
Widget build(BuildContext context) {
184-
return CustomAlertDialog(
185-
title: Text(
186-
AppLocalizations.of(context)!.confirmLeave,
187-
),
188-
content: Text(
189-
AppLocalizations.of(context)!.confirmLeaveDescription,
190-
),
191-
actions: [
192-
ModalButton(
193-
onPressed: () => context.go('/home'),
194-
text: AppLocalizations.of(context)!.leave,
195-
color: Theme.of(context).colorScheme.surfaceContainerLow,
196-
textColor: Theme.of(context).colorScheme.outline,
197-
),
198-
ModalButton(
199-
onPressed: () => Navigator.pop(context),
200-
text: AppLocalizations.of(context)!.stay,
201-
color: Theme.of(context).colorScheme.primary,
202-
textColor: Theme.of(context).colorScheme.onPrimary,
203-
),
204-
],
205-
);
206-
}
207-
}

lib/presentation/calendar/screens/calendar_screen.dart

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:on_time_front/presentation/calendar/component/schedule_detail.da
99
import 'package:on_time_front/presentation/schedule_create/screens/schedule_create_screen.dart';
1010
import 'package:on_time_front/presentation/schedule_create/screens/schedule_edit_screen.dart';
1111
import 'package:on_time_front/presentation/shared/components/calendar/centered_calendar_header.dart';
12+
import 'package:on_time_front/presentation/shared/components/two_button_delete_dialog.dart';
1213
import 'package:on_time_front/presentation/shared/theme/calendar_theme.dart';
1314
import 'package:on_time_front/presentation/shared/theme/theme.dart';
1415
import 'package:table_calendar/table_calendar.dart';
@@ -299,44 +300,32 @@ class _CalendarScreenState extends State<CalendarScreen> {
299300
],
300301
),
301302
);
302-
}
303-
304-
return Expanded(
305-
child: ListView.builder(
306-
itemCount:
307-
state.schedules[_selectedDate]?.length ?? 0,
308-
itemBuilder: (context, index) {
309-
final schedule =
310-
state.schedules[_selectedDate]![index];
311-
312-
return ScheduleDetail(
313-
schedule: schedule,
314-
onEdit: () {
315-
showModalBottomSheet(
316-
context: context,
317-
isScrollControlled: true,
318-
backgroundColor: Colors.transparent,
319-
builder: (context) => ScheduleEditScreen(
320-
scheduleId: schedule.id,
321-
),
322-
);
323-
},
324-
onDeleted: () {
325-
context.read<MonthlySchedulesBloc>().add(
326-
MonthlySchedulesScheduleDeleted(
327-
schedule: schedule,
328-
),
329-
);
330-
},
331-
);
332-
},
333-
),
334-
);
335-
},
336-
),
337-
],
338-
),
339-
),
303+
},
304+
onDeleted: () {
305+
showTwoButtonDeleteDialog(
306+
context,
307+
title: AppLocalizations.of(context)!
308+
.scheduleDeleteConfirmTitle,
309+
description: AppLocalizations.of(context)!
310+
.scheduleDeleteConfirmDescription,
311+
cancelText: AppLocalizations.of(context)!.cancel,
312+
confirmText: AppLocalizations.of(context)!
313+
.deleteScheduleConfirmAction,
314+
).then((confirmed) {
315+
if (confirmed != true || !context.mounted) {
316+
return;
317+
}
318+
context.read<MonthlySchedulesBloc>().add(
319+
MonthlySchedulesScheduleDeleted(
320+
schedule: schedule),
321+
);
322+
});
323+
},
324+
);
325+
},
326+
),
327+
);
328+
},
340329
),
341330
],
342331
),

0 commit comments

Comments
 (0)