Skip to content

Commit

Permalink
feat: Notification Util
Browse files Browse the repository at this point in the history
  • Loading branch information
HyungJoonSon committed Dec 6, 2024
1 parent c03588e commit 994a26a
Show file tree
Hide file tree
Showing 12 changed files with 341 additions and 91 deletions.
4 changes: 4 additions & 0 deletions client-app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Future<void> onInitSystem() async {

// Storage & Database
await StorageFactory.onInit();

// Notification
await NotificationUtil.initialize();
await NotificationUtil.setupRemoteNotification();
}

Future<void> onReadySystem() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,32 @@ class ArticleDetailScreen extends GetView<ArticleDetailViewModel> {
top: false,
bottom: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const ArticleDetailView(),
const CommentCardListView(),
SizedBox(height: GetPlatform.isAndroid ? 80 : 120),
],
),
),
),
padding: const EdgeInsets.symmetric(horizontal: 20),
child: RefreshIndicator(
onRefresh: viewModel.onRefresh,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
return CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
SliverToBoxAdapter(
child: Container(
color: ColorSystem.white,
child: Column(
children: [
const ArticleDetailView(),
const CommentCardListView(),
SizedBox(
height: GetPlatform.isAndroid ? 80 : 120),
],
),
),
),
],
);
},
),
)),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,110 @@ class CommentAddingScreen extends BaseScreen<CommentAddingViewModel> {
@override
Widget buildBody(BuildContext context) {
return GestureDetector(
onTap: () {
FocusScope.of(context).unfocus();
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: CustomScrollView(
slivers: [
const SliverToBoxAdapter(
child: SizedBox(height: 32),
),
const SliverToBoxAdapter(
child: CommentInputField(),
),
const SliverToBoxAdapter(
child: SizedBox(height: 32),
),
// SliverToBoxAdapter(
// child: Row(
// children: [
// FilledButton(
// onPressed: () {},
// style: FilledButton.styleFrom(
// // Size
// minimumSize: const Size(200, 32),
// fixedSize: const Size(200, 32),
//
// padding: EdgeInsets.zero,
//
// // Color
// backgroundColor: ColorSystem.neutral.shade300,
// foregroundColor: ColorSystem.white,
//
// disabledBackgroundColor: ColorSystem.neutral.shade300,
//
// // Border
// shape: const RoundedRectangleBorder(
// borderRadius: BorderRadius.all(
// Radius.circular(12),
// ),
// ),
// ),
// child: Center(
// child: Text(
// "커뮤니티 이용규칙 전체 보기",
// style: FontSystem.H5.copyWith(
// color: ColorSystem.neutral,
// height: 1.0,
// ),
// ),
// ),
// ),
// const Spacer(),
// ],
// ),
// ),
SliverToBoxAdapter(
child: Text(
"우아한은 건간을 위한 커뮤니티를 만들기 위해 커뮤니티 이용규칙을 제정하여 운영하고 있습니다. 위반 시 게시물이 삭제되고 서비스 이용이 일정 기간 제한될 수 있습니다."
"\n"
"\n"
"아래는 이 게시판에 해당하는 핵심 내용에 대한 요약 사항이며, 게시물 작성 전 커뮤니티 이용규칙 전문을 반드시 확인하시기 바랍니다.",
style: FontSystem.H6.copyWith(
color: ColorSystem.neutral.shade600,
),
),
),
SliverFillRemaining(
hasScrollBody: false,
child: Column(
children: [
const Spacer(),
const SizedBox(height: 32),
Obx(() {
VoidCallback? onPressed = viewModel.content.length > 10
? () {
viewModel.createComment().then((value) {
if (value) {
Get.back();
} else {
Get.snackbar('알림', '댓글 작성에 실패했습니다.');
}
});
}
: null;

return PrimaryFillButton(
width: Get.width,
height: 60,
content: '완료',
onPressed: onPressed,
);
}),
SizedBox(
height: GetPlatform.isAndroid ? 20 : 40,
),
],
),
),
],
),
),
);

GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: SingleChildScrollView(
child: Padding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CommentInputField extends BaseWidget<CommentAddingViewModel> {
hasSuffixIcon: false,
fillColor: ColorSystem.neutral.shade100,
textInputType: TextInputType.multiline,
textInputAction: TextInputAction.search,
textInputAction: TextInputAction.done,
onChangedCallBack: viewModel.updateContent,
onClearCallBack: viewModel.updateContent,
onSubmittedCallBack: () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:wooahan/presentation/view/medication/editing/widget/medication_i
import 'package:wooahan/presentation/view_model/medication/editing/medication_editing_view_model.dart';
import 'package:wooahan/presentation/widget/common/appbar/text_back_app_bar.dart';
import 'package:wooahan/presentation/widget/common/button/primary/primary_fill_button.dart';
import 'package:wooahan/presentation/widget/common/dialog/confirm_dialog.dart';

class MedicationEditingScreen extends BaseScreen<MedicationEditingViewModel> {
const MedicationEditingScreen({super.key});
Expand All @@ -33,6 +34,42 @@ class MedicationEditingScreen extends BaseScreen<MedicationEditingViewModel> {
title: '복약 수정하기',
backgroundColor: ColorSystem.white,
onBackPress: Get.back,
actions: [
GestureDetector(
onTap: () {
Get.dialog(
ConfirmDialog(
title: "복약 삭제",
content: '해당 약을 지우시겠어요?'
'\n'
'삭제 시 알림을 받을 수 없어요.',
onPressedCancel: Get.back,
onPressedApply: () {
viewModel.deleteAllApply().then((value) {
if (value) {
Get.back();
} else {
Get.snackbar(
'알림',
'전체 삭제에 실패했어요. 다시 시도해주세요.',
backgroundColor: ColorSystem.primary,
colorText: ColorSystem.white,
);
}
});
},
),
);
},
child: Text(
'전체 삭제',
style: FontSystem.H6.copyWith(
color: ColorSystem.red,
),
),
),
const SizedBox(width: 20),
],
preferredSize: const Size.fromHeight(64),
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wooahan/app/config/color_system.dart';
import 'package:wooahan/app/config/font_system.dart';
import 'package:wooahan/core/screen/base_widget.dart';
import 'package:wooahan/presentation/view/medication/editing/widget/medication_content_for_editing/component/editing_icon_button.dart';
import 'package:wooahan/presentation/view_model/medication/editing/medication_editing_view_model.dart';
Expand Down Expand Up @@ -28,6 +30,10 @@ class MedicationContentForEditingView
return const SizedBox(width: 48);
}

if (viewModel.modifiedMedicationList.isEmpty) {
return const SizedBox(width: 48);
}

if (viewModel.currentIndex != 0) {
return EditingIconButton(
icon: const Icon(
Expand All @@ -49,6 +55,16 @@ class MedicationContentForEditingView
return const Expanded(child: SizedBox());
}

if (viewModel.modifiedMedicationList.isEmpty) {
return Text(
'복약 중인 약이 없어요',
style: FontSystem.H6.copyWith(
height: 1.0,
color: ColorSystem.neutral.shade500,
),
);
}

return MedicationBasicDefaultItemView(
state: viewModel.modifiedMedicationList[viewModel.currentIndex],
onLongPress: () {
Expand Down Expand Up @@ -100,6 +116,11 @@ class MedicationContentForEditingView
if (viewModel.isInitLoading) {
return const SizedBox(width: 48);
}

if (viewModel.modifiedMedicationList.isEmpty) {
return const SizedBox(width: 48);
}

if (viewModel.currentIndex !=
viewModel.modifiedMedicationList.length - 1) {
return EditingIconButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ class MedicationIndicatorForEditingView
if (viewModel.isInitLoading) {
return const SizedBox(height: 16);
}

if (viewModel.modifiedMedicationList.isEmpty) {
return const SizedBox(height: 16);
}

return SizedBox(
height: 16,
child: Center(
Expand Down
Loading

0 comments on commit 994a26a

Please sign in to comment.