From 061793846ee7c0a73ae4b27e260980cb9a8c233d Mon Sep 17 00:00:00 2001 From: dab246 Date: Fri, 17 Apr 2026 09:25:36 +0700 Subject: [PATCH] fixup! TF-4308 Add `NoLabelYetWidget` for choose label modal Signed-off-by: dab246 --- ...dd_list_label_to_list_emails_delegate.dart | 2 -- .../widgets/choose_label_modal.dart | 4 +-- .../widgets/no_label_yet_widget.dart | 25 ++++++++++--------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/features/labels/presentation/delegates/add_list_label_to_list_emails_delegate.dart b/lib/features/labels/presentation/delegates/add_list_label_to_list_emails_delegate.dart index 1fc5a9cd4..ed46ef018 100644 --- a/lib/features/labels/presentation/delegates/add_list_label_to_list_emails_delegate.dart +++ b/lib/features/labels/presentation/delegates/add_list_label_to_list_emails_delegate.dart @@ -27,8 +27,6 @@ class AddListLabelToListEmailsDelegate extends BaseController { required VoidCallback onCancel, required OnSyncListLabelForListEmail onSync, }) async { - if (_labelController.labels.isEmpty) return; - await DialogRouter().openDialogModal( child: ChooseLabelModal( labels: _labelController.labels, diff --git a/lib/features/labels/presentation/widgets/choose_label_modal.dart b/lib/features/labels/presentation/widgets/choose_label_modal.dart index 06166a580..df4d6f073 100644 --- a/lib/features/labels/presentation/widgets/choose_label_modal.dart +++ b/lib/features/labels/presentation/widgets/choose_label_modal.dart @@ -37,8 +37,8 @@ class _ChooseLabelModalState extends State { return LayoutBuilder(builder: (_, constraints) { final currentScreenWidth = constraints.maxWidth; final currentScreenHeight = constraints.maxHeight; - double height = math.min(currentScreenHeight - 100, 645); - double width = math.min(currentScreenWidth - 32, 536); + final height = math.max(0.0, math.min(currentScreenHeight - 100, 645.0)); + final width = math.max(0.0, math.min(currentScreenWidth - 32, 536.0)); Widget bodyWidget = Container( decoration: BoxDecoration( diff --git a/lib/features/labels/presentation/widgets/no_label_yet_widget.dart b/lib/features/labels/presentation/widgets/no_label_yet_widget.dart index 5a249d93f..7e8adf496 100644 --- a/lib/features/labels/presentation/widgets/no_label_yet_widget.dart +++ b/lib/features/labels/presentation/widgets/no_label_yet_widget.dart @@ -46,19 +46,20 @@ class NoLabelYetWidget extends StatelessWidget { padding: const EdgeInsetsDirectional.only(top: 36), ), ), - Container( - constraints: const BoxConstraints(minWidth: 186), - height: 48, - margin: const EdgeInsetsDirectional.only(top: 16), - child: ConfirmDialogButton( - label: appLocalizations.createALabel, - backgroundColor: Colors.white, - textColor: AppColor.primaryMain, - borderColor: AppColor.primaryMain, - icon: imagePaths.icAddIdentity, - onTapAction: onCreateLabel ?? () {}, + if (onCreateLabel != null) + Container( + constraints: const BoxConstraints(minWidth: 186), + height: 48, + margin: const EdgeInsetsDirectional.only(top: 16), + child: ConfirmDialogButton( + label: appLocalizations.createALabel, + backgroundColor: Colors.white, + textColor: AppColor.primaryMain, + borderColor: AppColor.primaryMain, + icon: imagePaths.icAddIdentity, + onTapAction: onCreateLabel!, + ), ), - ), ], ), ),