Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
b619b701
Unverified
Commit
b619b701
authored
Dec 07, 2023
by
Kostia Sokolovskyi
Committed by
GitHub
Dec 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MultiDragPointerState should dispatch creation and disposal events. (#138807)
parent
81e390c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletion
+47
-1
multidrag.dart
packages/flutter/lib/src/gestures/multidrag.dart
+16
-1
multidrag_test.dart
packages/flutter/test/gestures/multidrag_test.dart
+31
-0
No files found.
packages/flutter/lib/src/gestures/multidrag.dart
View file @
b619b701
...
...
@@ -33,7 +33,17 @@ typedef GestureMultiDragStartCallback = Drag? Function(Offset position);
abstract
class
MultiDragPointerState
{
/// Creates per-pointer state for a [MultiDragGestureRecognizer].
MultiDragPointerState
(
this
.
initialPosition
,
this
.
kind
,
this
.
gestureSettings
)
:
_velocityTracker
=
VelocityTracker
.
withKind
(
kind
);
:
_velocityTracker
=
VelocityTracker
.
withKind
(
kind
)
{
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectCreated
(
library
:
'package:flutter/gestures.dart'
,
className:
'
$MultiDragPointerState
'
,
object:
this
,
);
}
}
/// Device specific gesture configuration that should be preferred over
/// framework constants.
...
...
@@ -178,6 +188,11 @@ abstract class MultiDragPointerState {
@protected
@mustCallSuper
void
dispose
()
{
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectDisposed
(
object:
this
);
}
_arenaEntry
?.
resolve
(
GestureDisposition
.
rejected
);
_arenaEntry
=
null
;
assert
(()
{
...
...
packages/flutter/test/gestures/multidrag_test.dart
View file @
b619b701
...
...
@@ -4,6 +4,7 @@
import
'package:flutter/gestures.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
import
'gesture_tester.dart'
;
...
...
@@ -111,4 +112,34 @@ void main() {
// ignore: invalid_use_of_protected_member
expect
(
recognizer2
.
isPointerAllowed
(
rejectedPointer
),
false
);
});
test
(
'
$MultiDragPointerState
dispatches memory events'
,
()
async
{
await
expectLater
(
await
memoryEvents
(
()
=>
_MultiDragPointerState
(
Offset
.
zero
,
PointerDeviceKind
.
touch
,
null
,
).
dispose
(),
_MultiDragPointerState
,
),
areCreateAndDispose
,
);
});
}
class
_MultiDragPointerState
extends
MultiDragPointerState
{
_MultiDragPointerState
(
super
.
initialPosition
,
super
.
kind
,
super
.
gestureSettings
,
);
@override
void
accepted
(
GestureMultiDragStartCallback
starter
)
{}
@override
void
dispose
()
{
super
.
dispose
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment