This improves separation of concerns for the RawEditor by moving the code for the text selection delegate to a separate class, furthermore add more comments. The PR does not change the functionality of the code.pull/233/head
parent
0c05c530e3
commit
ac68c2373d
2 changed files with 64 additions and 54 deletions
@ -0,0 +1,40 @@ |
||||
import 'package:flutter/widgets.dart'; |
||||
|
||||
import '../editor.dart'; |
||||
|
||||
mixin RawEditorStateSelectionDelegateMixin on EditorState |
||||
implements TextSelectionDelegate { |
||||
@override |
||||
TextEditingValue get textEditingValue { |
||||
return getTextEditingValue(); |
||||
} |
||||
|
||||
@override |
||||
set textEditingValue(TextEditingValue value) { |
||||
setTextEditingValue(value); |
||||
} |
||||
|
||||
@override |
||||
void bringIntoView(TextPosition position) { |
||||
// TODO: implement bringIntoView |
||||
} |
||||
|
||||
@override |
||||
void hideToolbar([bool hideHandles = true]) { |
||||
if (getSelectionOverlay()?.toolbar != null) { |
||||
getSelectionOverlay()?.hideToolbar(); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
bool get cutEnabled => widget.toolbarOptions.cut && !widget.readOnly; |
||||
|
||||
@override |
||||
bool get copyEnabled => widget.toolbarOptions.copy; |
||||
|
||||
@override |
||||
bool get pasteEnabled => widget.toolbarOptions.paste && !widget.readOnly; |
||||
|
||||
@override |
||||
bool get selectAllEnabled => widget.toolbarOptions.selectAll; |
||||
} |
Loading…
Reference in new issue