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
ccc82614
Unverified
Commit
ccc82614
authored
Oct 14, 2021
by
Kate Lovett
Committed by
GitHub
Oct 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove BottomNavigationBarItem.title deprecation (#90295)
parent
64b0cfda
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
90 deletions
+71
-90
bottom_tab_bar.dart
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
+0
-1
bottom_navigation_bar.dart
packages/flutter/lib/src/material/bottom_navigation_bar.dart
+4
-5
bottom_navigation_bar_theme.dart
...flutter/lib/src/material/bottom_navigation_bar_theme.dart
+2
-2
bottom_navigation_bar_item.dart
...s/flutter/lib/src/widgets/bottom_navigation_bar_item.dart
+0
-15
bottom_tab_bar_test.dart
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
+1
-1
bottom_navigation_bar_test.dart
...ges/flutter/test/material/bottom_navigation_bar_test.dart
+64
-66
No files found.
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
View file @
ccc82614
...
@@ -254,7 +254,6 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
...
@@ -254,7 +254,6 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
Expanded
(
Expanded
(
child:
Center
(
child:
active
?
item
.
activeIcon
:
item
.
icon
),
child:
Center
(
child:
active
?
item
.
activeIcon
:
item
.
icon
),
),
),
if
(
item
.
title
!=
null
)
item
.
title
!,
if
(
item
.
label
!=
null
)
Text
(
item
.
label
!),
if
(
item
.
label
!=
null
)
Text
(
item
.
label
!),
];
];
}
}
...
...
packages/flutter/lib/src/material/bottom_navigation_bar.dart
View file @
ccc82614
...
@@ -185,9 +185,8 @@ class BottomNavigationBar extends StatefulWidget {
...
@@ -185,9 +185,8 @@ class BottomNavigationBar extends StatefulWidget {
})
:
assert
(
items
!=
null
),
})
:
assert
(
items
!=
null
),
assert
(
items
.
length
>=
2
),
assert
(
items
.
length
>=
2
),
assert
(
assert
(
items
.
every
((
BottomNavigationBarItem
item
)
=>
item
.
title
!=
null
)
||
items
.
every
((
BottomNavigationBarItem
item
)
=>
item
.
label
!=
null
),
items
.
every
((
BottomNavigationBarItem
item
)
=>
item
.
label
!=
null
),
'Every item must have a non-null
title or
label'
,
'Every item must have a non-null label'
,
),
),
assert
(
0
<=
currentIndex
&&
currentIndex
<
items
.
length
),
assert
(
0
<=
currentIndex
&&
currentIndex
<
items
.
length
),
assert
(
elevation
==
null
||
elevation
>=
0.0
),
assert
(
elevation
==
null
||
elevation
>=
0.0
),
...
@@ -247,13 +246,13 @@ class BottomNavigationBar extends StatefulWidget {
...
@@ -247,13 +246,13 @@ class BottomNavigationBar extends StatefulWidget {
final
double
iconSize
;
final
double
iconSize
;
/// The color of the selected [BottomNavigationBarItem.icon] and
/// The color of the selected [BottomNavigationBarItem.icon] and
/// [BottomNavigationBarItem.
title
].
/// [BottomNavigationBarItem.
label
].
///
///
/// If null then the [ThemeData.primaryColor] is used.
/// If null then the [ThemeData.primaryColor] is used.
final
Color
?
selectedItemColor
;
final
Color
?
selectedItemColor
;
/// The color of the unselected [BottomNavigationBarItem.icon] and
/// The color of the unselected [BottomNavigationBarItem.icon] and
/// [BottomNavigationBarItem.
title
]s.
/// [BottomNavigationBarItem.
label
]s.
///
///
/// If null then the [ThemeData.unselectedWidgetColor]'s color is used.
/// If null then the [ThemeData.unselectedWidgetColor]'s color is used.
final
Color
?
unselectedItemColor
;
final
Color
?
unselectedItemColor
;
...
@@ -692,7 +691,7 @@ class _Label extends StatelessWidget {
...
@@ -692,7 +691,7 @@ class _Label extends StatelessWidget {
),
),
),
),
alignment:
Alignment
.
bottomCenter
,
alignment:
Alignment
.
bottomCenter
,
child:
item
.
title
??
Text
(
item
.
label
!),
child:
Text
(
item
.
label
!),
),
),
);
);
...
...
packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart
View file @
ccc82614
...
@@ -78,13 +78,13 @@ class BottomNavigationBarThemeData with Diagnosticable {
...
@@ -78,13 +78,13 @@ class BottomNavigationBarThemeData with Diagnosticable {
final
IconThemeData
?
unselectedIconTheme
;
final
IconThemeData
?
unselectedIconTheme
;
/// The color of the selected [BottomNavigationBarItem.icon] and
/// The color of the selected [BottomNavigationBarItem.icon] and
/// [BottomNavigationBarItem.
title
].
/// [BottomNavigationBarItem.
label
].
///
///
/// See [BottomNavigationBar.selectedItemColor].
/// See [BottomNavigationBar.selectedItemColor].
final
Color
?
selectedItemColor
;
final
Color
?
selectedItemColor
;
/// The color of the unselected [BottomNavigationBarItem.icon] and
/// The color of the unselected [BottomNavigationBarItem.icon] and
/// [BottomNavigationBarItem.
title
]s.
/// [BottomNavigationBarItem.
label
]s.
///
///
/// See [BottomNavigationBar.unselectedItemColor].
/// See [BottomNavigationBar.unselectedItemColor].
final
Color
?
unselectedItemColor
;
final
Color
?
unselectedItemColor
;
...
...
packages/flutter/lib/src/widgets/bottom_navigation_bar_item.dart
View file @
ccc82614
...
@@ -24,17 +24,11 @@ class BottomNavigationBarItem {
...
@@ -24,17 +24,11 @@ class BottomNavigationBarItem {
/// The argument [icon] should not be null and the argument [label] should not be null when used in a Material Design's [BottomNavigationBar].
/// The argument [icon] should not be null and the argument [label] should not be null when used in a Material Design's [BottomNavigationBar].
const
BottomNavigationBarItem
({
const
BottomNavigationBarItem
({
required
this
.
icon
,
required
this
.
icon
,
@Deprecated
(
'Use "label" instead, as it allows for an improved text-scaling experience. '
'This feature was deprecated after v1.19.0.'
,
)
this
.
title
,
this
.
label
,
this
.
label
,
Widget
?
activeIcon
,
Widget
?
activeIcon
,
this
.
backgroundColor
,
this
.
backgroundColor
,
this
.
tooltip
,
this
.
tooltip
,
})
:
activeIcon
=
activeIcon
??
icon
,
})
:
activeIcon
=
activeIcon
??
icon
,
assert
(
label
==
null
||
title
==
null
),
assert
(
icon
!=
null
);
assert
(
icon
!=
null
);
/// The icon of the item.
/// The icon of the item.
...
@@ -67,15 +61,6 @@ class BottomNavigationBarItem {
...
@@ -67,15 +61,6 @@ class BottomNavigationBarItem {
/// * [BottomNavigationBarItem.icon], for a description of how to pair icons.
/// * [BottomNavigationBarItem.icon], for a description of how to pair icons.
final
Widget
activeIcon
;
final
Widget
activeIcon
;
/// The title of the item. If the title is not provided only the icon will be shown when not used in a Material Design [BottomNavigationBar].
///
/// This field is deprecated, use [label] instead.
@Deprecated
(
'Use "label" instead, as it allows for an improved text-scaling experience. '
'This feature was deprecated after v1.19.0.'
,
)
final
Widget
?
title
;
/// The text label for this [BottomNavigationBarItem].
/// The text label for this [BottomNavigationBarItem].
///
///
/// This will be used to create a [Text] widget to put in the bottom navigation bar.
/// This will be used to create a [Text] widget to put in the bottom navigation bar.
...
...
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
View file @
ccc82614
...
@@ -429,7 +429,7 @@ Future<void> main() async {
...
@@ -429,7 +429,7 @@ Future<void> main() async {
semantics
.
dispose
();
semantics
.
dispose
();
});
});
testWidgets
(
'
Title
of items should be nullable'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'
Label
of items should be nullable'
,
(
WidgetTester
tester
)
async
{
final
MemoryImage
iconProvider
=
MemoryImage
(
Uint8List
.
fromList
(
kTransparentImage
));
final
MemoryImage
iconProvider
=
MemoryImage
(
Uint8List
.
fromList
(
kTransparentImage
));
final
List
<
int
>
itemsTapped
=
<
int
>[];
final
List
<
int
>
itemsTapped
=
<
int
>[];
...
...
packages/flutter/test/material/bottom_navigation_bar_test.dart
View file @
ccc82614
This diff is collapsed.
Click to expand it.
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