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
0f465e5b
Unverified
Commit
0f465e5b
authored
Aug 04, 2021
by
Kate Lovett
Committed by
GitHub
Aug 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "update ScrollMetricsNotification (#87421)" (#87693)
This reverts commit
52bf9dbb
.
parent
c38feb3b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
33 deletions
+22
-33
scroll_position.dart
packages/flutter/lib/src/widgets/scroll_position.dart
+1
-1
scrollbar.dart
packages/flutter/lib/src/widgets/scrollbar.dart
+16
-8
scrollbar_test.dart
packages/flutter/test/cupertino/scrollbar_test.dart
+2
-10
scroll_notification_test.dart
packages/flutter/test/widgets/scroll_notification_test.dart
+1
-2
scrollbar_test.dart
packages/flutter/test/widgets/scrollbar_test.dart
+2
-12
No files found.
packages/flutter/lib/src/widgets/scroll_position.dart
View file @
0f465e5b
...
...
@@ -558,7 +558,7 @@ abstract class ScrollPosition extends ViewportOffset with ScrollMetrics {
// It isn't safe to trigger the ScrollMetricsNotification if we are in
// the middle of rendering the frame, the developer is likely to schedule
// a new frame(build scheduled during frame is illegal).
if
(!
_haveScheduledUpdateNotification
)
{
if
(
_lastMetrics
!=
null
&&
!
_haveScheduledUpdateNotification
)
{
scheduleMicrotask
(
didUpdateScrollMetrics
);
_haveScheduledUpdateNotification
=
true
;
}
...
...
packages/flutter/lib/src/widgets/scrollbar.dart
View file @
0f465e5b
...
...
@@ -1224,16 +1224,25 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
@override
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
assert
(
_debugScheduleCheckHasValidScrollPosition
()
);
_maybeTriggerScrollbar
(
);
}
bool
_debugScheduleCheckHasValidScrollPosition
()
{
if
(!
showScrollbar
)
return
true
;
// Waits one frame and cause an empty scroll event (zero delta pixels).
//
// This allows the thumb to show immediately when isAlwaysShown is true.
// A scroll event is required in order to paint the thumb.
void
_maybeTriggerScrollbar
()
{
WidgetsBinding
.
instance
!.
addPostFrameCallback
((
Duration
duration
)
{
final
ScrollController
?
scrollController
=
widget
.
controller
??
PrimaryScrollController
.
of
(
context
);
if
(
showScrollbar
)
{
_fadeoutTimer
?.
cancel
();
// Wait one frame and cause an empty scroll event. This allows the
// thumb to show immediately when isAlwaysShown is true. A scroll
// event is required in order to paint the thumb.
assert
(
_debugCheckHasValidScrollPosition
());
scrollController
!.
position
.
didUpdateScrollPositionBy
(
0
);
}
});
return
true
;
}
void
_validateInteractions
(
AnimationStatus
status
)
{
...
...
@@ -1356,8 +1365,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
super
.
didUpdateWidget
(
oldWidget
);
if
(
widget
.
isAlwaysShown
!=
oldWidget
.
isAlwaysShown
)
{
if
(
widget
.
isAlwaysShown
==
true
)
{
assert
(
_debugScheduleCheckHasValidScrollPosition
());
_fadeoutTimer
?.
cancel
();
_maybeTriggerScrollbar
();
_fadeoutAnimationController
.
animateTo
(
1.0
);
}
else
{
_fadeoutAnimationController
.
reverse
();
...
...
packages/flutter/test/cupertino/scrollbar_test.dart
View file @
0f465e5b
...
...
@@ -5,7 +5,6 @@
import
'dart:ui'
as
ui
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -390,16 +389,9 @@ void main() {
);
}
final
FlutterExceptionHandler
?
handler
=
FlutterError
.
onError
;
FlutterErrorDetails
?
error
;
FlutterError
.
onError
=
(
FlutterErrorDetails
details
)
{
error
=
details
;
};
await
tester
.
pumpWidget
(
viewWithScroll
());
expect
(
error
,
isNotNull
);
FlutterError
.
onError
=
handler
;
final
AssertionError
exception
=
tester
.
takeException
()
as
AssertionError
;
expect
(
exception
,
isAssertionError
);
},
);
...
...
packages/flutter/test/widgets/scroll_notification_test.dart
View file @
0f465e5b
...
...
@@ -21,9 +21,8 @@ void main() {
);
}
await
tester
.
pumpWidget
(
buildFrame
(
1200.0
));
expect
(
events
.
length
,
1
);
expect
(
events
.
length
,
0
);
events
.
clear
();
await
tester
.
pumpWidget
(
buildFrame
(
1000.0
));
// Change the content dimensions will trigger a new event.
expect
(
events
.
length
,
1
);
...
...
packages/flutter/test/widgets/scrollbar_test.dart
View file @
0f465e5b
...
...
@@ -4,7 +4,6 @@
import
'dart:ui'
as
ui
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/src/physics/utils.dart'
show
nearEqual
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -1144,12 +1143,6 @@ void main() {
});
testWidgets
(
'RawScrollbar.isAlwaysShown asserts that a ScrollPosition is attached'
,
(
WidgetTester
tester
)
async
{
final
FlutterExceptionHandler
?
handler
=
FlutterError
.
onError
;
FlutterErrorDetails
?
error
;
FlutterError
.
onError
=
(
FlutterErrorDetails
details
)
{
error
=
details
;
};
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -1170,15 +1163,12 @@ void main() {
),
);
await
tester
.
pumpAndSettle
();
expect
(
error
,
isNotNull
);
final
AssertionError
exception
=
error
!.
exception
as
AssertionError
;
final
AssertionError
exception
=
tester
.
takeException
()
as
AssertionError
;
expect
(
exception
,
isAssertionError
);
expect
(
exception
.
message
,
contains
(
"The Scrollbar's ScrollController has no ScrollPosition attached."
),
);
FlutterError
.
onError
=
handler
;
});
testWidgets
(
'Interactive scrollbars should have a valid scroll controller'
,
(
WidgetTester
tester
)
async
{
...
...
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