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
fcd90c0a
Unverified
Commit
fcd90c0a
authored
Mar 31, 2020
by
nujz
Committed by
GitHub
Mar 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ScrollPosition.jumpTo call notifyListeners twice (#53425)
parent
560c7228
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
scroll_position_with_single_context.dart
.../lib/src/widgets/scroll_position_with_single_context.dart
+0
-2
scroll_position_test.dart
packages/flutter/test/widgets/scroll_position_test.dart
+19
-0
No files found.
packages/flutter/lib/src/widgets/scroll_position_with_single_context.dart
View file @
fcd90c0a
...
@@ -198,7 +198,6 @@ class ScrollPositionWithSingleContext extends ScrollPosition implements ScrollAc
...
@@ -198,7 +198,6 @@ class ScrollPositionWithSingleContext extends ScrollPosition implements ScrollAc
if
(
pixels
!=
value
)
{
if
(
pixels
!=
value
)
{
final
double
oldPixels
=
pixels
;
final
double
oldPixels
=
pixels
;
forcePixels
(
value
);
forcePixels
(
value
);
notifyListeners
();
didStartScroll
();
didStartScroll
();
didUpdateScrollPositionBy
(
pixels
-
oldPixels
);
didUpdateScrollPositionBy
(
pixels
-
oldPixels
);
didEndScroll
();
didEndScroll
();
...
@@ -213,7 +212,6 @@ class ScrollPositionWithSingleContext extends ScrollPosition implements ScrollAc
...
@@ -213,7 +212,6 @@ class ScrollPositionWithSingleContext extends ScrollPosition implements ScrollAc
if
(
pixels
!=
value
)
{
if
(
pixels
!=
value
)
{
final
double
oldPixels
=
pixels
;
final
double
oldPixels
=
pixels
;
forcePixels
(
value
);
forcePixels
(
value
);
notifyListeners
();
didStartScroll
();
didStartScroll
();
didUpdateScrollPositionBy
(
pixels
-
oldPixels
);
didUpdateScrollPositionBy
(
pixels
-
oldPixels
);
didEndScroll
();
didEndScroll
();
...
...
packages/flutter/test/widgets/scroll_position_test.dart
View file @
fcd90c0a
...
@@ -141,6 +141,25 @@ Future<void> performTest(WidgetTester tester, bool maintainState) async {
...
@@ -141,6 +141,25 @@ Future<void> performTest(WidgetTester tester, bool maintainState) async {
}
}
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'ScrollPosition jumpTo() doesn
\'
t call notifyListeners twice'
,
(
WidgetTester
tester
)
async
{
int
count
=
0
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Text
(
'
$index
'
,
textDirection:
TextDirection
.
ltr
);
},
),
));
final
ScrollPosition
position
=
tester
.
state
<
ScrollableState
>(
find
.
byType
(
Scrollable
)).
position
;
position
.
addListener
(()
{
count
++;
});
position
.
jumpTo
(
100
);
expect
(
count
,
1
);
});
testWidgets
(
'whether we remember our scroll position'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'whether we remember our scroll position'
,
(
WidgetTester
tester
)
async
{
await
performTest
(
tester
,
true
);
await
performTest
(
tester
,
true
);
await
performTest
(
tester
,
false
);
await
performTest
(
tester
,
false
);
...
...
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