mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: hide overlay when tap on the editor
This commit is contained in:
parent
e2f35dd5cc
commit
e3e1d25494
@ -46,6 +46,13 @@ class _EditorNodeWidget extends StatelessWidget {
|
||||
..onEnd = _onPanEnd;
|
||||
},
|
||||
),
|
||||
TapGestureRecognizer:
|
||||
GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
|
||||
() => TapGestureRecognizer(),
|
||||
(recongizer) {
|
||||
recongizer..onTap = _onTap;
|
||||
},
|
||||
)
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
@ -66,8 +73,15 @@ class _EditorNodeWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
void _onTap() {
|
||||
editorState.panStartOffset = null;
|
||||
editorState.panEndOffset = null;
|
||||
editorState.updateSelection();
|
||||
}
|
||||
|
||||
void _onPanStart(DragStartDetails details) {
|
||||
editorState.panStartOffset = details.globalPosition;
|
||||
editorState.updateSelection();
|
||||
}
|
||||
|
||||
void _onPanUpdate(DragUpdateDetails details) {
|
||||
|
@ -56,6 +56,10 @@ class EditorState {
|
||||
List<OverlayEntry> selectionOverlays = [];
|
||||
|
||||
void updateSelection() {
|
||||
selectionOverlays
|
||||
..forEach((element) => element.remove())
|
||||
..clear();
|
||||
|
||||
final selectedNodes = _selectedNodes;
|
||||
if (selectedNodes.isEmpty) {
|
||||
return;
|
||||
@ -63,9 +67,6 @@ class EditorState {
|
||||
|
||||
assert(panStartOffset != null && panEndOffset != null);
|
||||
|
||||
selectionOverlays
|
||||
..forEach((element) => element.remove())
|
||||
..clear();
|
||||
for (final node in selectedNodes) {
|
||||
final key = node.key;
|
||||
if (key != null && key.currentState is Selectable) {
|
||||
|
Loading…
Reference in New Issue
Block a user