onClosePopup method
void
onClosePopup()
The onClosePopup
function is a callback method typically used
when a popup or overlay is closed. Its purpose is to ensure a smooth user
experience by handling the behavior when the popup is dismissed
Implementation
void onClosePopup() {
final offset = selection.base.offset;
focusNode?.requestFocus();
// Delay the execution of the following code until the next microtask
Future.microtask(
() => selection = TextSelection.collapsed(offset: offset),
);
}