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
6d4d0123
Unverified
Commit
6d4d0123
authored
Dec 07, 2023
by
Kostia Sokolovskyi
Committed by
GitHub
Dec 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ScrollDragController should dispatch creation and disposal events. (#138800)
parent
67841354
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
scroll_activity.dart
packages/flutter/lib/src/widgets/scroll_activity.dart
+16
-1
scroll_activity_test.dart
packages/flutter/test/widgets/scroll_activity_test.dart
+13
-0
No files found.
packages/flutter/lib/src/widgets/scroll_activity.dart
View file @
6d4d0123
...
@@ -261,7 +261,17 @@ class ScrollDragController implements Drag {
...
@@ -261,7 +261,17 @@ class ScrollDragController implements Drag {
_retainMomentum
=
carriedVelocity
!=
null
&&
carriedVelocity
!=
0.0
,
_retainMomentum
=
carriedVelocity
!=
null
&&
carriedVelocity
!=
0.0
,
_lastNonStationaryTimestamp
=
details
.
sourceTimeStamp
,
_lastNonStationaryTimestamp
=
details
.
sourceTimeStamp
,
_kind
=
details
.
kind
,
_kind
=
details
.
kind
,
_offsetSinceLastStop
=
motionStartDistanceThreshold
==
null
?
null
:
0.0
;
_offsetSinceLastStop
=
motionStartDistanceThreshold
==
null
?
null
:
0.0
{
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectCreated
(
library
:
'package:flutter/widgets.dart'
,
className:
'
$ScrollDragController
'
,
object:
this
,
);
}
}
/// The object that will actuate the scroll view as the user drags.
/// The object that will actuate the scroll view as the user drags.
ScrollActivityDelegate
get
delegate
=>
_delegate
;
ScrollActivityDelegate
get
delegate
=>
_delegate
;
...
@@ -437,6 +447,11 @@ class ScrollDragController implements Drag {
...
@@ -437,6 +447,11 @@ class ScrollDragController implements Drag {
/// Called by the delegate when it is no longer sending events to this object.
/// Called by the delegate when it is no longer sending events to this object.
@mustCallSuper
@mustCallSuper
void
dispose
()
{
void
dispose
()
{
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if
(
kFlutterMemoryAllocationsEnabled
)
{
MemoryAllocations
.
instance
.
dispatchObjectDisposed
(
object:
this
);
}
_lastDetails
=
null
;
_lastDetails
=
null
;
onDragCanceled
?.
call
();
onDragCanceled
?.
call
();
}
}
...
...
packages/flutter/test/widgets/scroll_activity_test.dart
View file @
6d4d0123
...
@@ -222,6 +222,19 @@ void main() {
...
@@ -222,6 +222,19 @@ void main() {
areCreateAndDispose
,
areCreateAndDispose
,
);
);
});
});
test
(
'
$ScrollDragController
dispatches memory events'
,
()
async
{
await
expectLater
(
await
memoryEvents
(
()
=>
ScrollDragController
(
delegate:
_ScrollActivityDelegate
(),
details:
DragStartDetails
(),
).
dispose
(),
ScrollDragController
,
),
areCreateAndDispose
,
);
});
}
}
class
PageView62209
extends
StatefulWidget
{
class
PageView62209
extends
StatefulWidget
{
...
...
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