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
4b20ce74
Unverified
Commit
4b20ce74
authored
Mar 02, 2022
by
xubaolin
Committed by
GitHub
Mar 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a Scrollbar hittest penetration issue (#99328)
parent
7372ad17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
scrollbar.dart
packages/flutter/lib/src/widgets/scrollbar.dart
+2
-1
scrollbar_test.dart
packages/flutter/test/widgets/scrollbar_test.dart
+49
-0
No files found.
packages/flutter/lib/src/widgets/scrollbar.dart
View file @
4b20ce74
...
@@ -736,6 +736,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
...
@@ -736,6 +736,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
if
(
ignorePointer
)
{
if
(
ignorePointer
)
{
return
false
;
return
false
;
}
}
// The thumb is not able to be hit when transparent.
// The thumb is not able to be hit when transparent.
if
(
fadeoutOpacityAnimation
.
value
==
0.0
)
{
if
(
fadeoutOpacityAnimation
.
value
==
0.0
)
{
return
false
;
return
false
;
...
@@ -745,7 +746,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
...
@@ -745,7 +746,7 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter {
return
false
;
return
false
;
}
}
return
_t
humb
Rect
!.
contains
(
position
!);
return
_t
rack
Rect
!.
contains
(
position
!);
}
}
@override
@override
...
...
packages/flutter/test/widgets/scrollbar_test.dart
View file @
4b20ce74
...
@@ -1345,6 +1345,55 @@ void main() {
...
@@ -1345,6 +1345,55 @@ void main() {
);
);
});
});
testWidgets
(
'hit test'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/99324
final
ScrollController
scrollController
=
ScrollController
();
bool
onTap
=
false
;
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(),
child:
PrimaryScrollController
(
controller:
scrollController
,
child:
RawScrollbar
(
trackVisibility:
true
,
thumbVisibility:
true
,
controller:
scrollController
,
child:
SingleChildScrollView
(
child:
GestureDetector
(
onTap:
()
=>
onTap
=
true
,
child:
const
SizedBox
(
width:
4000.0
,
height:
4000.0
,
child:
ColoredBox
(
color:
Color
(
0x00000000
)),
),
),
),
),
),
),
),
);
await
tester
.
pumpAndSettle
();
expect
(
onTap
,
false
);
// Tap on track area.
await
tester
.
tapAt
(
const
Offset
(
795.0
,
550.0
));
await
tester
.
pumpAndSettle
();
expect
(
onTap
,
false
);
// Tap on thumb area.
await
tester
.
tapAt
(
const
Offset
(
795.0
,
10.0
));
await
tester
.
pumpAndSettle
();
expect
(
onTap
,
false
);
// Tap on content area.
await
tester
.
tapAt
(
const
Offset
(
400.0
,
300.0
));
await
tester
.
pumpAndSettle
();
expect
(
onTap
,
true
);
});
testWidgets
(
'RawScrollbar.thumbVisibility asserts that a ScrollPosition is attached'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'RawScrollbar.thumbVisibility asserts that a ScrollPosition is attached'
,
(
WidgetTester
tester
)
async
{
final
FlutterExceptionHandler
?
handler
=
FlutterError
.
onError
;
final
FlutterExceptionHandler
?
handler
=
FlutterError
.
onError
;
FlutterErrorDetails
?
error
;
FlutterErrorDetails
?
error
;
...
...
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