-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
snack bar 알림 추가 #75
snack bar 알림 추가 #75
Conversation
자신의 좋아요, 싫어요의 경우에 누르는 경우 불가능하다는 스낵바 알림 추가
자신의 댓글에 대한 좋아요, 싫어요 클릭 시에 알림을 보내주는 스낵바 구현
프로필 업데이트에 실패했을 때 스낵바 메시지를 보여주도록 함.
4초에서 3초로 변경함.
차단에 실패했을 때 스낵바 메시지로 알림이 가도록 하였고 _showAraSnackBar 함수를 _showInfoBySnackBar로 수정하여 리팩토링을 진행함.
launchInBrowser가 실패했을 때 스낵바가 두 번 사용되어 하나를 제거함.
information.svg + 텍스트 형태의 동일한 스낵바가 자주 사용되어 snackbar_noti.dart에 함수화함
{ | ||
"filename" : "40.png", | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"filename" : "60.png", | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"filename" : "29.png", | ||
"idiom" : "iphone", | ||
"scale" : "1x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"filename" : "58.png", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
단순히 정렬된건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엇 이건 제가 의도적으로 변경한 부분이 아니고 자동으로 정렬된 것 같습니다. 내용을 보니 단순 정렬로 보이네요.
lib/widgets/snackbar_noti.dart
Outdated
@@ -1,6 +1,6 @@ | |||
import 'package:flutter/material.dart'; | |||
|
|||
const Duration _araSnackBarDisplayDuration = Duration(seconds: 4); | |||
const Duration _araSnackBarDisplayDuration = Duration(seconds: 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
시간 2.5초 정도로 좀 더 줄여도 될것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.5초로 줄였습니다
lib/pages/post_view_page.dart
Outdated
/// showSnackBar 함수가 자주 쓰여서 함수로 분리함. | ||
void _showAraSnackBar() { | ||
/// information.svg를 사용하는 SnackBar가 자주 쓰여서 함수화함. | ||
void _showInfoBySnackBar(String infoText) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildAraSnack과의 관련성을 주석으로 더 적어주시면 좋을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석 추가하였습니다.
좋아요 버튼을 계속 눌렀을 때 노티가 큐처럼 쌓여 계속 떠 있는 문제가 발생합니다. RPReplay_Final1708090790.MP4Flutter에서 현재 떠있는 SnackBar를 프로그래밍 방식으로 제거하려면, ScaffoldMessenger를 사용해야 합니다. ScaffoldMessenger는 SnackBar를 포함한 여러 Scaffold 관련 메시지를 관리하는 데 사용됩니다. 특히, 현재 표시되고 있는 SnackBar를 숨기기 위해서는 ScaffoldMessenger의 hideCurrentSnackBar 메서드를 호출하면 됩니다. 다음은 현재 떠있는 SnackBar를 꺼지게 하는 방법을 보여주는 예시 코드입니다: dart
이 함수를 호출할 때는 현재 BuildContext를 인자로 제공해야 합니다. 예를 들어, 버튼을 눌렀을 때 현재 표시되고 있는 SnackBar를 제거하고 싶다면, 다음과 같이 버튼의 onPressed 콜백 안에서 이 함수를 호출할 수 있습니다: dart
이 방법을 사용하면 현재 표시되고 있는 SnackBar가 있을 경우, 그 SnackBar가 즉시 사라집니다. 만약 표시되고 있는 SnackBar가 없다면, hideCurrentSnackBar 메서드 호출은 아무런 효과가 없습니다. 제가 생각하는 방안은 |
기존에 기본 showSnackBar를 사용하던 코드에 모두 적용함.
기존에 존재하던 스낵바를 제거하고 새로운 스낵바를 보여주는 함수를 구현하여 스낵바가 쌓이는 문제 해결했습니다. 다른 리뷰도 반영하였습니다. Simulator.Screen.Recording.-.iPhone.15.-.2024-02-16.at.23.19.22.mp4 |
lib/widgets/snackbar_noti.dart
Outdated
ScaffoldMessenger.of(context).hideCurrentSnackBar(); | ||
return ScaffoldMessenger.of(context).showSnackBar(araSnackBar); | ||
} | ||
|
||
/// information.svg와 함께 동일한 위젯 구성을 가진 SnackBar가 자주 사용되어 | ||
/// infoText만 전달하면 반복적으로 생성이 가능하도록 함수화함. | ||
void showInfoBySnackBar(BuildContext context, String infoText) { | ||
// 이전에 존재하던 스낵바 제거 | ||
ScaffoldMessenger.of(context).hideCurrentSnackBar(); | ||
ScaffoldMessenger.of(context).showSnackBar(buildAraSnackBar(context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
같은 형식의 함수임에도 hideOldsAndShowAraSnackBar
은 리턴값이 있는 이유가 무엇인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ScaffoldMessenger.of(context).showSnackBar 대신 사용하는 함수로 만든거라 같은 리턴 타입을 지정했습니다. showInfoSnackBar와 리턴타입을 하나로 통일하는것이 좋을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리턴값 제거했습니다
변경된 부분
논의해볼 부분