diff --git a/.gitignore b/.gitignore index c366cba..9d7edcf 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,6 @@ .pub-cache/ .pub/ build/ -pubspec.lock # Android related **/android/**/gradle-wrapper.jar diff --git a/CHANGELOG.md b/CHANGELOG.md index c7df18e..ba83743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,3 @@ -# Unreleased - -* fix: TextSelectionGestureDetector update for Flutter 3.10.0 - # 10.0.0 * fix issue on ios after flutter version 3.7.0. #191 #198 diff --git a/lib/src/background_text_span.dart b/lib/src/background_text_span.dart index fe7ed0a..d722414 100644 --- a/lib/src/background_text_span.dart +++ b/lib/src/background_text_span.dart @@ -159,7 +159,7 @@ class BackgroundTextSpan extends SpecialTextSpan { } @override - int get hashCode => Object.hash( + int get hashCode => hashValues( style, text, recognizer, diff --git a/lib/src/extended_widget_span.dart b/lib/src/extended_widget_span.dart index ad0f901..6244288 100644 --- a/lib/src/extended_widget_span.dart +++ b/lib/src/extended_widget_span.dart @@ -66,7 +66,7 @@ class ExtendedWidgetSpan extends WidgetSpan with SpecialInlineSpanBase { @override int get hashCode => - Object.hash(super.hashCode, baseHashCode, widgetSpanSize.size); + hashValues(super.hashCode, baseHashCode, widgetSpanSize.size); @override RenderComparison compareTo(InlineSpan other) { diff --git a/lib/src/selection/extended_text_selection.dart b/lib/src/selection/extended_text_selection.dart index dd01c08..3a1ee02 100644 --- a/lib/src/selection/extended_text_selection.dart +++ b/lib/src/selection/extended_text_selection.dart @@ -106,14 +106,8 @@ class ExtendedTextSelectionGestureDetectorBuilder { /// /// * [TextSelectionGestureDetector.onTapDown], which triggers this callback. @protected - void onTapDown(TapDragDownDetails details) { - renderEditable.handleTapDown( - TapDownDetails( - globalPosition: details.globalPosition, - localPosition: details.localPosition, - kind: details.kind, - ), - ); + void onTapDown(TapDownDetails details) { + renderEditable.handleTapDown(details); // The selection overlay should only be shown when the user is interacting // through a touch screen (via either a finger or a stylus). A mouse shouldn't // trigger the selection overlay. @@ -179,7 +173,7 @@ class ExtendedTextSelectionGestureDetectorBuilder { /// * [TextSelectionGestureDetector.onSingleTapUp], which triggers /// this callback. @protected - void onSingleTapUp(TapDragUpDetails details) { + void onSingleTapUp(TapUpDetails details) { if (delegate.selectionEnabled) { renderEditable.selectWordEdge(cause: SelectionChangedCause.tap); } @@ -290,7 +284,7 @@ class ExtendedTextSelectionGestureDetectorBuilder { /// * [TextSelectionGestureDetector.onDoubleTapDown], which triggers this /// callback. @protected - void onDoubleTapDown(TapDragDownDetails details) { + void onDoubleTapDown(TapDownDetails details) { if (delegate.selectionEnabled) { renderEditable.selectWord(cause: SelectionChangedCause.tap); if (shouldShowSelectionToolbar) { @@ -308,7 +302,7 @@ class ExtendedTextSelectionGestureDetectorBuilder { /// * [TextSelectionGestureDetector.onDragSelectionStart], which triggers /// this callback. @protected - void onDragSelectionStart(TapDragStartDetails details) { + void onDragSelectionStart(DragStartDetails details) { if (!delegate.selectionEnabled) { return; } @@ -331,13 +325,14 @@ class ExtendedTextSelectionGestureDetectorBuilder { /// * [TextSelectionGestureDetector.onDragSelectionUpdate], which triggers /// this callback./lib/src/material/text_field.dart @protected - void onDragSelectionUpdate(TapDragUpdateDetails details) { + void onDragSelectionUpdate( + DragStartDetails startDetails, DragUpdateDetails updateDetails) { if (!delegate.selectionEnabled) { return; } renderEditable.selectPositionAt( - from: details.localOffsetFromOrigin, - to: details.localPosition, + from: startDetails.globalPosition, + to: updateDetails.globalPosition, cause: SelectionChangedCause.drag, ); } @@ -351,7 +346,7 @@ class ExtendedTextSelectionGestureDetectorBuilder { /// * [TextSelectionGestureDetector.onDragSelectionEnd], which triggers this /// callback. @protected - void onDragSelectionEnd(TapDragEndDetails details) { + void onDragSelectionEnd(DragEndDetails details) { /* Subclass should override this method if needed. */ } @@ -449,7 +444,7 @@ class CommonTextSelectionGestureDetectorBuilder } @override - void onSingleTapUp(TapDragUpDetails details) { + void onSingleTapUp(TapUpDetails details) { hideToolbar(); if (delegate.selectionEnabled) { switch (Theme.of(_context).platform) { diff --git a/lib/src/selection/extended_text_selection_overlay.dart b/lib/src/selection/extended_text_selection_overlay.dart index c3387dd..e693234 100644 --- a/lib/src/selection/extended_text_selection_overlay.dart +++ b/lib/src/selection/extended_text_selection_overlay.dart @@ -623,7 +623,7 @@ class SelectionOverlay { OverlayEntry(builder: _buildStartHandle), OverlayEntry(builder: _buildEndHandle), ]; - Overlay.of(context, rootOverlay: true, debugRequiredFor: debugRequiredFor) + Overlay.of(context, rootOverlay: true, debugRequiredFor: debugRequiredFor)! .insertAll(_handles!); } @@ -646,7 +646,7 @@ class SelectionOverlay { return; } _toolbar = OverlayEntry(builder: _buildToolbar); - Overlay.of(context, rootOverlay: true, debugRequiredFor: debugRequiredFor) + Overlay.of(context, rootOverlay: true, debugRequiredFor: debugRequiredFor)! .insert(_toolbar!); } diff --git a/lib/src/special_inline_span_base.dart b/lib/src/special_inline_span_base.dart index 91d8028..b637798 100644 --- a/lib/src/special_inline_span_base.dart +++ b/lib/src/special_inline_span_base.dart @@ -4,7 +4,7 @@ import 'package:flutter/rendering.dart'; /// create by zmtzawqlp on 2019/7/10 /// -mixin SpecialInlineSpanBase { +abstract class SpecialInlineSpanBase { /// actual text String get actualText; @@ -28,7 +28,7 @@ mixin SpecialInlineSpanBase { other.actualText == actualText; } - int get baseHashCode => Object.hash(actualText, start, deleteAll); + int get baseHashCode => hashValues(actualText, start, deleteAll); RenderComparison baseCompareTo(SpecialInlineSpanBase other) { if (other.actualText != actualText) { diff --git a/lib/src/special_text_span.dart b/lib/src/special_text_span.dart index 1f1633c..e69c350 100644 --- a/lib/src/special_text_span.dart +++ b/lib/src/special_text_span.dart @@ -60,7 +60,7 @@ class SpecialTextSpan extends TextSpan with SpecialInlineSpanBase { } @override - int get hashCode => Object.hash(super.hashCode, baseHashCode); + int get hashCode => hashValues(super.hashCode, baseHashCode); @override RenderComparison compareTo(InlineSpan other) { diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..aaa6f51 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,51 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + characters: + dependency: transitive + description: + name: characters + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.16.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.5" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.8.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.2" +sdks: + dart: ">=2.17.0 <3.0.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index fbb6936..887297e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,8 +4,8 @@ version: 10.0.0 homepage: https://github.com/fluttercandies/extended_text_library environment: - sdk: '>=3.0.0 <4.0.0' - flutter: ">=3.10.0" + sdk: '>=2.17.0 <3.0.0' + flutter: ">=3.0.0" dependencies: flutter: