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
62e87c8e
Unverified
Commit
62e87c8e
authored
Jun 01, 2018
by
Michael Goderbauer
Committed by
GitHub
Jun 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start refresh while bouncing back to 0.0 from overscroll on iOS (#18012)
parent
026c8983
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
refresh_indicator.dart
packages/flutter/lib/src/material/refresh_indicator.dart
+6
-0
refresh_indicator_test.dart
packages/flutter/test/material/refresh_indicator_test.dart
+38
-0
No files found.
packages/flutter/lib/src/material/refresh_indicator.dart
View file @
62e87c8e
...
...
@@ -226,6 +226,12 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
_checkDragOffset
(
notification
.
metrics
.
viewportDimension
);
}
}
if
(
_mode
==
_RefreshIndicatorMode
.
armed
&&
notification
.
dragDetails
==
null
)
{
// On iOS start the refresh when the Scrollable bounces back from the
// overscroll (ScrollNotification indicating this don't have dragDetails
// because the scroll activity is not directly triggered by a drag).
_show
();
}
}
else
if
(
notification
is
OverscrollNotification
)
{
if
(
_mode
==
_RefreshIndicatorMode
.
drag
||
_mode
==
_RefreshIndicatorMode
.
armed
)
{
_dragOffset
-=
notification
.
overscroll
/
2.0
;
...
...
packages/flutter/test/material/refresh_indicator_test.dart
View file @
62e87c8e
...
...
@@ -4,6 +4,7 @@
import
'dart:async'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -378,4 +379,41 @@ void main() {
expect
(
refreshCalled
,
true
);
expect
(
tester
.
takeException
(),
isFlutterError
);
});
testWidgets
(
'Refresh starts while scroll view moves back to 0.0 after overscroll on iOS'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
refreshCalled
=
false
;
double
lastScrollOffset
;
final
ScrollController
controller
=
new
ScrollController
();
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
new
RefreshIndicator
(
onRefresh:
refresh
,
child:
new
ListView
(
controller:
controller
,
physics:
const
AlwaysScrollableScrollPhysics
(),
children:
<
String
>[
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
].
map
((
String
item
)
{
return
new
SizedBox
(
height:
200.0
,
child:
new
Text
(
item
),
);
}).
toList
(),
),
),
),
);
await
tester
.
fling
(
find
.
text
(
'A'
),
const
Offset
(
0.0
,
300.0
),
1000.0
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
100
));
expect
(
lastScrollOffset
=
controller
.
offset
,
lessThan
(
0.0
));
expect
(
refreshCalled
,
isFalse
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
100
));
expect
(
controller
.
offset
,
greaterThan
(
lastScrollOffset
));
expect
(
controller
.
offset
,
lessThan
(
0.0
));
expect
(
refreshCalled
,
isTrue
);
debugDefaultTargetPlatformOverride
=
null
;
});
}
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