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
2427d4f3
Unverified
Commit
2427d4f3
authored
May 07, 2022
by
Qun Cheng
Committed by
GitHub
May 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added clipBehavior on TabBarView (#103166)
parent
c1809717
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+7
-0
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+39
-0
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
2427d4f3
...
...
@@ -1310,6 +1310,7 @@ class TabBarView extends StatefulWidget {
this
.
physics
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
viewportFraction
=
1.0
,
this
.
clipBehavior
=
Clip
.
hardEdge
,
})
:
assert
(
children
!=
null
),
assert
(
dragStartBehavior
!=
null
);
...
...
@@ -1342,6 +1343,11 @@ class TabBarView extends StatefulWidget {
/// {@macro flutter.widgets.pageview.viewportFraction}
final
double
viewportFraction
;
/// {@macro flutter.material.Material.clipBehavior}
///
/// Defaults to [Clip.hardEdge].
final
Clip
clipBehavior
;
@override
State
<
TabBarView
>
createState
()
=>
_TabBarViewState
();
}
...
...
@@ -1531,6 +1537,7 @@ class _TabBarViewState extends State<TabBarView> {
onNotification:
_handleScrollNotification
,
child:
PageView
(
dragStartBehavior:
widget
.
dragStartBehavior
,
clipBehavior:
widget
.
clipBehavior
,
controller:
_pageController
,
physics:
widget
.
physics
==
null
?
const
PageScrollPhysics
().
applyTo
(
const
ClampingScrollPhysics
())
...
...
packages/flutter/test/material/tabs_test.dart
View file @
2427d4f3
...
...
@@ -1104,6 +1104,45 @@ void main() {
expect
(
pageController
.
viewportFraction
,
1
);
});
testWidgets
(
'TabBarView has clipBehavior Clip.hardEdge by default'
,
(
WidgetTester
tester
)
async
{
final
List
<
Widget
>
tabs
=
<
Widget
>[
const
Text
(
'First'
),
const
Text
(
'Second'
)];
Widget
builder
()
{
return
boilerplate
(
child:
DefaultTabController
(
length:
tabs
.
length
,
child:
TabBarView
(
children:
tabs
,
),
),
);
}
await
tester
.
pumpWidget
(
builder
());
final
TabBarView
tabBarView
=
tester
.
widget
(
find
.
byType
(
TabBarView
));
expect
(
tabBarView
.
clipBehavior
,
Clip
.
hardEdge
);
});
testWidgets
(
'TabBarView sets clipBehavior correctly'
,
(
WidgetTester
tester
)
async
{
final
List
<
Widget
>
tabs
=
<
Widget
>[
const
Text
(
'First'
),
const
Text
(
'Second'
)];
Widget
builder
()
{
return
boilerplate
(
child:
DefaultTabController
(
length:
tabs
.
length
,
child:
TabBarView
(
clipBehavior:
Clip
.
none
,
children:
tabs
,
),
),
);
}
await
tester
.
pumpWidget
(
builder
());
final
PageView
pageView
=
tester
.
widget
(
find
.
byType
(
PageView
));
expect
(
pageView
.
clipBehavior
,
Clip
.
none
);
});
testWidgets
(
'TabBar tap skips indicator animation when disabled in controller'
,
(
WidgetTester
tester
)
async
{
final
List
<
String
>
tabs
=
<
String
>[
'A'
,
'B'
];
...
...
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