Parcourir la source

Fixed caret affinity on tap

Anatoly Pulyaevskiy il y a 6 ans
Parent
révision
c3b37152c5

+ 1
- 1
packages/zefyr/lib/src/widgets/editable_rich_text.dart Voir le fichier

@@ -102,7 +102,7 @@ class RenderEditableParagraph extends RenderParagraph
102 102
   @override
103 103
   TextRange getWordBoundary(TextPosition position) {
104 104
     final localPosition = new TextPosition(
105
-      offset: position.offset - _node.offset,
105
+      offset: position.offset - _node.documentOffset,
106 106
       affinity: position.affinity,
107 107
     );
108 108
     final localRange = super.getWordBoundary(localPosition);

+ 4
- 1
packages/zefyr/lib/src/widgets/selection.dart Voir le fichier

@@ -218,7 +218,10 @@ class _ZefyrSelectionOverlayState extends State<ZefyrSelectionOverlay>
218 218
 
219 219
     final localPoint = box.globalToLocal(globalPoint);
220 220
     final position = box.getPositionForOffset(localPoint);
221
-    final selection = new TextSelection.collapsed(offset: position.offset);
221
+    final selection = new TextSelection.collapsed(
222
+      offset: position.offset,
223
+      affinity: position.affinity,
224
+    );
222 225
     if (_didCaretTap && _selection == selection) {
223 226
       _didCaretTap = false;
224 227
       hideToolbar();

+ 3
- 3
packages/zefyr/lib/src/widgets/theme.dart Voir le fichier

@@ -73,7 +73,7 @@ class ZefyrThemeData {
73 73
       fontWeight: FontWeight.normal,
74 74
       color: Colors.grey.shade800,
75 75
     );
76
-    final padding = const EdgeInsets.only(bottom: 8.0);
76
+    final padding = const EdgeInsets.only(bottom: 16.0);
77 77
     final boldStyle = new TextStyle(fontWeight: FontWeight.bold);
78 78
     final italicStyle = new TextStyle(fontStyle: FontStyle.italic);
79 79
     final linkStyle =
@@ -181,7 +181,7 @@ class HeadingTheme {
181 181
           height: 1.25,
182 182
           fontWeight: FontWeight.w600,
183 183
         ),
184
-        padding: EdgeInsets.only(bottom: 8.0, top: 16.0),
184
+        padding: EdgeInsets.only(bottom: 8.0, top: 8.0),
185 185
       ),
186 186
       level3: StyleTheme(
187 187
         textStyle: TextStyle(
@@ -190,7 +190,7 @@ class HeadingTheme {
190 190
           height: 1.25,
191 191
           fontWeight: FontWeight.w600,
192 192
         ),
193
-        padding: EdgeInsets.only(bottom: 8.0, top: 16.0),
193
+        padding: EdgeInsets.only(bottom: 8.0, top: 8.0),
194 194
       ),
195 195
     );
196 196
   }