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
93211a48
Unverified
Commit
93211a48
authored
May 19, 2022
by
xubaolin
Committed by
GitHub
May 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Scrollbar]Skip the ScrollPosition check if the bar was unmounted (#103948)
parent
80a51e4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
scrollbar.dart
packages/flutter/lib/src/widgets/scrollbar.dart
+3
-0
scrollbar_test.dart
packages/flutter/test/widgets/scrollbar_test.dart
+38
-0
No files found.
packages/flutter/lib/src/widgets/scrollbar.dart
View file @
93211a48
...
...
@@ -1447,6 +1447,9 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
}
bool
_debugCheckHasValidScrollPosition
()
{
if
(!
mounted
)
{
return
true
;
}
final
ScrollController
?
scrollController
=
widget
.
controller
??
PrimaryScrollController
.
of
(
context
);
final
bool
tryPrimary
=
widget
.
controller
==
null
;
final
String
controllerForError
=
tryPrimary
...
...
packages/flutter/test/widgets/scrollbar_test.dart
View file @
93211a48
...
...
@@ -2444,4 +2444,42 @@ void main() {
}
expect
(()
=>
tester
.
pumpWidget
(
buildApp
()),
throwsAssertionError
);
});
testWidgets
(
'Skip the ScrollPosition check if the bar was unmounted'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/103939
final
ScrollController
scrollController
=
ScrollController
();
Widget
buildApp
(
bool
buildBar
)
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
MediaQueryData
(
invertColors:
buildBar
,
// Trigger a post frame check before unmount.
),
child:
PrimaryScrollController
(
controller:
scrollController
,
child:
LayoutBuilder
(
builder:
(
BuildContext
context
,
BoxConstraints
constraints
)
{
Widget
content
=
const
SingleChildScrollView
(
child:
SizedBox
(
width:
4000.0
,
height:
4000.0
),
);
if
(
buildBar
)
{
content
=
RawScrollbar
(
thumbVisibility:
true
,
child:
content
,
);
}
return
content
;
},
),
),
),
);
}
await
tester
.
pumpWidget
(
buildApp
(
true
));
await
tester
.
pumpWidget
(
buildApp
(
false
));
// Go without throw.
});
}
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