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
3ec6978c
Unverified
Commit
3ec6978c
authored
Jun 04, 2020
by
Kate Lovett
Committed by
GitHub
Jun 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix custom physics application in TabBarView (#58715)
parent
78c2defa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+4
-2
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+18
-0
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
3ec6978c
...
...
@@ -1179,7 +1179,7 @@ class TabBarView extends StatefulWidget {
_TabBarViewState
createState
()
=>
_TabBarViewState
();
}
final
PageScrollPhysics
_kTabBarViewPhysics
=
const
PageScrollPhysics
().
applyTo
(
const
ClampingScrollPhysics
()
);
const
PageScrollPhysics
_kTabBarViewPhysics
=
PageScrollPhysics
(
);
class
_TabBarViewState
extends
State
<
TabBarView
>
{
TabController
_controller
;
...
...
@@ -1349,7 +1349,9 @@ class _TabBarViewState extends State<TabBarView> {
child:
PageView
(
dragStartBehavior:
widget
.
dragStartBehavior
,
controller:
_pageController
,
physics:
widget
.
physics
==
null
?
_kTabBarViewPhysics
:
_kTabBarViewPhysics
.
applyTo
(
widget
.
physics
),
physics:
widget
.
physics
==
null
?
_kTabBarViewPhysics
.
applyTo
(
const
ClampingScrollPhysics
())
:
_kTabBarViewPhysics
.
applyTo
(
widget
.
physics
),
children:
_childrenWithKey
,
),
);
...
...
packages/flutter/test/material/tabs_test.dart
View file @
3ec6978c
...
...
@@ -2580,4 +2580,22 @@ void main() {
await
tester
.
pumpAndSettle
();
pageController
.
removeListener
(
pageControllerListener
);
});
testWidgets
(
'Setting BouncingScrollPhysics on TabBarView does not include ClampingScrollPhysics'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/57708
await
tester
.
pumpWidget
(
MaterialApp
(
home:
DefaultTabController
(
length:
10
,
child:
Scaffold
(
body:
TabBarView
(
physics:
const
BouncingScrollPhysics
(),
children:
List
<
Widget
>.
generate
(
10
,
(
int
i
)
=>
Center
(
child:
Text
(
'index
$i
'
))),
),
),
)
));
final
PageView
pageView
=
tester
.
widget
<
PageView
>(
find
.
byType
(
PageView
));
expect
(
pageView
.
physics
.
toString
().
contains
(
'ClampingScrollPhysics'
),
isFalse
);
});
}
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