From 3a62ebacd874a0ba902f5bed95e290c58d46b47d Mon Sep 17 00:00:00 2001 From: sihoo Date: Tue, 4 Aug 2026 14:24:35 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B6=9C=EC=84=9D/=EB=AC=B4=EB=8B=A8=EB=B0=98?= =?UTF-8?q?=EC=B6=9C=20=ED=8C=9D=EC=97=85=20=EC=A4=91=EB=B3=B5=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20+=20?= =?UTF-8?q?=EC=95=B1=20=EB=B2=84=EC=A0=84=201.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 새 팝업(출석완료/무단반출)을 띄우기 전 이전에 열려있던 팝업을 먼저 닫도록 수정 - 재태깅이 짧은 간격으로 반복되면 팝업이 여러 개 겹쳐 쌓이던 문제 해결 --- lib/nfc_poccket_checkin_screen.dart | 18 ++++++++++++++++-- pubspec.yaml | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/nfc_poccket_checkin_screen.dart b/lib/nfc_poccket_checkin_screen.dart index 7b13729..177a275 100644 --- a/lib/nfc_poccket_checkin_screen.dart +++ b/lib/nfc_poccket_checkin_screen.dart @@ -34,6 +34,7 @@ class _NfcPocketCheckInScreenState extends State { String? _activePocketNumber; StreamSubscription?>? _violationSub; + bool _isDialogOpen = false; // 출석/위반 팝업이 겹쳐서 뜨는 것을 막기 위한 플래그 bool get _watchServiceSupported => !kIsWeb && Platform.isAndroid; @@ -211,7 +212,18 @@ class _NfcPocketCheckInScreenState extends State { _showSnackBar("✅ 감시가 종료되었습니다. 수고하셨습니다!", Colors.green); } + /// 이미 떠 있는 팝업(출석 완료/무단반출 감지)이 있으면 새 팝업을 띄우기 전에 먼저 닫는다. + /// (태깅→반출→재태깅이 빠르게 반복되면 팝업이 여러 개 겹쳐 쌓이는 것을 방지) + void _closeAnyOpenDialog() { + if (_isDialogOpen && mounted) { + Navigator.of(context, rootNavigator: true).pop(); + } + _isDialogOpen = false; + } + void _showViolationDialog(String? pocketNumber) { + _closeAnyOpenDialog(); + _isDialogOpen = true; showDialog( context: context, builder: (context) => AlertDialog( @@ -230,11 +242,13 @@ class _NfcPocketCheckInScreenState extends State { ), ], ), - ); + ).then((_) => _isDialogOpen = false); } /// 🎊 출석 성공 알림창 void _showSuccessDialog(String pocketNumber) { + _closeAnyOpenDialog(); + _isDialogOpen = true; showDialog( context: context, builder: (context) => AlertDialog( @@ -249,7 +263,7 @@ class _NfcPocketCheckInScreenState extends State { ), ], ), - ); + ).then((_) => _isDialogOpen = false); } void _showSnackBar(String text, Color color) { diff --git a/pubspec.yaml b/pubspec.yaml index 3534db6..7d101bc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.1.1+2 +version: 1.1.2+3 environment: sdk: ^3.12.2