Upgrade to 1.2.0

pull/150/head
Xin Yao 4 years ago
parent 3080fc2ad1
commit 63c2ef9d0e
  1. 3
      CHANGELOG.md
  2. 3
      lib/models/documents/document.dart
  3. 42
      lib/widgets/editor.dart
  4. 4
      lib/widgets/text_block.dart
  5. 2
      pubspec.yaml

@ -1,3 +1,6 @@
## [1.2.0]
* Fix image button cancel causes crash.
## [1.1.8] ## [1.1.8]
* Fix height of empty line bug. * Fix height of empty line bug.

@ -56,7 +56,8 @@ class Document {
return Delta(); return Delta();
} }
final delta = _rules.apply(RuleType.INSERT, this, index, data: data, len: replaceLength); final delta = _rules.apply(RuleType.INSERT, this, index,
data: data, len: replaceLength);
compose(delta, ChangeSource.LOCAL); compose(delta, ChangeSource.LOCAL);
return delta; return delta;
} }

@ -114,12 +114,11 @@ Widget _defaultEmbedBuilder(BuildContext context, leaf.Embed node) {
} }
class QuillEditor extends StatefulWidget { class QuillEditor extends StatefulWidget {
const QuillEditor({ const QuillEditor(
required this.controller, {required this.controller,
required this.focusNode, required this.focusNode,
required this.scrollController, required this.scrollController,
required this.scrollable, required this.scrollable,
required this.scrollBottomInset,
required this.padding, required this.padding,
required this.autoFocus, required this.autoFocus,
required this.readOnly, required this.readOnly,
@ -127,6 +126,7 @@ class QuillEditor extends StatefulWidget {
this.showCursor, this.showCursor,
this.placeholder, this.placeholder,
this.enableInteractiveSelection = true, this.enableInteractiveSelection = true,
this.scrollBottomInset = 0,
this.minHeight, this.minHeight,
this.maxHeight, this.maxHeight,
this.customStyles, this.customStyles,
@ -139,8 +139,7 @@ class QuillEditor extends StatefulWidget {
this.onSingleLongTapStart, this.onSingleLongTapStart,
this.onSingleLongTapMoveUpdate, this.onSingleLongTapMoveUpdate,
this.onSingleLongTapEnd, this.onSingleLongTapEnd,
this.embedBuilder = _defaultEmbedBuilder this.embedBuilder = _defaultEmbedBuilder});
});
factory QuillEditor.basic({ factory QuillEditor.basic({
required QuillController controller, required QuillController controller,
@ -154,7 +153,6 @@ class QuillEditor extends StatefulWidget {
autoFocus: true, autoFocus: true,
readOnly: readOnly, readOnly: readOnly,
expands: false, expands: false,
scrollBottomInset: 0,
padding: EdgeInsets.zero); padding: EdgeInsets.zero);
} }
@ -178,15 +176,20 @@ class QuillEditor extends StatefulWidget {
final ScrollPhysics? scrollPhysics; final ScrollPhysics? scrollPhysics;
final ValueChanged<String>? onLaunchUrl; final ValueChanged<String>? onLaunchUrl;
// Returns whether gesture is handled // Returns whether gesture is handled
final bool Function(TapDownDetails details, TextPosition textPosition)? onTapDown; final bool Function(TapDownDetails details, TextPosition textPosition)?
onTapDown;
// Returns whether gesture is handled // Returns whether gesture is handled
final bool Function(TapUpDetails details, TextPosition textPosition)? onTapUp; final bool Function(TapUpDetails details, TextPosition textPosition)? onTapUp;
// Returns whether gesture is handled // Returns whether gesture is handled
final bool Function(LongPressStartDetails details, TextPosition textPosition)? onSingleLongTapStart; final bool Function(LongPressStartDetails details, TextPosition textPosition)?
onSingleLongTapStart;
// Returns whether gesture is handled // Returns whether gesture is handled
final bool Function(LongPressMoveUpdateDetails details, TextPosition textPosition)? onSingleLongTapMoveUpdate; final bool Function(
LongPressMoveUpdateDetails details, TextPosition textPosition)?
onSingleLongTapMoveUpdate;
// Returns whether gesture is handled // Returns whether gesture is handled
final bool Function(LongPressEndDetails details, TextPosition textPosition)? onSingleLongTapEnd; final bool Function(LongPressEndDetails details, TextPosition textPosition)?
onSingleLongTapEnd;
final EmbedBuilder embedBuilder; final EmbedBuilder embedBuilder;
@override @override
@ -337,8 +340,8 @@ class _QuillEditorSelectionGestureDetectorBuilder
if (_state.widget.onSingleLongTapMoveUpdate != null) { if (_state.widget.onSingleLongTapMoveUpdate != null) {
final renderEditor = getRenderEditor(); final renderEditor = getRenderEditor();
if (renderEditor != null) { if (renderEditor != null) {
if (_state.widget.onSingleLongTapMoveUpdate!(details, renderEditor.getPositionForOffset(details.globalPosition) if (_state.widget.onSingleLongTapMoveUpdate!(details,
)) { renderEditor.getPositionForOffset(details.globalPosition))) {
return; return;
} }
} }
@ -467,7 +470,8 @@ class _QuillEditorSelectionGestureDetectorBuilder
if (_state.widget.onTapDown != null) { if (_state.widget.onTapDown != null) {
final renderEditor = getRenderEditor(); final renderEditor = getRenderEditor();
if (renderEditor != null) { if (renderEditor != null) {
if (_state.widget.onTapDown!(details, renderEditor.getPositionForOffset(details.globalPosition))) { if (_state.widget.onTapDown!(details,
renderEditor.getPositionForOffset(details.globalPosition))) {
return; return;
} }
} }
@ -480,7 +484,8 @@ class _QuillEditorSelectionGestureDetectorBuilder
if (_state.widget.onTapUp != null) { if (_state.widget.onTapUp != null) {
final renderEditor = getRenderEditor(); final renderEditor = getRenderEditor();
if (renderEditor != null) { if (renderEditor != null) {
if (_state.widget.onTapUp!(details, renderEditor.getPositionForOffset(details.globalPosition))) { if (_state.widget.onTapUp!(details,
renderEditor.getPositionForOffset(details.globalPosition))) {
return; return;
} }
} }
@ -522,7 +527,8 @@ class _QuillEditorSelectionGestureDetectorBuilder
if (_state.widget.onSingleLongTapStart != null) { if (_state.widget.onSingleLongTapStart != null) {
final renderEditor = getRenderEditor(); final renderEditor = getRenderEditor();
if (renderEditor != null) { if (renderEditor != null) {
if (_state.widget.onSingleLongTapStart!(details, renderEditor.getPositionForOffset(details.globalPosition))) { if (_state.widget.onSingleLongTapStart!(details,
renderEditor.getPositionForOffset(details.globalPosition))) {
return; return;
} }
} }
@ -556,7 +562,8 @@ class _QuillEditorSelectionGestureDetectorBuilder
if (_state.widget.onSingleLongTapEnd != null) { if (_state.widget.onSingleLongTapEnd != null) {
final renderEditor = getRenderEditor(); final renderEditor = getRenderEditor();
if (renderEditor != null) { if (renderEditor != null) {
if (_state.widget.onSingleLongTapEnd!(details, renderEditor.getPositionForOffset(details.globalPosition))) { if (_state.widget.onSingleLongTapEnd!(details,
renderEditor.getPositionForOffset(details.globalPosition))) {
return; return;
} }
} }
@ -927,7 +934,8 @@ class RenderEditor extends RenderEditableContainerBox
kMargin + kMargin +
offsetInViewport + offsetInViewport +
scrollBottomInset; scrollBottomInset;
final caretBottom = endpoint.point.dy + kMargin + offsetInViewport + scrollBottomInset; final caretBottom =
endpoint.point.dy + kMargin + offsetInViewport + scrollBottomInset;
double? dy; double? dy;
if (caretTop < scrollOffset) { if (caretTop < scrollOffset) {
dy = caretTop; dy = caretTop;

@ -520,8 +520,8 @@ class _EditableBlock extends MultiChildRenderObjectWidget {
this.scrollBottomInset, this.scrollBottomInset,
this.decoration, this.decoration,
this.contentPadding, this.contentPadding,
List<Widget> children List<Widget> children)
) : super(children: children); : super(children: children);
final Block block; final Block block;
final TextDirection textDirection; final TextDirection textDirection;

@ -1,6 +1,6 @@
name: flutter_quill name: flutter_quill
description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us)
version: 1.1.8 version: 1.2.0
#author: bulletjournal #author: bulletjournal
homepage: https://bulletjournal.us/home/index.html homepage: https://bulletjournal.us/home/index.html
repository: https://github.com/singerdmx/flutter-quill repository: https://github.com/singerdmx/flutter-quill

Loading…
Cancel
Save