From 2fd890f4887e2b78684f06c2fab315d6021982af Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 16 Apr 2026 18:34:30 +0700 Subject: [PATCH] TF-4301 Block barrier dismissal while label creation is in progress Wrap CreateNewLabelModal with PopScope(canPop: false) while the creation request is in flight so that tapping the barrier (barrierDismissible: true) cannot dispose the modal and cancel the stream subscription before the result is delivered. --- .../presentation/widgets/create_new_label_modal.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/features/labels/presentation/widgets/create_new_label_modal.dart b/lib/features/labels/presentation/widgets/create_new_label_modal.dart index ca983dd95..d4d7f3673 100644 --- a/lib/features/labels/presentation/widgets/create_new_label_modal.dart +++ b/lib/features/labels/presentation/widgets/create_new_label_modal.dart @@ -114,7 +114,11 @@ class _CreateNewLabelModalState extends State { final appLocalizations = AppLocalizations.of(context); final theme = Theme.of(context); - return LayoutBuilder(builder: (_, constraints) { + return ValueListenableBuilder( + valueListenable: _createLabelStateNotifier, + builder: (_, labelState, __) => PopScope( + canPop: labelState != LabelPositiveButtonState.progressing, + child: LayoutBuilder(builder: (_, constraints) { final currentScreenWidth = constraints.maxWidth; final currentScreenHeight = constraints.maxHeight; final isMobile = currentScreenWidth < ResponsiveUtils.minTabletWidth; @@ -256,7 +260,9 @@ class _CreateNewLabelModalState extends State { } return bodyWidget; - }); + }), + ), + ); } Widget _buildTitle(