dartlangeditorflutterflutter-appsflutter-examplesflutter-packageflutter-widgetquillquill-deltaquilljsreactquillrich-textrich-text-editorwysiwygwysiwyg-editor
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'editor.dart'; |
|
|
|
abstract class EditorTextSelectionGestureDetectorBuilderDelegate { |
|
GlobalKey<EditorState> getEditableTextKey(); |
|
|
|
bool getForcePressEnabled(); |
|
|
|
bool getSelectionEnabled(); |
|
} |
|
|
|
class EditorTextSelectionGestureDetectorBuilder { |
|
final EditorTextSelectionGestureDetectorBuilderDelegate delegate; |
|
bool shouldShowSelectionToolbar = true; |
|
|
|
EditorTextSelectionGestureDetectorBuilder(this.delegate) |
|
: assert(delegate != null); |
|
|
|
EditorState getEditor() { |
|
return delegate.getEditableTextKey().currentState; |
|
} |
|
|
|
RenderEditor getRenderEditor() { |
|
return this.getEditor().getRenderEditor(); |
|
} |
|
|
|
onTapDown(TapDownDetails details) { |
|
// getRenderEditor().handleTapDown(details); |
|
} |
|
|
|
onForcePressStart(ForcePressDetails details) { |
|
assert(delegate.getForcePressEnabled()); |
|
shouldShowSelectionToolbar = true; |
|
if (delegate.getSelectionEnabled()) { |
|
getRenderEditor().selectWordsInRange( |
|
details.globalPosition, |
|
null, |
|
SelectionChangedCause.forcePress, |
|
); |
|
} |
|
} |
|
|
|
Widget build(HitTestBehavior behavior, Widget child) { |
|
// TODO |
|
return null; |
|
} |
|
}
|
|
|