Fixes for flutter web (#234)

* Fix for Attribute object comparison

* Fix for "Unexpected null value" error on web

Clipboard is now supported on web, via a permission request through the browser

Co-authored-by: George Johnson <george@indiespring.com>
pull/236/head
George 4 years ago committed by GitHub
parent d4e4b0d507
commit 95359f66b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/src/models/documents/attribute.dart
  2. 12
      lib/src/widgets/raw_editor.dart

@ -193,7 +193,7 @@ class Attribute<T> {
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (other is! Attribute<T>) return false;
if (other is! Attribute) return false;
final typedOther = other;
return key == typedOther.key &&
scope == typedOther.scope &&

@ -126,8 +126,7 @@ class RawEditorState extends EditorState
DefaultStyles? _styles;
final ClipboardStatusNotifier? _clipboardStatus =
kIsWeb ? null : ClipboardStatusNotifier();
final ClipboardStatusNotifier _clipboardStatus = ClipboardStatusNotifier();
final LayerLink _toolbarLayerLink = LayerLink();
final LayerLink _startHandleLayerLink = LayerLink();
final LayerLink _endHandleLayerLink = LayerLink();
@ -318,7 +317,7 @@ class RawEditorState extends EditorState
void initState() {
super.initState();
_clipboardStatus?.addListener(_onChangedClipboardStatus);
_clipboardStatus.addListener(_onChangedClipboardStatus);
widget.controller.addListener(() {
_didChangeTextEditingValue(widget.controller.ignoreFocusOnTextChange);
@ -438,8 +437,9 @@ class RawEditorState extends EditorState
widget.focusNode.removeListener(_handleFocusChanged);
_focusAttachment!.detach();
_cursorCont.dispose();
_clipboardStatus?.removeListener(_onChangedClipboardStatus);
_clipboardStatus?.dispose();
_clipboardStatus
..removeListener(_onChangedClipboardStatus)
..dispose();
super.dispose();
}
@ -518,7 +518,7 @@ class RawEditorState extends EditorState
this,
DragStartBehavior.start,
null,
_clipboardStatus!,
_clipboardStatus,
);
_selectionOverlay!.handlesVisible = _shouldShowSelectionHandles();
_selectionOverlay!.showHandles();

Loading…
Cancel
Save