The EditableText widget provides this API to enable "unfocus" of text fields when the user taps outside of the TextFieldTapRegion.
Speaking of the TextFieldTapRegion, we might be able to leverage said widget for the excluded terms input, which has some custom code for the extra buttons that should not interfere with the text field closing