Format code

pull/289/head
Cheryl Zhang 4 years ago
parent 6b9795ad00
commit 0c5a045d28
  1. 3
      lib/src/widgets/raw_editor.dart
  2. 6
      lib/src/widgets/text_selection.dart

@ -140,8 +140,7 @@ class RawEditorState extends EditorState
super.build(context);
var _doc = widget.controller.document;
if (_doc.isEmpty() &&
widget.placeholder != null) {
if (_doc.isEmpty() && widget.placeholder != null) {
_doc = Document.fromJson(jsonDecode(
'[{"attributes":{"placeholder":true},"insert":"${widget.placeholder}\\n"}]'));
}

@ -287,7 +287,6 @@ class _TextSelectionHandleOverlay extends StatefulWidget {
class _TextSelectionHandleOverlayState
extends State<_TextSelectionHandleOverlay>
with SingleTickerProviderStateMixin {
late Offset _dragPosition;
late Size _handleSize;
late AnimationController _controller;
@ -329,13 +328,12 @@ class _TextSelectionHandleOverlayState
}
void _handleDragStart(DragStartDetails details) {
_dragPosition = details.globalPosition + Offset(0.0, -_handleSize.height);
_dragPosition = details.globalPosition + Offset(0, -_handleSize.height);
}
void _handleDragUpdate(DragUpdateDetails details) {
_dragPosition += details.delta;
final position =
widget.renderObject!.getPositionForOffset(_dragPosition);
final position = widget.renderObject!.getPositionForOffset(_dragPosition);
if (widget.selection.isCollapsed) {
widget.onSelectionHandleChanged(TextSelection.fromPosition(position));
return;

Loading…
Cancel
Save