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
f4f1c210
Unverified
Commit
f4f1c210
authored
Jun 14, 2021
by
David Martos
Committed by
GitHub
Jun 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix scrollbar error message and test (#84570)
parent
a714c97c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
21 deletions
+29
-21
scrollbar.dart
packages/flutter/lib/src/widgets/scrollbar.dart
+2
-2
scrollbar_test.dart
packages/flutter/test/material/scrollbar_test.dart
+27
-19
No files found.
packages/flutter/lib/src/widgets/scrollbar.dart
View file @
f4f1c210
...
...
@@ -1048,8 +1048,8 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
final
ScrollController
?
scrollController
=
widget
.
controller
??
PrimaryScrollController
.
of
(
context
);
final
bool
tryPrimary
=
widget
.
controller
==
null
;
final
String
controllerForError
=
tryPrimary
?
'
provided
ScrollController'
:
'
Primary
ScrollController'
;
?
'
Primary
ScrollController'
:
'
provided
ScrollController'
;
String
when
=
''
;
if
(
showScrollbar
)
{
...
...
packages/flutter/test/material/scrollbar_test.dart
View file @
f4f1c210
...
...
@@ -1448,8 +1448,12 @@ void main() {
);
}
Widget
_buildApp
({
ScrollController
?
scrollController
})
{
Widget
_buildApp
({
required
String
id
,
ScrollController
?
scrollController
,
})
{
return
MaterialApp
(
key:
ValueKey
<
String
>(
id
),
home:
DefaultTabController
(
length:
2
,
child:
Scaffold
(
...
...
@@ -1465,33 +1469,37 @@ void main() {
}
// Asserts when using the PrimaryScrollController.
await
tester
.
pumpWidget
(
_buildApp
());
await
tester
.
pumpWidget
(
_buildApp
(
id:
'PrimaryScrollController'
));
// Swipe to the second tab, resulting in two attached ScrollPositions during
// the transition.
try
{
await
tester
.
drag
(
find
.
text
(
'Test'
).
first
,
const
Offset
(
10.0
,
0.0
)
);
}
on
FlutterError
catch
(
error
)
{
expect
(
error
.
message
,
contains
(
'The Scrollbar attempted to paint using the position attached to the PrimaryScrollController.'
)
,
);
}
await
tester
.
drag
(
find
.
text
(
'Test'
).
first
,
const
Offset
(-
100.0
,
0.0
));
await
tester
.
pump
(
);
FlutterError
error
=
tester
.
takeException
()
as
FlutterError
;
expect
(
error
.
message
,
contains
(
'The PrimaryScrollController is currently attached to more than one ScrollPosition.'
),
);
// Asserts when using the ScrollController provided by the user.
final
ScrollController
scrollController
=
ScrollController
();
await
tester
.
pumpWidget
(
_buildApp
(
scrollController:
scrollController
));
await
tester
.
pumpWidget
(
_buildApp
(
id:
'Provided ScrollController'
,
scrollController:
scrollController
,
),
);
// Swipe to the second tab, resulting in two attached ScrollPositions during
// the transition.
try
{
await
tester
.
drag
(
find
.
text
(
'Test'
).
first
,
const
Offset
(
10.0
,
0.0
));
}
on
AssertionError
catch
(
error
)
{
expect
(
error
.
message
,
contains
(
'The Scrollbar attempted to paint using the position attached to the provided ScrollController.'
),
);
}
await
tester
.
drag
(
find
.
text
(
'Test'
).
first
,
const
Offset
(-
100.0
,
0.0
));
await
tester
.
pump
();
error
=
tester
.
takeException
()
as
FlutterError
;
expect
(
error
.
message
,
contains
(
'The provided ScrollController is currently attached to more than one ScrollPosition.'
),
);
});
testWidgets
(
'Scrollbar scrollOrientation works correctly'
,
(
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