mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #536 from AppFlowy-IO/fix/emoji_close
fix: emoji picker remove without attach overlay
This commit is contained in:
commit
9b6451506f
@ -27,7 +27,7 @@ class _EmojiStyleButtonState extends State<FlowyEmojiStyleButton> {
|
|||||||
bool _isToggled = false;
|
bool _isToggled = false;
|
||||||
// Style get _selectionStyle => widget.controller.getSelectionStyle();
|
// Style get _selectionStyle => widget.controller.getSelectionStyle();
|
||||||
final GlobalKey emojiButtonKey = GlobalKey();
|
final GlobalKey emojiButtonKey = GlobalKey();
|
||||||
OverlayEntry _entry = OverlayEntry(builder: (context) => Container());
|
OverlayEntry? _entry;
|
||||||
// final FocusNode _keyFocusNode = FocusNode();
|
// final FocusNode _keyFocusNode = FocusNode();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -54,7 +54,7 @@ class _EmojiStyleButtonState extends State<FlowyEmojiStyleButton> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_entry.remove();
|
_entry?.remove();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +83,9 @@ class _EmojiStyleButtonState extends State<FlowyEmojiStyleButton> {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
void _toggleAttribute() {
|
void _toggleAttribute() {
|
||||||
if (_entry.mounted) {
|
if (_entry?.mounted ?? false) {
|
||||||
_entry.remove();
|
_entry?.remove();
|
||||||
|
_entry = null;
|
||||||
setState(() => _isToggled = false);
|
setState(() => _isToggled = false);
|
||||||
} else {
|
} else {
|
||||||
RenderBox box = emojiButtonKey.currentContext?.findRenderObject() as RenderBox;
|
RenderBox box = emojiButtonKey.currentContext?.findRenderObject() as RenderBox;
|
||||||
@ -99,7 +100,7 @@ class _EmojiStyleButtonState extends State<FlowyEmojiStyleButton> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
Overlay.of(context)!.insert(_entry);
|
Overlay.of(context)!.insert(_entry!);
|
||||||
setState(() => _isToggled = true);
|
setState(() => _isToggled = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user