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
aac68515
Unverified
Commit
aac68515
authored
Dec 13, 2021
by
najeira
Committed by
GitHub
Dec 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CupertinoTabBar.height (#72919)
parent
db78a2e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
2 deletions
+54
-2
bottom_tab_bar.dart
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
+11
-2
bottom_tab_bar_test.dart
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
+43
-0
No files found.
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
View file @
aac68515
...
...
@@ -65,6 +65,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
this
.
activeColor
,
this
.
inactiveColor
=
_kDefaultTabBarInactiveColor
,
this
.
iconSize
=
30.0
,
this
.
height
=
_kTabBarHeight
,
this
.
border
=
const
Border
(
top:
BorderSide
(
color:
_kDefaultTabBarBorderColor
,
...
...
@@ -79,6 +80,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
assert
(
currentIndex
!=
null
),
assert
(
0
<=
currentIndex
&&
currentIndex
<
items
.
length
),
assert
(
iconSize
!=
null
),
assert
(
height
!=
null
&&
height
>=
0.0
),
assert
(
inactiveColor
!=
null
),
super
(
key:
key
);
...
...
@@ -129,13 +131,18 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
/// Must not be null.
final
double
iconSize
;
/// The height of the [CupertinoTabBar].
///
/// Defaults to 50.0. Must not be null.
final
double
height
;
/// The border of the [CupertinoTabBar].
///
/// The default value is a one physical pixel top border with grey color.
final
Border
?
border
;
@override
Size
get
preferredSize
=>
const
Size
.
fromHeight
(
_kTabBarH
eight
);
Size
get
preferredSize
=>
Size
.
fromHeight
(
h
eight
);
/// Indicates whether the tab bar is fully opaque or can have contents behind
/// it show through it.
...
...
@@ -178,7 +185,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
color:
backgroundColor
,
),
child:
SizedBox
(
height:
_kTabBarH
eight
+
bottomPadding
,
height:
h
eight
+
bottomPadding
,
child:
IconTheme
.
merge
(
// Default with the inactive state.
data:
IconThemeData
(
color:
inactive
,
size:
iconSize
),
child:
DefaultTextStyle
(
// Default with the inactive state.
...
...
@@ -285,6 +292,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
Color
?
activeColor
,
Color
?
inactiveColor
,
double
?
iconSize
,
double
?
height
,
Border
?
border
,
int
?
currentIndex
,
ValueChanged
<
int
>?
onTap
,
...
...
@@ -296,6 +304,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
activeColor:
activeColor
??
this
.
activeColor
,
inactiveColor:
inactiveColor
??
this
.
inactiveColor
,
iconSize:
iconSize
??
this
.
iconSize
,
height:
height
??
this
.
height
,
border:
border
??
this
.
border
,
currentIndex:
currentIndex
??
this
.
currentIndex
,
onTap:
onTap
??
this
.
onTap
,
...
...
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
View file @
aac68515
...
...
@@ -327,6 +327,49 @@ Future<void> main() async {
expect
(
tester
.
getSize
(
find
.
byType
(
CupertinoTabBar
)).
height
,
90.0
);
});
testWidgets
(
'Set custom height'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/51704
const
double
tabBarHeight
=
56.0
;
final
CupertinoTabBar
tabBar
=
CupertinoTabBar
(
height:
tabBarHeight
,
items:
<
BottomNavigationBarItem
>[
BottomNavigationBarItem
(
icon:
ImageIcon
(
MemoryImage
(
Uint8List
.
fromList
(
kTransparentImage
))),
label:
'Aka'
,
),
BottomNavigationBarItem
(
icon:
ImageIcon
(
MemoryImage
(
Uint8List
.
fromList
(
kTransparentImage
))),
label:
'Shiro'
,
),
],
);
// Verify height with no bottom padding.
await
pumpWidgetWithBoilerplate
(
tester
,
MediaQuery
(
data:
const
MediaQueryData
(),
child:
CupertinoTabScaffold
(
tabBar:
tabBar
,
tabBuilder:
(
BuildContext
context
,
int
index
)
{
return
const
Placeholder
();
},
),
));
expect
(
tester
.
getSize
(
find
.
byType
(
CupertinoTabBar
)).
height
,
tabBarHeight
);
// Verify height with bottom padding.
const
double
bottomPadding
=
40.0
;
await
pumpWidgetWithBoilerplate
(
tester
,
MediaQuery
(
data:
const
MediaQueryData
(
padding:
EdgeInsets
.
only
(
bottom:
bottomPadding
)),
child:
CupertinoTabScaffold
(
tabBar:
tabBar
,
tabBuilder:
(
BuildContext
context
,
int
index
)
{
return
const
Placeholder
();
},
),
));
expect
(
tester
.
getSize
(
find
.
byType
(
CupertinoTabBar
)).
height
,
tabBarHeight
+
bottomPadding
);
});
testWidgets
(
'Opaque background does not add blur effects'
,
(
WidgetTester
tester
)
async
{
await
pumpWidgetWithBoilerplate
(
tester
,
MediaQuery
(
data:
const
MediaQueryData
(),
...
...
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