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
6aed693c
Unverified
Commit
6aed693c
authored
Feb 03, 2022
by
Nayeem Hasan
Committed by
GitHub
Feb 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add splashBorderRadius to TabBar (#97204)
parent
ac52901c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+23
-0
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+44
-0
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
6aed693c
...
...
@@ -644,6 +644,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
this
.
onTap
,
this
.
physics
,
this
.
splashFactory
,
this
.
splashBorderRadius
,
})
:
assert
(
tabs
!=
null
),
assert
(
isScrollable
!=
null
),
assert
(
dragStartBehavior
!=
null
),
...
...
@@ -720,6 +721,11 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
/// occupied by the tab in the tab bar. If [indicatorSize] is
/// [TabBarIndicatorSize.label], then the tab's bounds are only as wide as
/// the tab widget itself.
///
/// See also:
///
/// * [splashBorderRadius], which defines the clipping radius of the splash
/// and is generally used with [BoxDecoration.borderRadius].
final
Decoration
?
indicator
;
/// Whether this tab bar should automatically adjust the [indicatorColor].
...
...
@@ -849,6 +855,22 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
/// ```
final
InteractiveInkFeatureFactory
?
splashFactory
;
/// Defines the clipping radius of splashes that extend outside the bounds of the tab.
///
/// This can be useful to match the [BoxDecoration.borderRadius] provided as [indicator].
/// ```dart
/// TabBar(
/// indicator: BoxDecoration(
/// borderRadius: BorderRadius.circular(40),
/// ),
/// splashBorderRadius: BorderRadius.circular(40),
/// ...
/// )
/// ```
///
/// If this property is null, it is interpreted as [BorderRadius.zero].
final
BorderRadius
?
splashBorderRadius
;
/// A size whose height depends on if the tabs have both icons and text.
///
/// [AppBar] uses this size to compute its own preferred size.
...
...
@@ -1206,6 +1228,7 @@ class _TabBarState extends State<TabBar> {
enableFeedback:
widget
.
enableFeedback
??
true
,
overlayColor:
widget
.
overlayColor
??
tabBarTheme
.
overlayColor
,
splashFactory:
widget
.
splashFactory
??
tabBarTheme
.
splashFactory
,
borderRadius:
widget
.
splashBorderRadius
,
child:
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
widget
.
indicatorWeight
),
child:
Stack
(
...
...
packages/flutter/test/material/tabs_test.dart
View file @
6aed693c
...
...
@@ -4378,6 +4378,50 @@ void main() {
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
splashFactory
,
splashFactory
);
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
overlayColor
,
overlayColor
);
});
testWidgets
(
'splashBorderRadius is passed to InkWell.borderRadius'
,
(
WidgetTester
tester
)
async
{
const
Color
hoverColor
=
Color
(
0xfff44336
);
const
double
radius
=
20
;
await
tester
.
pumpWidget
(
boilerplate
(
child:
DefaultTabController
(
length:
1
,
child:
TabBar
(
overlayColor:
MaterialStateProperty
.
resolveWith
<
Color
>(
(
Set
<
MaterialState
>
states
)
{
if
(
states
.
contains
(
MaterialState
.
hovered
))
{
return
hoverColor
;
}
return
Colors
.
black54
;
},
),
splashBorderRadius:
BorderRadius
.
circular
(
radius
),
tabs:
const
<
Widget
>[
Tab
(
child:
Text
(
''
),
),
],
),
),
),
);
await
tester
.
pumpAndSettle
();
final
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
,
pointer:
1
);
await
gesture
.
moveTo
(
tester
.
getCenter
(
find
.
byType
(
Tab
)));
await
tester
.
pumpAndSettle
();
final
RenderObject
object
=
tester
.
allRenderObjects
.
firstWhere
((
RenderObject
element
)
=>
element
.
runtimeType
.
toString
()
==
'_RenderInkFeatures'
);
expect
(
object
,
paints
..
rrect
(
color:
hoverColor
,
rrect:
RRect
.
fromRectAndRadius
(
tester
.
getRect
(
find
.
byType
(
InkWell
)),
const
Radius
.
circular
(
radius
)
),
),
);
gesture
.
removePointer
();
});
}
class
KeepAliveInk
extends
StatefulWidget
{
...
...
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