Skip to content

Commit

Permalink
chore: Removing code that's not being used. #275
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Oct 2, 2023
1 parent 3510c49 commit 33fb731
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 47 deletions.
47 changes: 0 additions & 47 deletions lib/presentation/widgets/editor/todo_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ class DeltaTodoEditorState extends State<DeltaTodoEditor> {
});
return false;
},
onTapUp: (details, p1) {
return _onTripleClickSelection();
},
customStyles: DefaultStyles(
h1: DefaultTextBlockStyle(
const TextStyle(
Expand Down Expand Up @@ -139,9 +136,6 @@ class DeltaTodoEditorState extends State<DeltaTodoEditor> {
placeholder: 'Add content',
expands: false,
padding: const EdgeInsets.only(top: 16.0),
onTapUp: (details, p1) {
return _onTripleClickSelection();
},
customStyles: DefaultStyles(
h1: DefaultTextBlockStyle(
const TextStyle(
Expand Down Expand Up @@ -288,47 +282,6 @@ class DeltaTodoEditorState extends State<DeltaTodoEditor> {
);
}

/// Callback called whenever the person taps on the text.
/// It will select nothing, then the word if another tap is detected
/// and then the whole text if another tap is detected (triple).
bool _onTripleClickSelection() {
final controller = widget.editorController;

// If nothing is selected, selection type is `none`
if (controller.selection.isCollapsed) {
_selectionType = _SelectionType.none;
}

// If nothing is selected, selection type becomes `word
if (_selectionType == _SelectionType.none) {
_selectionType = _SelectionType.word;
return false;
}

// If the word is selected, select all text
if (_selectionType == _SelectionType.word) {
final child = controller.document.queryChild(
controller.selection.baseOffset,
);
final offset = child.node?.documentOffset ?? 0;
final length = child.node?.length ?? 0;

final selection = TextSelection(
baseOffset: offset,
extentOffset: offset + length,
);

// Select all text and make next selection to `none`
controller.updateSelection(selection, ChangeSource.REMOTE);

_selectionType = _SelectionType.none;

return true;
}

return false;
}

/// Callback called whenever the person taps on the emoji button in the toolbar.
/// It shows/hides the emoji picker and focus/unfocusses the keyboard accordingly.
void _onEmojiButtonPressed(BuildContext context) {
Expand Down
1 change: 1 addition & 0 deletions test/widget/widget_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:dwyl_app/blocs/blocs.dart';
import 'package:dwyl_app/presentation/views/views.dart';
import 'package:dwyl_app/presentation/widgets/widgets.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill_test.dart';
Expand Down

0 comments on commit 33fb731

Please sign in to comment.