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
7b33efb6
Commit
7b33efb6
authored
Sep 01, 2017
by
Ian Hickson
Committed by
GitHub
Sep 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fixed TrackingScrollController cleaning offset on position's detach (#11798)" (#11897)
This reverts commit
ec25f6bd
.
parent
ec25f6bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
66 deletions
+2
-66
AUTHORS
AUTHORS
+0
-1
scroll_controller.dart
packages/flutter/lib/src/widgets/scroll_controller.dart
+2
-8
tracking_scroll_controller_test.dart
...flutter/test/widgets/tracking_scroll_controller_test.dart
+0
-57
No files found.
AUTHORS
View file @
7b33efb6
...
...
@@ -15,4 +15,3 @@ Alexandre Ardhuin <alexandre.ardhuin@gmail.com>
Luke Freeman <luke@goposse.com>
Vincent Le Quéméner <eu.lequem@gmail.com>
Mike Hoolehan <mike@hoolehan.com>
German Saprykin <saprykin.h@gmail.com>
packages/flutter/lib/src/widgets/scroll_controller.dart
View file @
7b33efb6
...
...
@@ -323,7 +323,6 @@ class TrackingScrollController extends ScrollController {
final
Map
<
ScrollPosition
,
VoidCallback
>
_positionToListener
=
<
ScrollPosition
,
VoidCallback
>{};
ScrollPosition
_lastUpdated
;
double
_lastUpdatedOffset
;
/// The last [ScrollPosition] to change. Returns null if there aren't any
/// attached scroll positions, or there hasn't been any scrolling yet, or the
...
...
@@ -337,16 +336,13 @@ class TrackingScrollController extends ScrollController {
///
/// * [ScrollController.initialScrollOffset], which this overrides.
@override
double
get
initialScrollOffset
=>
_lastUpdated
Offset
??
super
.
initialScrollOffset
;
double
get
initialScrollOffset
=>
_lastUpdated
?.
pixels
??
super
.
initialScrollOffset
;
@override
void
attach
(
ScrollPosition
position
)
{
super
.
attach
(
position
);
assert
(!
_positionToListener
.
containsKey
(
position
));
_positionToListener
[
position
]
=
()
{
_lastUpdated
=
position
;
_lastUpdatedOffset
=
position
.
pixels
;
};
_positionToListener
[
position
]
=
()
{
_lastUpdated
=
position
;
};
position
.
addListener
(
_positionToListener
[
position
]);
}
...
...
@@ -358,8 +354,6 @@ class TrackingScrollController extends ScrollController {
_positionToListener
.
remove
(
position
);
if
(
_lastUpdated
==
position
)
_lastUpdated
=
null
;
if
(
_positionToListener
.
isEmpty
)
_lastUpdatedOffset
=
null
;
}
@override
...
...
packages/flutter/test/widgets/tracking_scroll_controller_test.dart
deleted
100644 → 0
View file @
ec25f6bd
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'TrackingScrollController saves offset'
,
(
WidgetTester
tester
)
async
{
final
TrackingScrollController
controller
=
new
TrackingScrollController
();
await
tester
.
pumpWidget
(
new
PageView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
new
ListView
(
controller:
controller
,
children:
new
List
<
Widget
>.
generate
(
10
,
(
int
i
)
=>
new
Container
(
height:
100.0
,
child:
new
Text
(
"Page
$index
-Item
$i
"
)),
).
toList
());
},
),
);
expect
(
find
.
text
(
'Page0-Item1'
),
findsOneWidget
);
expect
(
find
.
text
(
'Page1-Item1'
),
findsNothing
);
expect
(
find
.
text
(
'Page2-Item0'
),
findsNothing
);
expect
(
find
.
text
(
'Page2-Item1'
),
findsNothing
);
controller
.
jumpTo
(
110.0
);
await
(
tester
.
pumpAndSettle
());
await
tester
.
fling
(
find
.
text
(
'Page0-Item1'
),
const
Offset
(-
100.0
,
0.0
),
10000.0
);
await
(
tester
.
pumpAndSettle
());
expect
(
find
.
text
(
'Page0-Item1'
),
findsNothing
);
expect
(
find
.
text
(
'Page1-Item1'
),
findsOneWidget
);
expect
(
find
.
text
(
'Page2-Item0'
),
findsNothing
);
expect
(
find
.
text
(
'Page2-Item1'
),
findsNothing
);
await
tester
.
fling
(
find
.
text
(
'Page1-Item1'
),
const
Offset
(-
100.0
,
0.0
),
10000.0
);
await
(
tester
.
pumpAndSettle
());
expect
(
find
.
text
(
'Page0-Item1'
),
findsNothing
);
expect
(
find
.
text
(
'Page1-Item1'
),
findsNothing
);
expect
(
find
.
text
(
'Page2-Item0'
),
findsNothing
);
expect
(
find
.
text
(
'Page2-Item1'
),
findsOneWidget
);
await
tester
.
pumpWidget
(
new
Text
(
"Another page"
));
expect
(
controller
.
initialScrollOffset
,
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