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
9be0fa74
Unverified
Commit
9be0fa74
authored
Sep 16, 2022
by
xubaolin
Committed by
GitHub
Sep 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a CupertinoScrollbar NNBD issue (#111198)
parent
bcc1dc6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
scrollbar.dart
packages/flutter/lib/src/cupertino/scrollbar.dart
+4
-1
scrollbar_test.dart
packages/flutter/test/cupertino/scrollbar_test.dart
+44
-0
No files found.
packages/flutter/lib/src/cupertino/scrollbar.dart
View file @
9be0fa74
...
...
@@ -185,7 +185,10 @@ class _CupertinoScrollbarState extends RawScrollbarState<CupertinoScrollbar> {
@override
void
handleThumbPressStart
(
Offset
localPosition
)
{
super
.
handleThumbPressStart
(
localPosition
);
final
Axis
direction
=
getScrollbarDirection
()!;
final
Axis
?
direction
=
getScrollbarDirection
();
if
(
direction
==
null
)
{
return
;
}
switch
(
direction
)
{
case
Axis
.
vertical
:
_pressStartAxisPosition
=
localPosition
.
dy
;
...
...
packages/flutter/test/cupertino/scrollbar_test.dart
View file @
9be0fa74
...
...
@@ -1060,6 +1060,50 @@ void main() {
);
});
testWidgets
(
'Throw if interactive with the bar when no position attached'
,
(
WidgetTester
tester
)
async
{
final
ScrollController
scrollController
=
ScrollController
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(),
child:
CupertinoScrollbar
(
controller:
scrollController
,
thumbVisibility:
true
,
child:
SingleChildScrollView
(
controller:
scrollController
,
child:
const
SizedBox
(
height:
1000.0
,
width:
1000.0
,
),
),
),
),
),
);
await
tester
.
pumpAndSettle
();
final
ScrollPosition
position
=
scrollController
.
position
;
scrollController
.
detach
(
position
);
final
FlutterExceptionHandler
?
handler
=
FlutterError
.
onError
;
FlutterErrorDetails
?
error
;
FlutterError
.
onError
=
(
FlutterErrorDetails
details
)
{
error
=
details
;
};
// long press the thumb
await
tester
.
startGesture
(
const
Offset
(
796.0
,
50.0
));
await
tester
.
pump
(
kLongPressDuration
);
expect
(
error
,
isNotNull
);
scrollController
.
attach
(
position
);
FlutterError
.
onError
=
handler
;
});
testWidgets
(
'Interactive scrollbars should have a valid scroll controller'
,
(
WidgetTester
tester
)
async
{
final
ScrollController
primaryScrollController
=
ScrollController
();
final
ScrollController
scrollController
=
ScrollController
();
...
...
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