collapseAllPanels method
void
collapseAllPanels()
Collapse all panels (emoji, more). Called externally when user taps blank area. In text mode, dismisses the keyboard. Only falls back to idle when the input is empty, so any already-entered text (including @ mentions) stays visible after the keyboard collapses. Voice mode is unaffected.
Implementation
void collapseAllPanels() {
bool needsRebuild = false;
if (_showEmojiPanel) {
_showEmojiPanel = false;
needsRebuild = true;
}
if (_showMorePanel) {
_showMorePanel = false;
needsRebuild = true;
}
if (_inputMode == _InputMode.text) {
_textEditingFocusNode.unfocus();
if (_textEditingController.text.isEmpty) {
_inputMode = _InputMode.idle;
}
needsRebuild = true;
}
if (needsRebuild) {
setState(() {});
}
}