From e04671b6127771d116873ca8709307b9dbd32bc3 Mon Sep 17 00:00:00 2001 From: Dewey Gaedcke Date: Wed, 19 May 2021 23:36:17 -0500 Subject: [PATCH 1/5] updated yaml for null safety --- .../ios/Flutter/flutter_export_environment.sh | 14 +++++++ example/pubspec.lock | 42 +++++++++---------- pubspec.lock | 40 +++++++++--------- pubspec.yaml | 6 +-- 4 files changed, 58 insertions(+), 44 deletions(-) create mode 100755 example/ios/Flutter/flutter_export_environment.sh diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..acc0800 --- /dev/null +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/dgaedcke/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/dgaedcke/dev/OptimizedGestureDetector/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/pubspec.lock b/example/pubspec.lock index b1801b2..6f0f2dc 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety" + version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.2" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.2" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: @@ -56,7 +56,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -73,28 +73,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.2" + version: "1.3.0" optimized_gesture_detector: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.0.6" + version: "0.1.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -106,56 +106,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety" + version: "0.3.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.2" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.2" + version: "2.1.0" sdks: - dart: ">=2.10.0-0.0.dev <2.10.0" - flutter: ">1.21.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=2.2.0-10.3.pre" diff --git a/pubspec.lock b/pubspec.lock index c84e218..7db87da 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety" + version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.2" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.2" + version: "1.15.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -66,21 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.2" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -92,56 +92,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety" + version: "0.3.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.2" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.2" + version: "2.1.0" sdks: - dart: ">=2.10.0-0.0.dev <2.10.0" - flutter: ">1.21.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=2.2.0-10.3.pre" diff --git a/pubspec.yaml b/pubspec.yaml index aa4ef47..d6c02d7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,12 +1,12 @@ name: optimized_gesture_detector description: a optimized class on flutter GestureDector -version: 0.0.6 +version: 0.1.0 author: SunPointed<410338643@qq.com> homepage: https://github.com/SunPointed/OptimizedGestureDetector environment: - sdk: ">=2.1.0 <3.0.0" - flutter: ">1.21.0" + sdk: ">=2.11.0 <3.0.0" + flutter: ">=2.2.0-10.3.pre" dependencies: flutter: From d1e8aa1bb1e7c882322b771b5361c50cdd4c625f Mon Sep 17 00:00:00 2001 From: Dewey Gaedcke Date: Wed, 19 May 2021 23:45:50 -0500 Subject: [PATCH 2/5] migrated to null safety but one test fails; will review tomorrow --- example/lib/main.dart | 55 +++++----- example/test/widget_test.dart | 1 + lib/details.dart | 14 +-- lib/gesture_dectetor.dart | 36 +++---- lib/optimized_gesture_detector.dart | 132 ++++++++++++------------ lib/scale.dart | 150 ++++++++++++++-------------- lib/utils.dart | 2 +- pubspec.yaml | 2 +- 8 files changed, 200 insertions(+), 192 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 021aa97..11de0d8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -8,30 +8,37 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo', - theme: ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or simply save your changes to "hot reload" in a Flutter IDE). - // Notice that the counter didn't reset back to zero; the application - // is not restarted. - primarySwatch: Colors.blue, + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or simply save your changes to "hot reload" in a Flutter IDE). + // Notice that the counter didn't reset back to zero; the application + // is not restarted. + primarySwatch: Colors.blue, + ), + home: Container( + decoration: BoxDecoration(color: Color(0xFFFFFFFF)), + child: Stack( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + children: [ + ConstrainedBox( + constraints: BoxConstraints( + minHeight: double.infinity, + minWidth: double.infinity, + ), + child: OptimizedGestureDetector( + // child: Text('0'), + ), + ) + ], ), - home: Container( - decoration: BoxDecoration(color: Color(0xFFFFFFFF)), - child: Stack( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - children: [ - ConstrainedBox( - constraints: BoxConstraints( - minHeight: double.infinity, - minWidth: double.infinity), - child: OptimizedGestureDetector()) - ]))); + ), + ); } } diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 747db1d..525c3c2 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -15,6 +15,7 @@ void main() { // Build our app and trigger a frame. await tester.pumpWidget(MyApp()); + await tester.pumpAndSettle(); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); diff --git a/lib/details.dart b/lib/details.dart index 1df0987..ec3c299 100644 --- a/lib/details.dart +++ b/lib/details.dart @@ -2,7 +2,7 @@ import 'package:flutter/gestures.dart'; import 'package:optimized_gesture_detector/direction.dart'; class OpsMoveStartDetails { - OpsMoveStartDetails({this.globalPoint = Offset.zero, Offset localPoint}) + OpsMoveStartDetails({this.globalPoint = Offset.zero, Offset? localPoint}) : localPoint = localPoint ?? globalPoint; final Offset localPoint; @@ -10,7 +10,7 @@ class OpsMoveStartDetails { } class OpsMoveUpdateDetails { - OpsMoveUpdateDetails({this.globalPoint = Offset.zero, Offset localPoint}) + OpsMoveUpdateDetails({this.globalPoint = Offset.zero, Offset? localPoint}) : localPoint = localPoint ?? globalPoint; final Offset localPoint; @@ -21,7 +21,7 @@ class OpsMoveEndDetails { OpsMoveEndDetails( {this.velocity = Velocity.zero, this.globalPoint = Offset.zero, - Offset localPoint}) + Offset? localPoint}) : localPoint = localPoint ?? globalPoint; final Velocity velocity; @@ -30,7 +30,7 @@ class OpsMoveEndDetails { } class OpsScaleStartDetails { - OpsScaleStartDetails({this.globalPoint = Offset.zero, Offset localPoint}) + OpsScaleStartDetails({this.globalPoint = Offset.zero, Offset? localPoint}) : localPoint = localPoint ?? globalPoint; final Offset localPoint; @@ -40,8 +40,8 @@ class OpsScaleStartDetails { class OpsScaleUpdateDetails { OpsScaleUpdateDetails( {this.globalFocalPoint = Offset.zero, - Offset localFocalPoint, - Direction mainDirection, + Offset? localFocalPoint, + Direction? mainDirection, this.scale = 1.0, this.horizontalScale = 1.0, this.verticalScale = 1.0, @@ -62,7 +62,7 @@ class OpsScaleEndDetails { OpsScaleEndDetails( {this.velocity = Velocity.zero, this.globalPoint = Offset.zero, - Offset localPoint}) + Offset? localPoint}) : localPoint = localPoint ?? globalPoint; final Velocity velocity; diff --git a/lib/gesture_dectetor.dart b/lib/gesture_dectetor.dart index 1eabd44..c137e35 100644 --- a/lib/gesture_dectetor.dart +++ b/lib/gesture_dectetor.dart @@ -5,7 +5,7 @@ import 'package:optimized_gesture_detector/scale.dart' as scale; class CoreGestureDetector extends StatelessWidget { CoreGestureDetector( - {Key key, + {Key? key, this.child, this.onTapDown, this.onTapUp, @@ -28,19 +28,19 @@ class CoreGestureDetector extends StatelessWidget { /// The widget below this widget in the tree. /// /// {@macro flutter.widgets.child} - final Widget child; + final Widget? child; - final GestureTapDownCallback onTapDown; - final GestureTapUpCallback onTapUp; - final GestureTapCancelCallback onTapCancel; + final GestureTapDownCallback? onTapDown; + final GestureTapUpCallback? onTapUp; + final GestureTapCancelCallback? onTapCancel; - final GestureLongPressStartCallback onLongPressStart; - final GestureLongPressMoveUpdateCallback onLongPressMoveUpdate; - final GestureLongPressEndCallback onLongPressEnd; + final GestureLongPressStartCallback? onLongPressStart; + final GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate; + final GestureLongPressEndCallback? onLongPressEnd; - final scale.GestureScaleStartCallback onScaleStart; - final scale.GestureScaleUpdateCallback onScaleUpdate; - final scale.GestureScaleEndCallback onScaleEnd; + final scale.GestureScaleStartCallback? onScaleStart; + final scale.GestureScaleUpdateCallback? onScaleUpdate; + final scale.GestureScaleEndCallback? onScaleEnd; // /// The pointer is in contact with the screen and has pressed with sufficient // /// force to initiate a force press. The amount of force is at least @@ -77,7 +77,7 @@ class CoreGestureDetector extends StatelessWidget { /// /// This defaults to [HitTestBehavior.deferToChild] if [child] is not null and /// [HitTestBehavior.translucent] if child is null. - final HitTestBehavior behavior; + final HitTestBehavior? behavior; /// Whether to exclude these gestures from the semantics tree. For /// example, the long-press gesture for showing a tooltip is @@ -109,8 +109,8 @@ class CoreGestureDetector extends StatelessWidget { final GestureArenaTeam _team = GestureArenaTeam(); - final CanDragDownFunction canHDragDown; - final CanDragDownFunction canVDragDown; + final CanDragDownFunction? canHDragDown; + final CanDragDownFunction? canVDragDown; @override Widget build(BuildContext context) { @@ -202,16 +202,16 @@ class CoreGestureDetector extends StatelessWidget { ); } - GestureDragDownCallback _gestureVDragDownCallback() { + GestureDragDownCallback? _gestureVDragDownCallback() { if (canVDragDown == null) return null; - return canVDragDown() ? (e) {} : null; + return canVDragDown!() ? (e) {} : null; } - GestureDragDownCallback _gestureHDragDownCallback() { + GestureDragDownCallback? _gestureHDragDownCallback() { if (canHDragDown == null) return null; - return canHDragDown() ? (e) {} : null; + return canHDragDown!() ? (e) {} : null; } @override diff --git a/lib/optimized_gesture_detector.dart b/lib/optimized_gesture_detector.dart index 04cec6c..1eb9f98 100644 --- a/lib/optimized_gesture_detector.dart +++ b/lib/optimized_gesture_detector.dart @@ -19,68 +19,68 @@ class OptimizedGestureDetector extends StatelessWidget { static const Offset ZERO = Offset(0, 0); - final OpsTapDownCallback _tapDownCallback; - final OpsSingleTapUpCallback _singleTapCallback; - final OpsDoubleTapUpCallback _doubleTapCallback; - final OpsDragStartCallback _dragStartCallback; - final OpsDragUpdateCallback _dragUpdateCallback; - final OpsDragEndCallback _dragEndCallback; - final OpsMoveStartCallback _moveStartCallback; - final OpsMoveUpdateCallback _moveUpdateCallback; - final OpsMoveEndCallback _moveEndCallback; - final OpsScaleStartCallback _scaleStartCallback; - final OpsScaleUpdateCallback _scaleUpdateCallback; - final OpsScaleEndCallback _scaleEndCallback; - - final OpsTapCancelCallback _tapCancelCallback; - final OpsMoveCancelCallback _moveCancelCallback; - final OpsScaleCancelCallback _scaleCancelCallback; + final OpsTapDownCallback? _tapDownCallback; + final OpsSingleTapUpCallback? _singleTapCallback; + final OpsDoubleTapUpCallback? _doubleTapCallback; + final OpsDragStartCallback? _dragStartCallback; + final OpsDragUpdateCallback? _dragUpdateCallback; + final OpsDragEndCallback? _dragEndCallback; + final OpsMoveStartCallback? _moveStartCallback; + final OpsMoveUpdateCallback? _moveUpdateCallback; + final OpsMoveEndCallback? _moveEndCallback; + final OpsScaleStartCallback? _scaleStartCallback; + final OpsScaleUpdateCallback? _scaleUpdateCallback; + final OpsScaleEndCallback? _scaleEndCallback; + + final OpsTapCancelCallback? _tapCancelCallback; + final OpsMoveCancelCallback? _moveCancelCallback; + final OpsScaleCancelCallback? _scaleCancelCallback; int _tapDownTime = INITIAL_INT_VALUE; bool _isSingleTap = false; bool _isDoubleTap = false; - bool _isRealScale; + bool? _isRealScale; bool _isMoveCancel = false; bool _isScaleCancel = false; - Timer _singleTapTimer; + Timer? _singleTapTimer; - Direction _scaleMainDirection; + Direction? _scaleMainDirection; - Offset _lastMoveUpdateGolbalPos; - Offset _lastMoveUpdateLocalPos; + Offset? _lastMoveUpdateGolbalPos; + Offset? _lastMoveUpdateLocalPos; - Offset _lastScaleUpdateGolbalPos; - Offset _lastScaleUpdateLocalPos; + Offset? _lastScaleUpdateGolbalPos; + Offset? _lastScaleUpdateLocalPos; - List _scaleTwoKeys = List(); + List _scaleTwoKeys = []; - final Widget child; + final Widget? child; - final gd.CanDragDownFunction _canHDragDown; - final gd.CanDragDownFunction _canVDragDown; + final gd.CanDragDownFunction? _canHDragDown; + final gd.CanDragDownFunction? _canVDragDown; OptimizedGestureDetector( - {Key key, - OpsTapDownCallback tapDown, - OpsSingleTapUpCallback singleTapUp, - OpsTapCancelCallback tapCancel, - OpsDoubleTapUpCallback doubleTapUp, - OpsDragStartCallback dragStart, - OpsDragUpdateCallback dragUpdate, - OpsDragEndCallback dragEnd, - OpsMoveStartCallback moveStart, - OpsMoveCancelCallback moveCancel, - OpsMoveUpdateCallback moveUpdate, - OpsMoveEndCallback moveEnd, - OpsScaleStartCallback scaleStart, - OpsScaleCancelCallback scaleCancel, - OpsScaleUpdateCallback scaleUpdate, - OpsScaleEndCallback scaleEnd, - gd.CanDragDownFunction needHorizontalConflictFunc, - gd.CanDragDownFunction needVerticalConflictFunc, + {Key? key, + OpsTapDownCallback? tapDown, + OpsSingleTapUpCallback? singleTapUp, + OpsTapCancelCallback? tapCancel, + OpsDoubleTapUpCallback? doubleTapUp, + OpsDragStartCallback? dragStart, + OpsDragUpdateCallback? dragUpdate, + OpsDragEndCallback? dragEnd, + OpsMoveStartCallback? moveStart, + OpsMoveCancelCallback? moveCancel, + OpsMoveUpdateCallback? moveUpdate, + OpsMoveEndCallback? moveEnd, + OpsScaleStartCallback? scaleStart, + OpsScaleCancelCallback? scaleCancel, + OpsScaleUpdateCallback? scaleUpdate, + OpsScaleEndCallback? scaleEnd, + gd.CanDragDownFunction? needHorizontalConflictFunc, + gd.CanDragDownFunction? needVerticalConflictFunc, this.child}) : _tapDownCallback = tapDown, _tapCancelCallback = tapCancel, @@ -126,7 +126,7 @@ class OptimizedGestureDetector extends StatelessWidget { } if (_tapDownCallback != null) { - _tapDownCallback(details); + _tapDownCallback!(details); } }, onTapUp: (details) { @@ -157,7 +157,7 @@ class OptimizedGestureDetector extends StatelessWidget { _isDoubleTap = false; _cancelAndResetSingleTapTimer(); if (_tapCancelCallback != null) { - _tapCancelCallback(); + _tapCancelCallback!(); } }, onLongPressStart: (details) { @@ -187,14 +187,14 @@ class OptimizedGestureDetector extends StatelessWidget { _isRealScale = !(details.verticalScale == 1.0 && details.horizontalScale == 1.0 && details.rotation == 0.0); - if (_isRealScale) { + if (_isRealScale!) { _moveCancel(); } else { _scaleCancel(); } } - if (_isRealScale) { + if (_isRealScale!) { _scaleUpdate(details); } else { _moveUpdate(details); @@ -218,14 +218,14 @@ class OptimizedGestureDetector extends StatelessWidget { void _singleTap(TapUpDetails details) { Util.L1("_singleTap", details); if (_singleTapCallback != null) { - _singleTapCallback(details); + _singleTapCallback!(details); } } void _doubleTap(TapUpDetails details) { Util.L1("_doubleTap", details); if (_doubleTapCallback != null) { - _doubleTapCallback(details); + _doubleTapCallback!(details); } } @@ -233,21 +233,21 @@ class OptimizedGestureDetector extends StatelessWidget { void _dragStart(LongPressStartDetails details) { Util.L1("_dragStart", details); if (_dragStartCallback != null) { - _dragStartCallback(details); + _dragStartCallback!(details); } } void _dragUpdate(LongPressMoveUpdateDetails details) { Util.L1("_dragUpdate", details); if (_dragUpdateCallback != null) { - _dragUpdateCallback(details); + _dragUpdateCallback!(details); } } void _dragEnd(LongPressEndDetails details) { Util.L1("_dragEnd", details); if (_dragEndCallback != null) { - _dragEndCallback(details); + _dragEndCallback!(details); } } @@ -256,14 +256,14 @@ class OptimizedGestureDetector extends StatelessWidget { Util.L1("_moveStart", details); _resetLastMoveUpdatePos(); if (_moveStartCallback != null) { - _moveStartCallback(DetailsUtils.toOpsMoveStartDetails(details)); + _moveStartCallback!(DetailsUtils.toOpsMoveStartDetails(details)); } } void _moveUpdate(scale.OpsSUpdateDetails details) { Util.L1("_moveUpdate", details); if (_moveUpdateCallback != null) { - _moveUpdateCallback(DetailsUtils.toOpsMoveUpdateDetails(details)); + _moveUpdateCallback!(DetailsUtils.toOpsMoveUpdateDetails(details)); } _lastMoveUpdateGolbalPos = details.focalPoint; _lastMoveUpdateLocalPos = details.localFocalPoint; @@ -272,7 +272,7 @@ class OptimizedGestureDetector extends StatelessWidget { void _moveEnd(scale.OpsSEndDetails details) { Util.L1("_moveEnd", details); if (_moveEndCallback != null) { - _moveEndCallback(DetailsUtils.toOpsMoveEndDetails(details, + _moveEndCallback!(DetailsUtils.toOpsMoveEndDetails(details, _lastMoveUpdateGolbalPos ?? ZERO, _lastMoveUpdateLocalPos ?? ZERO)); } _resetLastMoveUpdatePos(); @@ -283,7 +283,7 @@ class OptimizedGestureDetector extends StatelessWidget { _isMoveCancel = true; _resetLastMoveUpdatePos(); if (_moveCancelCallback != null) { - _moveCancelCallback(); + _moveCancelCallback!(); } } @@ -293,16 +293,16 @@ class OptimizedGestureDetector extends StatelessWidget { _resetScaleDirection(); _resetLastScaleUpdatePos(); if (_scaleStartCallback != null) { - _scaleStartCallback(DetailsUtils.toOpsScaleStartDetails(details)); + _scaleStartCallback!(DetailsUtils.toOpsScaleStartDetails(details)); } } void _scaleUpdate(scale.OpsSUpdateDetails details) { Util.L1("_scaleUpdate", details); - if (details.globalPointerLocations.length >= 2) { + if (details.globalPointerLocations!.length >= 2) { if (_scaleTwoKeys.isEmpty) { - details.globalPointerLocations.forEach((k, v) { + details.globalPointerLocations!.forEach((k, v) { if (_scaleTwoKeys.length < 2) { _scaleTwoKeys.add(k); } @@ -312,13 +312,13 @@ class OptimizedGestureDetector extends StatelessWidget { if (_scaleTwoKeys.length >= 2) { if (_scaleMainDirection == null) { _scaleMainDirection = getCurrentDirection( - details.globalPointerLocations[_scaleTwoKeys[0]], - details.globalPointerLocations[_scaleTwoKeys[1]]); + details.globalPointerLocations![_scaleTwoKeys[0]]!, + details.globalPointerLocations![_scaleTwoKeys[1]]!); } Util.L2("direction $_scaleMainDirection"); if (_scaleUpdateCallback != null) { - _scaleUpdateCallback(DetailsUtils.toOpsScaleUpdateDetails( + _scaleUpdateCallback!(DetailsUtils.toOpsScaleUpdateDetails( details, _scaleMainDirection)); } } @@ -331,7 +331,7 @@ class OptimizedGestureDetector extends StatelessWidget { Util.L1("_scaleEnd", details); _resetScaleDirection(); if (_scaleEndCallback != null) { - _scaleEndCallback(DetailsUtils.toOpsScaleEndDetails(details, + _scaleEndCallback!(DetailsUtils.toOpsScaleEndDetails(details, _lastScaleUpdateGolbalPos ?? ZERO, _lastScaleUpdateLocalPos ?? ZERO)); } _resetLastScaleUpdatePos(); @@ -343,7 +343,7 @@ class OptimizedGestureDetector extends StatelessWidget { _resetScaleDirection(); _resetLastScaleUpdatePos(); if (_scaleCancelCallback != null) { - _scaleCancelCallback(); + _scaleCancelCallback!(); } } diff --git a/lib/scale.dart b/lib/scale.dart index dc25087..740a0af 100644 --- a/lib/scale.dart +++ b/lib/scale.dart @@ -42,12 +42,12 @@ class OpsSStartDetails { this.globalPointerLocations, this.localPointerLocations, this.focalPoint = Offset.zero, - Offset localFocalPoint, + Offset? localFocalPoint, }) : assert(focalPoint != null), localFocalPoint = localFocalPoint ?? focalPoint; - final Map globalPointerLocations; - final Map localPointerLocations; + final Map? globalPointerLocations; + final Map? localPointerLocations; final Offset focalPoint; final Offset localFocalPoint; @@ -67,7 +67,7 @@ class OpsSUpdateDetails { this.globalPointerLocations, this.localPointerLocations, this.focalPoint = Offset.zero, - Offset localFocalPoint, + Offset? localFocalPoint, this.scale = 1.0, this.horizontalScale = 1.0, this.verticalScale = 1.0, @@ -79,8 +79,8 @@ class OpsSUpdateDetails { assert(rotation != null), localFocalPoint = localFocalPoint ?? focalPoint; - final Map globalPointerLocations; - final Map localPointerLocations; + final Map? globalPointerLocations; + final Map? localPointerLocations; final Offset focalPoint; final Offset localFocalPoint; final double scale; @@ -104,8 +104,8 @@ class OpsSEndDetails { this.velocity = Velocity.zero}) : assert(velocity != null); - final Map globalPointerLocations; - final Map localPointerLocations; + final Map? globalPointerLocations; + final Map? localPointerLocations; /// The velocity of the last pointer to be lifted off of the screen. final Velocity velocity; @@ -139,11 +139,11 @@ class _LineBetweenPointers { assert(pointerStartId != pointerEndId); // The location and the id of the pointer that marks the start of the line. - final Offset pointerStartLocation; + final Offset? pointerStartLocation; final int pointerStartId; // The location and the id of the pointer that marks the end of the line. - final Offset pointerEndLocation; + final Offset? pointerEndLocation; final int pointerEndId; } @@ -159,63 +159,63 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { /// /// {@macro flutter.gestures.gestureRecognizer.kind} OpsScaleGestureRecognizer({ - Object debugOwner, - PointerDeviceKind kind, + Object? debugOwner, + PointerDeviceKind? kind, }) : super(debugOwner: debugOwner, kind: kind); /// The pointers in contact with the screen have established a focal point and /// initial scale of 1.0. - GestureScaleStartCallback onStart; + GestureScaleStartCallback? onStart; /// The pointers in contact with the screen have indicated a new focal point /// and/or scale. - GestureScaleUpdateCallback onUpdate; + GestureScaleUpdateCallback? onUpdate; /// The pointers are no longer in contact with the screen. - GestureScaleEndCallback onEnd; + GestureScaleEndCallback? onEnd; _ScaleState _state = _ScaleState.ready; - Matrix4 _lastTransform; - - Offset _initialFocalPoint; - Offset _currentFocalPoint; - double _initialSpan; - double _currentSpan; - double _initialHorizontalSpan; - double _currentHorizontalSpan; - double _initialVerticalSpan; - double _currentVerticalSpan; - _LineBetweenPointers _initialLine; - _LineBetweenPointers _currentLine; - Map _pointerLocations; - List _pointerQueue; // A queue to sort pointers in order of entrance + Matrix4? _lastTransform; + + Offset? _initialFocalPoint; + Offset? _currentFocalPoint; + double? _initialSpan; + double? _currentSpan; + double? _initialHorizontalSpan; + double? _currentHorizontalSpan; + double? _initialVerticalSpan; + double? _currentVerticalSpan; + _LineBetweenPointers? _initialLine; + _LineBetweenPointers? _currentLine; + Map? _pointerLocations; + late List _pointerQueue; // A queue to sort pointers in order of entrance final Map _velocityTrackers = {}; double get _scaleFactor => - _initialSpan > 0.0 ? _currentSpan / _initialSpan : 1.0; + _initialSpan! > 0.0 ? _currentSpan! / _initialSpan! : 1.0; - double get _horizontalScaleFactor => _initialHorizontalSpan > 0.0 - ? _currentHorizontalSpan / _initialHorizontalSpan + double get _horizontalScaleFactor => _initialHorizontalSpan! > 0.0 + ? _currentHorizontalSpan! / _initialHorizontalSpan! : 1.0; - double get _verticalScaleFactor => _initialVerticalSpan > 0.0 - ? _currentVerticalSpan / _initialVerticalSpan + double get _verticalScaleFactor => _initialVerticalSpan! > 0.0 + ? _currentVerticalSpan! / _initialVerticalSpan! : 1.0; double _computeRotationFactor() { if (_initialLine == null || _currentLine == null) { return 0.0; } - final double fx = _initialLine.pointerStartLocation.dx; - final double fy = _initialLine.pointerStartLocation.dy; - final double sx = _initialLine.pointerEndLocation.dx; - final double sy = _initialLine.pointerEndLocation.dy; + final double fx = _initialLine!.pointerStartLocation!.dx; + final double fy = _initialLine!.pointerStartLocation!.dy; + final double sx = _initialLine!.pointerEndLocation!.dx; + final double sy = _initialLine!.pointerEndLocation!.dy; - final double nfx = _currentLine.pointerStartLocation.dx; - final double nfy = _currentLine.pointerStartLocation.dy; - final double nsx = _currentLine.pointerEndLocation.dx; - final double nsy = _currentLine.pointerEndLocation.dy; + final double nfx = _currentLine!.pointerStartLocation!.dx; + final double nfy = _currentLine!.pointerStartLocation!.dy; + final double nsx = _currentLine!.pointerEndLocation!.dx; + final double nsy = _currentLine!.pointerEndLocation!.dy; final double angle1 = math.atan2(fy - sy, fx - sx); final double angle2 = math.atan2(nfy - nsy, nfx - nsx); @@ -246,21 +246,21 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { bool didChangeConfiguration = false; bool shouldStartIfAccepted = false; if (event is PointerMoveEvent) { - final VelocityTracker tracker = _velocityTrackers[event.pointer]; + final VelocityTracker tracker = _velocityTrackers[event.pointer]!; assert(tracker != null); if (!event.synthesized) tracker.addPosition(event.timeStamp, event.position); - _pointerLocations[event.pointer] = event.position; + _pointerLocations![event.pointer] = event.position; shouldStartIfAccepted = true; _lastTransform = event.transform; } else if (event is PointerDownEvent) { - _pointerLocations[event.pointer] = event.position; + _pointerLocations![event.pointer] = event.position; _pointerQueue.add(event.pointer); didChangeConfiguration = true; shouldStartIfAccepted = true; _lastTransform = event.transform; } else if (event is PointerUpEvent || event is PointerCancelEvent) { - _pointerLocations.remove(event.pointer); + _pointerLocations!.remove(event.pointer); _pointerQueue.remove(event.pointer); didChangeConfiguration = true; _lastTransform = event.transform; @@ -275,12 +275,12 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { } void _update() { - final int count = _pointerLocations.keys.length; + final int count = _pointerLocations!.keys.length; // Compute the focal point Offset focalPoint = Offset.zero; - for (int pointer in _pointerLocations.keys) { - focalPoint += _pointerLocations[pointer]; + for (int pointer in _pointerLocations!.keys) { + focalPoint += _pointerLocations![pointer]!; } _currentFocalPoint = count > 0 ? focalPoint / count.toDouble() : Offset.zero; @@ -291,13 +291,13 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { double totalDeviation = 0.0; double totalHorizontalDeviation = 0.0; double totalVerticalDeviation = 0.0; - for (int pointer in _pointerLocations.keys) { + for (int pointer in _pointerLocations!.keys) { totalDeviation += - (_currentFocalPoint - _pointerLocations[pointer]).distance; + (_currentFocalPoint! - _pointerLocations![pointer]!).distance; totalHorizontalDeviation += - (_currentFocalPoint.dx - _pointerLocations[pointer].dx).abs(); + (_currentFocalPoint!.dx - _pointerLocations![pointer]!.dx).abs(); totalVerticalDeviation += - (_currentFocalPoint.dy - _pointerLocations[pointer].dy).abs(); + (_currentFocalPoint!.dy - _pointerLocations![pointer]!.dy).abs(); } _currentSpan = count > 0 ? totalDeviation / count : 0.0; _currentHorizontalSpan = count > 0 ? totalHorizontalDeviation / count : 0.0; @@ -307,29 +307,29 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { /// Updates [_initialLine] and [_currentLine] accordingly to the situation of /// the registered pointers void _updateLines() { - final int count = _pointerLocations.keys.length; + final int count = _pointerLocations!.keys.length; assert(_pointerQueue.length >= count); /// In case of just one pointer registered, reconfigure [_initialLine] if (count < 2) { _initialLine = _currentLine; } else if (_initialLine != null && - _initialLine.pointerStartId == _pointerQueue[0] && - _initialLine.pointerEndId == _pointerQueue[1]) { + _initialLine!.pointerStartId == _pointerQueue[0] && + _initialLine!.pointerEndId == _pointerQueue[1]) { /// Rotation updated, set the [_currentLine] _currentLine = _LineBetweenPointers( pointerStartId: _pointerQueue[0], - pointerStartLocation: _pointerLocations[_pointerQueue[0]], + pointerStartLocation: _pointerLocations![_pointerQueue[0]], pointerEndId: _pointerQueue[1], - pointerEndLocation: _pointerLocations[_pointerQueue[1]], + pointerEndLocation: _pointerLocations![_pointerQueue[1]], ); } else { /// A new rotation process is on the way, set the [_initialLine] _initialLine = _LineBetweenPointers( pointerStartId: _pointerQueue[0], - pointerStartLocation: _pointerLocations[_pointerQueue[0]], + pointerStartLocation: _pointerLocations![_pointerQueue[0]], pointerEndId: _pointerQueue[1], - pointerEndLocation: _pointerLocations[_pointerQueue[1]], + pointerEndLocation: _pointerLocations![_pointerQueue[1]], ); _currentLine = null; } @@ -343,7 +343,7 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { _initialVerticalSpan = _currentVerticalSpan; if (_state == _ScaleState.started) { if (onEnd != null) { - final VelocityTracker tracker = _velocityTrackers[pointer]; + final VelocityTracker tracker = _velocityTrackers[pointer]!; assert(tracker != null); Velocity velocity = tracker.getVelocity(); @@ -356,16 +356,16 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { kMaxFlingVelocity); invokeCallback( 'onEnd', - () => onEnd(OpsSEndDetails( + () => onEnd!(OpsSEndDetails( globalPointerLocations: _pointerLocations, - localPointerLocations: toLocalLocations(_pointerLocations), + localPointerLocations: toLocalLocations(_pointerLocations!), velocity: velocity))); } else { invokeCallback( 'onEnd', - () => onEnd(OpsSEndDetails( + () => onEnd!(OpsSEndDetails( globalPointerLocations: _pointerLocations, - localPointerLocations: toLocalLocations(_pointerLocations), + localPointerLocations: toLocalLocations(_pointerLocations!), velocity: Velocity.zero))); } } @@ -379,9 +379,9 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { if (_state == _ScaleState.ready) _state = _ScaleState.possible; if (_state == _ScaleState.possible) { - final double spanDelta = (_currentSpan - _initialSpan).abs(); + final double spanDelta = (_currentSpan! - _initialSpan!).abs(); final double focalPointDelta = - (_currentFocalPoint - _initialFocalPoint).distance; + (_currentFocalPoint! - _initialFocalPoint!).distance; if (spanDelta > kScaleSlop || focalPointDelta > kPanSlop) resolve(GestureDisposition.accepted); } else if (_state.index >= _ScaleState.accepted.index) { @@ -395,15 +395,15 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { if (_state == _ScaleState.started && onUpdate != null) invokeCallback('onUpdate', () { - onUpdate(OpsSUpdateDetails( + onUpdate!(OpsSUpdateDetails( globalPointerLocations: _pointerLocations, - localPointerLocations: toLocalLocations(_pointerLocations), + localPointerLocations: toLocalLocations(_pointerLocations!), scale: _scaleFactor, horizontalScale: _horizontalScaleFactor, verticalScale: _verticalScaleFactor, - focalPoint: _currentFocalPoint, + focalPoint: _currentFocalPoint!, localFocalPoint: PointerEvent.transformPosition( - _lastTransform, _currentFocalPoint), + _lastTransform, _currentFocalPoint!), rotation: _computeRotationFactor(), )); }); @@ -413,12 +413,12 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { assert(_state == _ScaleState.started); if (onStart != null) invokeCallback('onStart', () { - onStart(OpsSStartDetails( + onStart!(OpsSStartDetails( globalPointerLocations: _pointerLocations, - localPointerLocations: toLocalLocations(_pointerLocations), - focalPoint: _currentFocalPoint, + localPointerLocations: toLocalLocations(_pointerLocations!), + focalPoint: _currentFocalPoint!, localFocalPoint: PointerEvent.transformPosition( - _lastTransform, _currentFocalPoint), + _lastTransform, _currentFocalPoint!), )); }); } diff --git a/lib/utils.dart b/lib/utils.dart index 8e20a75..857a6ad 100644 --- a/lib/utils.dart +++ b/lib/utils.dart @@ -28,7 +28,7 @@ class DetailsUtils { } static OpsScaleUpdateDetails toOpsScaleUpdateDetails( - OpsSUpdateDetails details, Direction mainDirection) { + OpsSUpdateDetails details, Direction? mainDirection) { return OpsScaleUpdateDetails( globalFocalPoint: details.focalPoint, localFocalPoint: details.localFocalPoint, diff --git a/pubspec.yaml b/pubspec.yaml index d6c02d7..743041f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ author: SunPointed<410338643@qq.com> homepage: https://github.com/SunPointed/OptimizedGestureDetector environment: - sdk: ">=2.11.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' flutter: ">=2.2.0-10.3.pre" dependencies: From c875be9a4cfa4249dfc46b9c4faf79ba9e085bb0 Mon Sep 17 00:00:00 2001 From: Dewey Gaedcke Date: Wed, 19 May 2021 23:49:33 -0500 Subject: [PATCH 3/5] bumped version in both yaml files --- example/pubspec.lock | 2 +- example/pubspec.yaml | 7 ++++--- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 6f0f2dc..bbc88d8 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -87,7 +87,7 @@ packages: path: ".." relative: true source: path - version: "0.1.0" + version: "0.2.0" path: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 072a683..bf316d7 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,5 +1,5 @@ name: example -description: A new Flutter application. +description: Gesture Detector Demo # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -11,10 +11,11 @@ description: A new Flutter application. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 +version: 1.1.0+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' + flutter: ">=2.2.0-10.3.pre" dependencies: flutter: diff --git a/pubspec.yaml b/pubspec.yaml index 743041f..740a0a6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: optimized_gesture_detector description: a optimized class on flutter GestureDector -version: 0.1.0 +version: 0.2.0 author: SunPointed<410338643@qq.com> homepage: https://github.com/SunPointed/OptimizedGestureDetector From 55f6b4f6d823e99b85fceb6918fe87e019918080 Mon Sep 17 00:00:00 2001 From: Dewey Gaedcke Date: Wed, 26 Oct 2022 01:00:26 -0500 Subject: [PATCH 4/5] updated deps & version --- example/pubspec.yaml | 4 ++-- lib/scale.dart | 5 ++--- pubspec.lock | 50 +++++++++++++++++++------------------------- pubspec.yaml | 6 +++--- 4 files changed, 28 insertions(+), 37 deletions(-) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index bf316d7..9b2156a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -14,8 +14,8 @@ description: Gesture Detector Demo version: 1.1.0+1 environment: - sdk: '>=2.12.0 <3.0.0' - flutter: ">=2.2.0-10.3.pre" + sdk: '>=2.16.0 <3.0.0' + # flutter: ">=2.2.0-10.3.pre" dependencies: flutter: diff --git a/lib/scale.dart b/lib/scale.dart index 740a0af..363ec60 100644 --- a/lib/scale.dart +++ b/lib/scale.dart @@ -8,8 +8,7 @@ typedef GestureScaleStartCallback = void Function(OpsSStartDetails details); /// Signature for when the pointers in contact with the screen have indicated a /// new focal point and/or scale. -typedef GestureScaleUpdateCallback = void Function( - OpsSUpdateDetails details); +typedef GestureScaleUpdateCallback = void Function(OpsSUpdateDetails details); /// Signature for when the pointers are no longer in contact with the screen. typedef GestureScaleEndCallback = void Function(OpsSEndDetails details); @@ -226,7 +225,7 @@ class OpsScaleGestureRecognizer extends OneSequenceGestureRecognizer { @override void addAllowedPointer(PointerEvent event) { startTrackingPointer(event.pointer, event.transform); - _velocityTrackers[event.pointer] = VelocityTracker(event.kind); + _velocityTrackers[event.pointer] = VelocityTracker.withKind(event.kind); if (_state == _ScaleState.ready) { _state = _ScaleState.possible; _initialSpan = 0.0; diff --git a/pubspec.lock b/pubspec.lock index 7db87da..e15edce 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,35 +21,28 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -66,21 +59,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -92,7 +92,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -113,35 +113,27 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=2.2.0-10.3.pre" + dart: ">=2.17.0-0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 740a0a6..98363c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,12 +1,12 @@ name: optimized_gesture_detector description: a optimized class on flutter GestureDector -version: 0.2.0 +version: 0.2.1 author: SunPointed<410338643@qq.com> homepage: https://github.com/SunPointed/OptimizedGestureDetector environment: - sdk: '>=2.12.0 <3.0.0' - flutter: ">=2.2.0-10.3.pre" + sdk: '>=2.16.0 <3.0.0' + # flutter: ">=2.2.0-10.3.pre" dependencies: flutter: From d27b2753de57fde0b55c9e0ef48e9b7d2ec21ec2 Mon Sep 17 00:00:00 2001 From: Dewey Gaedcke Date: Wed, 15 Mar 2023 13:05:30 -0500 Subject: [PATCH 5/5] upgraded deps --- .../ios/Flutter/flutter_export_environment.sh | 9 +- example/pubspec.lock | 118 ++++++++++-------- pubspec.lock | 83 +++++++----- pubspec.yaml | 6 +- 4 files changed, 129 insertions(+), 87 deletions(-) diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index acc0800..0965f08 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,14 +1,13 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=/Users/dgaedcke/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/dgaedcke/dev/OptimizedGestureDetector/example" +export "FLUTTER_APPLICATION_PATH=/Users/dgaedcke/dev/Touchstone/OptimizedGestureDetector/example" export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NAME=1.1.0" export "FLUTTER_BUILD_NUMBER=1" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=false" +export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.packages" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/example/pubspec.lock b/example/pubspec.lock index bbc88d8..ab1dc44 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,58 +5,58 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.17.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: a937da4c006989739ceb4d10e3bd6cce64ca85d0fe287fc5b2b9f6ee757dcee6 + url: "https://pub.dev" source: hosted version: "0.1.3" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -67,34 +67,53 @@ packages: description: flutter source: sdk version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" + source: hosted + version: "0.6.5" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" + source: hosted + version: "0.12.13" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.12.10" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.8.0" optimized_gesture_detector: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.2.0" + version: "0.3.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -104,58 +123,57 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.0" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "0.4.16" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.4" sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=2.2.0-10.3.pre" + dart: ">=2.19.2 <3.0.0" diff --git a/pubspec.lock b/pubspec.lock index e15edce..a3f9298 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,42 +5,48 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.10.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + url: "https://pub.dev" source: hosted version: "1.2.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" flutter: @@ -53,32 +59,44 @@ packages: description: flutter source: sdk version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + url: "https://pub.dev" + source: hosted + version: "0.6.5" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.13" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted version: "1.8.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted version: "1.8.2" sky_engine: @@ -90,50 +108,57 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.4.16" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" sdks: - dart: ">=2.17.0-0 <3.0.0" + dart: ">=2.19.2 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 98363c7..b4c46b0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,12 +1,12 @@ name: optimized_gesture_detector description: a optimized class on flutter GestureDector -version: 0.2.1 +version: 0.3.0 author: SunPointed<410338643@qq.com> homepage: https://github.com/SunPointed/OptimizedGestureDetector environment: - sdk: '>=2.16.0 <3.0.0' - # flutter: ">=2.2.0-10.3.pre" + sdk: ">=2.19.2 <3.0.0" + # flutter: ">=2.2.0-10.3.pre" dependencies: flutter: