Clear warnings

pull/110/head
Xin Yao 4 years ago
parent 718912bc29
commit 6722759441
  1. 4
      analysis_options.yaml
  2. 4
      lib/models/documents/document.dart
  3. 4
      lib/models/documents/history.dart
  4. 4
      lib/widgets/controller.dart
  5. 22
      lib/widgets/delegate.dart
  6. 6
      lib/widgets/editor.dart

@ -2,4 +2,6 @@ include: package:pedantic/analysis_options.yaml
analyzer: analyzer:
errors: errors:
undefined_prefixed_name: ignore undefined_prefixed_name: ignore
omit_local_variable_types: ignore
unsafe_html: ignore

@ -163,9 +163,9 @@ class Document {
return _history.redo(this); return _history.redo(this);
} }
get hasUndo => _history.hasUndo; bool get hasUndo => _history.hasUndo;
get hasRedo => _history.hasRedo; bool get hasRedo => _history.hasRedo;
static Delta _transform(Delta delta) { static Delta _transform(Delta delta) {
Delta res = Delta(); Delta res = Delta();

@ -6,9 +6,9 @@ import 'document.dart';
class History { class History {
final HistoryStack stack = HistoryStack.empty(); final HistoryStack stack = HistoryStack.empty();
get hasUndo => stack.undo.isNotEmpty; bool get hasUndo => stack.undo.isNotEmpty;
get hasRedo => stack.redo.isNotEmpty; bool get hasRedo => stack.redo.isNotEmpty;
/// used for disable redo or undo function /// used for disable redo or undo function
bool ignoreChange; bool ignoreChange;

@ -69,9 +69,9 @@ class QuillController extends ChangeNotifier {
} }
} }
get hasUndo => document.hasUndo; bool get hasUndo => document.hasUndo;
get hasRedo => document.hasRedo; bool get hasRedo => document.hasRedo;
void replaceText(int index, int len, Object? data, TextSelection? textSelection) { void replaceText(int index, int len, Object? data, TextSelection? textSelection) {
assert(data is String || data is Embeddable); assert(data is String || data is Embeddable);

@ -31,7 +31,7 @@ class EditorTextSelectionGestureDetectorBuilder {
return getEditor()!.getRenderEditor(); return getEditor()!.getRenderEditor();
} }
onTapDown(TapDownDetails details) { void onTapDown(TapDownDetails details) {
getRenderEditor()!.handleTapDown(details); getRenderEditor()!.handleTapDown(details);
PointerDeviceKind? kind = details.kind; PointerDeviceKind? kind = details.kind;
@ -40,7 +40,7 @@ class EditorTextSelectionGestureDetectorBuilder {
kind == PointerDeviceKind.stylus; kind == PointerDeviceKind.stylus;
} }
onForcePressStart(ForcePressDetails details) { void onForcePressStart(ForcePressDetails details) {
assert(delegate.getForcePressEnabled()); assert(delegate.getForcePressEnabled());
shouldShowSelectionToolbar = true; shouldShowSelectionToolbar = true;
if (delegate.getSelectionEnabled()) { if (delegate.getSelectionEnabled()) {
@ -52,7 +52,7 @@ class EditorTextSelectionGestureDetectorBuilder {
} }
} }
onForcePressEnd(ForcePressDetails details) { void onForcePressEnd(ForcePressDetails details) {
assert(delegate.getForcePressEnabled()); assert(delegate.getForcePressEnabled());
getRenderEditor()!.selectWordsInRange( getRenderEditor()!.selectWordsInRange(
details.globalPosition, details.globalPosition,
@ -64,15 +64,15 @@ class EditorTextSelectionGestureDetectorBuilder {
} }
} }
onSingleTapUp(TapUpDetails details) { void onSingleTapUp(TapUpDetails details) {
if (delegate.getSelectionEnabled()) { if (delegate.getSelectionEnabled()) {
getRenderEditor()!.selectWordEdge(SelectionChangedCause.tap); getRenderEditor()!.selectWordEdge(SelectionChangedCause.tap);
} }
} }
onSingleTapCancel() {} void onSingleTapCancel() {}
onSingleLongTapStart(LongPressStartDetails details) { void onSingleLongTapStart(LongPressStartDetails details) {
if (delegate.getSelectionEnabled()) { if (delegate.getSelectionEnabled()) {
getRenderEditor()!.selectPositionAt( getRenderEditor()!.selectPositionAt(
details.globalPosition, details.globalPosition,
@ -82,7 +82,7 @@ class EditorTextSelectionGestureDetectorBuilder {
} }
} }
onSingleLongTapMoveUpdate(LongPressMoveUpdateDetails details) { void onSingleLongTapMoveUpdate(LongPressMoveUpdateDetails details) {
if (delegate.getSelectionEnabled()) { if (delegate.getSelectionEnabled()) {
getRenderEditor()!.selectPositionAt( getRenderEditor()!.selectPositionAt(
details.globalPosition, details.globalPosition,
@ -92,13 +92,13 @@ class EditorTextSelectionGestureDetectorBuilder {
} }
} }
onSingleLongTapEnd(LongPressEndDetails details) { void onSingleLongTapEnd(LongPressEndDetails details) {
if (shouldShowSelectionToolbar) { if (shouldShowSelectionToolbar) {
getEditor()!.showToolbar(); getEditor()!.showToolbar();
} }
} }
onDoubleTapDown(TapDownDetails details) { void onDoubleTapDown(TapDownDetails details) {
if (delegate.getSelectionEnabled()) { if (delegate.getSelectionEnabled()) {
getRenderEditor()!.selectWord(SelectionChangedCause.tap); getRenderEditor()!.selectWord(SelectionChangedCause.tap);
if (shouldShowSelectionToolbar) { if (shouldShowSelectionToolbar) {
@ -107,7 +107,7 @@ class EditorTextSelectionGestureDetectorBuilder {
} }
} }
onDragSelectionStart(DragStartDetails details) { void onDragSelectionStart(DragStartDetails details) {
getRenderEditor()!.selectPositionAt( getRenderEditor()!.selectPositionAt(
details.globalPosition, details.globalPosition,
null, null,
@ -115,7 +115,7 @@ class EditorTextSelectionGestureDetectorBuilder {
); );
} }
onDragSelectionUpdate( void onDragSelectionUpdate(
DragStartDetails startDetails, DragUpdateDetails updateDetails) { DragStartDetails startDetails, DragUpdateDetails updateDetails) {
getRenderEditor()!.selectPositionAt( getRenderEditor()!.selectPositionAt(
startDetails.globalPosition, startDetails.globalPosition,

@ -325,7 +325,7 @@ class _QuillEditorState extends State<QuillEditor>
return widget.enableInteractiveSelection; return widget.enableInteractiveSelection;
} }
_requestKeyboard() { void _requestKeyboard() {
_editorKey.currentState!.requestKeyboard(); _editorKey.currentState!.requestKeyboard();
} }
} }
@ -337,7 +337,7 @@ class _QuillEditorSelectionGestureDetectorBuilder
_QuillEditorSelectionGestureDetectorBuilder(this._state) : super(_state); _QuillEditorSelectionGestureDetectorBuilder(this._state) : super(_state);
@override @override
onForcePressStart(ForcePressDetails details) { void onForcePressStart(ForcePressDetails details) {
super.onForcePressStart(details); super.onForcePressStart(details);
if (delegate.getSelectionEnabled() && shouldShowSelectionToolbar) { if (delegate.getSelectionEnabled() && shouldShowSelectionToolbar) {
getEditor()!.showToolbar(); getEditor()!.showToolbar();
@ -345,7 +345,7 @@ class _QuillEditorSelectionGestureDetectorBuilder
} }
@override @override
onForcePressEnd(ForcePressDetails details) {} void onForcePressEnd(ForcePressDetails details) {}
@override @override
void onSingleLongTapMoveUpdate(LongPressMoveUpdateDetails details) { void onSingleLongTapMoveUpdate(LongPressMoveUpdateDetails details) {

Loading…
Cancel
Save