more fix on keyboard focus when cursor is on + bump version

pull/41/head^2
li3317 4 years ago
parent 2efb4b12c2
commit 6c156d4a9a
  1. 5
      CHANGELOG.md
  2. 8
      lib/widgets/editor.dart
  3. 2
      pubspec.yaml

@ -99,4 +99,7 @@
* cursor focus when keyboard is on. * cursor focus when keyboard is on.
## [0.3.2] ## [0.3.2]
* Fix cursor focus issue when keyboard is on. * Fix cursor focus issue when keyboard is on.
## [0.3.3]
* More fix on cursor focus issue when keyboard is on.

@ -876,19 +876,17 @@ class RenderEditor extends RenderEditableContainerBox
double getOffsetToRevealCursor( double getOffsetToRevealCursor(
double viewportHeight, double scrollOffset, double offsetInViewport) { double viewportHeight, double scrollOffset, double offsetInViewport) {
List<TextSelectionPoint> endpoints = getEndpointsForSelection(selection); List<TextSelectionPoint> endpoints = getEndpointsForSelection(selection);
if (endpoints.length != 1) { TextSelectionPoint endpoint = endpoints.first;
return null;
}
RenderEditableBox child = childAtPosition(selection.extent); RenderEditableBox child = childAtPosition(selection.extent);
const kMargin = 8.0; const kMargin = 8.0;
double caretTop = endpoints.single.point.dy - double caretTop = endpoint.point.dy -
child.preferredLineHeight(TextPosition( child.preferredLineHeight(TextPosition(
offset: offset:
selection.extentOffset - child.getContainer().getOffset())) - selection.extentOffset - child.getContainer().getOffset())) -
kMargin + kMargin +
offsetInViewport; offsetInViewport;
final caretBottom = endpoints.single.point.dy + kMargin + offsetInViewport; final caretBottom = endpoint.point.dy + kMargin + offsetInViewport;
double dy; double dy;
if (caretTop < scrollOffset) { if (caretTop < scrollOffset) {
dy = caretTop; dy = caretTop;

@ -1,6 +1,6 @@
name: flutter_quill name: flutter_quill
description: One client and affiliated collaborator of Flutter Quill is Bullet Journal App. description: One client and affiliated collaborator of Flutter Quill is Bullet Journal App.
version: 0.3.2 version: 0.3.3
#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.git repository: https://github.com/singerdmx/flutter-quill.git

Loading…
Cancel
Save