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
25ef78e2
Unverified
Commit
25ef78e2
authored
Mar 25, 2020
by
Dan Field
Committed by
GitHub
Mar 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Revert "Fix RefreshIndicator performance issue (#47667)" (#53149)" (#53206)
parent
231e6f00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
12 deletions
+47
-12
refresh_indicator.dart
packages/flutter/lib/src/material/refresh_indicator.dart
+11
-11
refresh_indicator_test.dart
packages/flutter/test/material/refresh_indicator_test.dart
+36
-1
No files found.
packages/flutter/lib/src/material/refresh_indicator.dart
View file @
25ef78e2
...
...
@@ -409,26 +409,26 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
return
_pendingRefreshFuture
;
}
final
GlobalKey
_key
=
GlobalKey
();
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
Widget
child
=
NotificationListener
<
ScrollNotification
>(
key:
_key
,
onNotification:
_handleScrollNotification
,
child:
NotificationListener
<
OverscrollIndicatorNotification
>(
onNotification:
_handleGlowNotification
,
child:
widget
.
child
,
),
);
if
(
_mode
==
null
)
{
assert
(
_dragOffset
==
null
);
assert
(
_isIndicatorAtTop
==
null
);
return
child
;
}
assert
(
_dragOffset
!=
null
);
assert
(
_isIndicatorAtTop
!=
null
);
assert
(()
{
if
(
_mode
==
null
)
{
assert
(
_dragOffset
==
null
);
assert
(
_isIndicatorAtTop
==
null
);
}
else
{
assert
(
_dragOffset
!=
null
);
assert
(
_isIndicatorAtTop
!=
null
);
}
return
true
;
}());
final
bool
showIndeterminateIndicator
=
_mode
==
_RefreshIndicatorMode
.
refresh
||
_mode
==
_RefreshIndicatorMode
.
done
;
...
...
@@ -436,7 +436,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
return
Stack
(
children:
<
Widget
>[
child
,
Positioned
(
if
(
_mode
!=
null
)
Positioned
(
top:
_isIndicatorAtTop
?
0.0
:
null
,
bottom:
!
_isIndicatorAtTop
?
0.0
:
null
,
left:
0.0
,
...
...
packages/flutter/test/material/refresh_indicator_test.dart
View file @
25ef78e2
...
...
@@ -420,4 +420,39 @@ void main() {
expect
(
controller
.
offset
,
lessThan
(
0.0
));
expect
(
refreshCalled
,
isTrue
);
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
}
testWidgets
(
'RefreshIndicator does not force child to relayout'
,
(
WidgetTester
tester
)
async
{
int
layoutCount
=
0
;
Widget
layoutCallback
(
BuildContext
context
,
BoxConstraints
constraints
)
{
layoutCount
++;
return
ListView
(
physics:
const
AlwaysScrollableScrollPhysics
(),
children:
<
String
>[
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
].
map
<
Widget
>((
String
item
)
{
return
SizedBox
(
height:
200.0
,
child:
Text
(
item
),
);
}).
toList
(),
);
}
await
tester
.
pumpWidget
(
MaterialApp
(
home:
RefreshIndicator
(
onRefresh:
refresh
,
child:
LayoutBuilder
(
builder:
layoutCallback
),
),
),
);
await
tester
.
fling
(
find
.
text
(
'A'
),
const
Offset
(
0.0
,
300.0
),
1000.0
);
// trigger refresh
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// finish the scroll animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// finish the indicator settle animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// finish the indicator hide animation
expect
(
layoutCount
,
1
);
});
}
\ No newline at end of file
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