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
4880aab1
Unverified
Commit
4880aab1
authored
Nov 06, 2023
by
Kostia Sokolovskyi
Committed by
GitHub
Nov 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ScrollActivity should dispatch creation and disposal events. (#137961)
parent
2d9a075d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
1 deletion
+57
-1
scroll_activity.dart
packages/flutter/lib/src/widgets/scroll_activity.dart
+17
-1
scroll_activity_test.dart
packages/flutter/test/widgets/scroll_activity_test.dart
+40
-0
No files found.
packages/flutter/lib/src/widgets/scroll_activity.dart
View file @
4880aab1
...
...
@@ -57,7 +57,17 @@ abstract class ScrollActivityDelegate {
/// [ScrollPosition] of a [Scrollable].
abstract
class
ScrollActivity
{
/// Initializes [delegate] for subclasses.
ScrollActivity
(
this
.
_delegate
);
ScrollActivity
(
this
.
_delegate
)
{
// 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:
'
$ScrollActivity
'
,
object:
this
,
);
}
}
/// The delegate that this activity will use to actuate the scroll view.
ScrollActivityDelegate
get
delegate
=>
_delegate
;
...
...
@@ -137,6 +147,12 @@ abstract class ScrollActivity {
/// Called when the scroll view stops performing this activity.
@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
);
}
_isDisposed
=
true
;
}
...
...
packages/flutter/test/widgets/scroll_activity_test.dart
View file @
4880aab1
...
...
@@ -212,6 +212,16 @@ void main() {
expect
(
lastTapped
,
equals
(
3
));
await
tester
.
pumpAndSettle
();
});
test
(
'
$ScrollActivity
dispatches memory events'
,
()
async
{
await
expectLater
(
await
memoryEvents
(
()
=>
_ScrollActivity
(
_ScrollActivityDelegate
()).
dispose
(),
_ScrollActivity
,
),
areCreateAndDispose
,
);
});
}
class
PageView62209
extends
StatefulWidget
{
...
...
@@ -359,3 +369,33 @@ class _Carousel62209State extends State<Carousel62209> {
);
}
}
class
_ScrollActivity
extends
ScrollActivity
{
_ScrollActivity
(
super
.
delegate
);
@override
bool
get
isScrolling
=>
false
;
@override
bool
get
shouldIgnorePointer
=>
true
;
@override
double
get
velocity
=>
0.0
;
}
class
_ScrollActivityDelegate
extends
ScrollActivityDelegate
{
@override
void
applyUserOffset
(
double
delta
)
{}
@override
AxisDirection
get
axisDirection
=>
AxisDirection
.
down
;
@override
void
goBallistic
(
double
velocity
)
{}
@override
void
goIdle
()
{}
@override
double
setPixels
(
double
pixels
)
=>
0.0
;
}
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