☠️☠️ 스낵바가 설정되어있는 버튼을 여러 차례 누르면, 그 횟수만큼 계속해서 스낵바가 뜬다 ☠️☠️
해결 방법 !! 👇
if (Get.isSnackbarOpen) {
} else {
Get.snackbar("저장 실패", "빈칸 없이 채워주세요",
colorText: Mycolor().snackbarText,
snackPosition: SnackPosition.TOP,
backgroundColor: Mycolor().snackbarBg,
icon: const Icon(Icons.warning_amber));
}
위 코드와 같이 if 문을 한 번 걸어서, 현재 snackbar가 떠있는 상황인지 확인 후 해당 기능을 수행하도록 변경해주면 됨!
'Frontend > Flutter' 카테고리의 다른 글
| [Flutter] 플러터 오픈소스 라이선스 목록 만들기 (0) | 2024.05.23 |
|---|---|
| [Flutter] Flutter의 FutureBuilder란? (0) | 2024.03.06 |
| [Flutter] 상태관리 라이브러리 GetX (0) | 2024.02.22 |
| [Flutter] TextField, CupertinoTextField에 숫자만 입력되게 하기 (0) | 2024.02.21 |
| [Flutter] TextFormField를 사용하여 textfield 상태관리 하기 (2) | 2024.02.21 |