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
09518ac7
Unverified
Commit
09518ac7
authored
Feb 21, 2023
by
Kate Lovett
Committed by
GitHub
Feb 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove single axis assertion (#120738)
parent
4acbe970
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
overscroll_indicator.dart
packages/flutter/lib/src/widgets/overscroll_indicator.dart
+5
-1
overscroll_indicator_test.dart
packages/flutter/test/widgets/overscroll_indicator_test.dart
+38
-0
No files found.
packages/flutter/lib/src/widgets/overscroll_indicator.dart
View file @
09518ac7
...
...
@@ -201,6 +201,11 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
if
(!
widget
.
notificationPredicate
(
notification
))
{
return
false
;
}
if
(
notification
.
metrics
.
axis
!=
widget
.
axis
)
{
// This widget is explicitly configured to one axis. If a notification
// from a different axis bubbles up, do nothing.
return
false
;
}
// Update the paint offset with the current scroll position. This makes
// sure that the glow effect correctly scrolls in line with the current
...
...
@@ -236,7 +241,6 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
}
}
assert
(
controller
!=
null
);
assert
(
notification
.
metrics
.
axis
==
widget
.
axis
);
if
(
_accepted
[
isLeading
]!)
{
if
(
notification
.
velocity
!=
0.0
)
{
assert
(
notification
.
dragDetails
==
null
);
...
...
packages/flutter/test/widgets/overscroll_indicator_test.dart
View file @
09518ac7
...
...
@@ -233,6 +233,35 @@ void main() {
expect
(
painter
,
doesNotOverscroll
);
});
testWidgets
(
'Overscroll ignored from alternate axis'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
ScrollConfiguration
(
behavior:
TestScrollBehaviorNoGlow
(),
child:
GlowingOverscrollIndicator
(
axisDirection:
AxisDirection
.
right
,
color:
Color
(
0xFF0000FF
),
child:
CustomScrollView
(
physics:
AlwaysScrollableScrollPhysics
(),
slivers:
<
Widget
>[
SliverToBoxAdapter
(
child:
SizedBox
(
height:
20.0
)),
],
),
),
),
),
);
final
RenderObject
painter
=
tester
.
renderObject
(
find
.
byType
(
CustomPaint
));
await
slowDrag
(
tester
,
const
Offset
(
200.0
,
200.0
),
const
Offset
(
0.0
,
5.0
));
expect
(
painter
,
doesNotOverscroll
);
await
slowDrag
(
tester
,
const
Offset
(
200.0
,
200.0
),
const
Offset
(
0.0
,
-
5.0
));
expect
(
painter
,
doesNotOverscroll
);
await
tester
.
pumpAndSettle
(
const
Duration
(
seconds:
1
));
expect
(
painter
,
doesNotOverscroll
);
});
testWidgets
(
'Overscroll horizontally'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
Directionality
(
...
...
@@ -570,3 +599,12 @@ class TestScrollBehavior2 extends ScrollBehavior {
);
}
}
class
TestScrollBehaviorNoGlow
extends
ScrollBehavior
{
const
TestScrollBehaviorNoGlow
();
@override
Widget
buildOverscrollIndicator
(
BuildContext
context
,
Widget
child
,
ScrollableDetails
details
)
{
return
child
;
}
}
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