diff --git a/lib/features/manage_account/presentation/vacation/vacation_controller.dart b/lib/features/manage_account/presentation/vacation/vacation_controller.dart index 43323bb3fb..80b9ce490c 100644 --- a/lib/features/manage_account/presentation/vacation/vacation_controller.dart +++ b/lib/features/manage_account/presentation/vacation/vacation_controller.dart @@ -95,13 +95,13 @@ class VacationController extends BaseController { } void _initFocusListener() { - subjectTextFocusNode.addListener(() { - if (subjectTextFocusNode.hasFocus == true) { - if (PlatformInfo.isMobile) { - richTextControllerForMobile.hideRichTextView(); - } - } - }); + subjectTextFocusNode.addListener(_onSubjectTextListener); + } + + void _onSubjectTextListener() { + if (subjectTextFocusNode.hasFocus && PlatformInfo.isMobile) { + richTextControllerForMobile.hideRichTextView(); + } } void _getAllVacation() { @@ -410,6 +410,7 @@ class VacationController extends BaseController { @override void onClose() { + subjectTextFocusNode.removeListener(_onSubjectTextListener); subjectTextFocusNode.dispose(); subjectTextController.dispose(); richTextControllerForMobile.dispose();