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
e82454fb
Unverified
Commit
e82454fb
authored
Apr 20, 2020
by
MH Johnson
Committed by
GitHub
Apr 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Material] Added BottomNavigationBarTheme (#54714)
parent
f050ee67
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
641 additions
and
66 deletions
+641
-66
material.dart
packages/flutter/lib/material.dart
+1
-0
bottom_navigation_bar.dart
packages/flutter/lib/src/material/bottom_navigation_bar.dart
+83
-64
bottom_navigation_bar_theme.dart
...flutter/lib/src/material/bottom_navigation_bar_theme.dart
+261
-0
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+18
-2
bottom_navigation_bar_theme_test.dart
...utter/test/material/bottom_navigation_bar_theme_test.dart
+274
-0
theme_data_test.dart
packages/flutter/test/material/theme_data_test.dart
+4
-0
No files found.
packages/flutter/lib/material.dart
View file @
e82454fb
...
...
@@ -28,6 +28,7 @@ export 'src/material/banner_theme.dart';
export
'src/material/bottom_app_bar.dart'
;
export
'src/material/bottom_app_bar_theme.dart'
;
export
'src/material/bottom_navigation_bar.dart'
;
export
'src/material/bottom_navigation_bar_theme.dart'
;
export
'src/material/bottom_sheet.dart'
;
export
'src/material/bottom_sheet_theme.dart'
;
export
'src/material/button.dart'
;
...
...
packages/flutter/lib/src/material/bottom_navigation_bar.dart
View file @
e82454fb
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart
0 → 100644
View file @
e82454fb
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/theme_data.dart
View file @
e82454fb
...
...
@@ -12,6 +12,7 @@ import 'package:flutter/widgets.dart';
import
'app_bar_theme.dart'
;
import
'banner_theme.dart'
;
import
'bottom_app_bar_theme.dart'
;
import
'bottom_navigation_bar_theme.dart'
;
import
'bottom_sheet_theme.dart'
;
import
'button_bar_theme.dart'
;
import
'button_theme.dart'
;
...
...
@@ -266,6 +267,7 @@ class ThemeData with Diagnosticable {
MaterialBannerThemeData
bannerTheme
,
DividerThemeData
dividerTheme
,
ButtonBarThemeData
buttonBarTheme
,
BottomNavigationBarThemeData
bottomNavigationBarTheme
,
})
{
brightness
??=
Brightness
.
light
;
final
bool
isDark
=
brightness
==
Brightness
.
dark
;
...
...
@@ -374,6 +376,7 @@ class ThemeData with Diagnosticable {
bannerTheme
??=
const
MaterialBannerThemeData
();
dividerTheme
??=
const
DividerThemeData
();
buttonBarTheme
??=
const
ButtonBarThemeData
();
bottomNavigationBarTheme
??=
const
BottomNavigationBarThemeData
();
return
ThemeData
.
raw
(
brightness:
brightness
,
...
...
@@ -440,6 +443,7 @@ class ThemeData with Diagnosticable {
bannerTheme:
bannerTheme
,
dividerTheme:
dividerTheme
,
buttonBarTheme:
buttonBarTheme
,
bottomNavigationBarTheme:
bottomNavigationBarTheme
,
);
}
...
...
@@ -518,6 +522,7 @@ class ThemeData with Diagnosticable {
@required
this
.
bannerTheme
,
@required
this
.
dividerTheme
,
@required
this
.
buttonBarTheme
,
@required
this
.
bottomNavigationBarTheme
,
})
:
assert
(
brightness
!=
null
),
assert
(
visualDensity
!=
null
),
assert
(
primaryColor
!=
null
),
...
...
@@ -578,7 +583,8 @@ class ThemeData with Diagnosticable {
assert
(
popupMenuTheme
!=
null
),
assert
(
bannerTheme
!=
null
),
assert
(
dividerTheme
!=
null
),
assert
(
buttonBarTheme
!=
null
);
assert
(
buttonBarTheme
!=
null
),
assert
(
bottomNavigationBarTheme
!=
null
);
/// Create a [ThemeData] based on the colors in the given [colorScheme] and
/// text styles of the optional [textTheme].
...
...
@@ -1025,6 +1031,10 @@ class ThemeData with Diagnosticable {
/// A theme for customizing the appearance and layout of [ButtonBar] widgets.
final
ButtonBarThemeData
buttonBarTheme
;
/// A theme for customizing the appearance and layout of [BottomNavigationBar]
/// widgets.
final
BottomNavigationBarThemeData
bottomNavigationBarTheme
;
/// Creates a copy of this theme but with the given fields replaced with the new values.
ThemeData
copyWith
({
Brightness
brightness
,
...
...
@@ -1091,6 +1101,7 @@ class ThemeData with Diagnosticable {
MaterialBannerThemeData
bannerTheme
,
DividerThemeData
dividerTheme
,
ButtonBarThemeData
buttonBarTheme
,
BottomNavigationBarThemeData
bottomNavigationBarTheme
,
})
{
cupertinoOverrideTheme
=
cupertinoOverrideTheme
?.
noDefault
();
return
ThemeData
.
raw
(
...
...
@@ -1158,6 +1169,7 @@ class ThemeData with Diagnosticable {
bannerTheme:
bannerTheme
??
this
.
bannerTheme
,
dividerTheme:
dividerTheme
??
this
.
dividerTheme
,
buttonBarTheme:
buttonBarTheme
??
this
.
buttonBarTheme
,
bottomNavigationBarTheme:
bottomNavigationBarTheme
??
this
.
bottomNavigationBarTheme
,
);
}
...
...
@@ -1303,6 +1315,7 @@ class ThemeData with Diagnosticable {
bannerTheme:
MaterialBannerThemeData
.
lerp
(
a
.
bannerTheme
,
b
.
bannerTheme
,
t
),
dividerTheme:
DividerThemeData
.
lerp
(
a
.
dividerTheme
,
b
.
dividerTheme
,
t
),
buttonBarTheme:
ButtonBarThemeData
.
lerp
(
a
.
buttonBarTheme
,
b
.
buttonBarTheme
,
t
),
bottomNavigationBarTheme:
BottomNavigationBarThemeData
.
lerp
(
a
.
bottomNavigationBarTheme
,
b
.
bottomNavigationBarTheme
,
t
),
);
}
...
...
@@ -1375,7 +1388,8 @@ class ThemeData with Diagnosticable {
&&
other
.
popupMenuTheme
==
popupMenuTheme
&&
other
.
bannerTheme
==
bannerTheme
&&
other
.
dividerTheme
==
dividerTheme
&&
other
.
buttonBarTheme
==
buttonBarTheme
;
&&
other
.
buttonBarTheme
==
buttonBarTheme
&&
other
.
bottomNavigationBarTheme
==
bottomNavigationBarTheme
;
}
@override
...
...
@@ -1448,6 +1462,7 @@ class ThemeData with Diagnosticable {
bannerTheme
,
dividerTheme
,
buttonBarTheme
,
bottomNavigationBarTheme
,
];
return
hashList
(
values
);
}
...
...
@@ -1516,6 +1531,7 @@ class ThemeData with Diagnosticable {
properties
.
add
(
DiagnosticsProperty
<
MaterialBannerThemeData
>(
'bannerTheme'
,
bannerTheme
,
defaultValue:
defaultData
.
bannerTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
DividerThemeData
>(
'dividerTheme'
,
dividerTheme
,
defaultValue:
defaultData
.
dividerTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
ButtonBarThemeData
>(
'buttonBarTheme'
,
buttonBarTheme
,
defaultValue:
defaultData
.
buttonBarTheme
,
level:
DiagnosticLevel
.
debug
));
properties
.
add
(
DiagnosticsProperty
<
BottomNavigationBarThemeData
>(
'bottomNavigationBarTheme'
,
bottomNavigationBarTheme
,
defaultValue:
defaultData
.
bottomNavigationBarTheme
,
level:
DiagnosticLevel
.
debug
));
}
}
...
...
packages/flutter/test/material/bottom_navigation_bar_theme_test.dart
0 → 100644
View file @
e82454fb
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/theme_data_test.dart
View file @
e82454fb
...
...
@@ -280,6 +280,7 @@ void main() {
bannerTheme:
const
MaterialBannerThemeData
(
backgroundColor:
Colors
.
black
),
dividerTheme:
const
DividerThemeData
(
color:
Colors
.
black
),
buttonBarTheme:
const
ButtonBarThemeData
(
alignment:
MainAxisAlignment
.
start
),
bottomNavigationBarTheme:
const
BottomNavigationBarThemeData
(
type:
BottomNavigationBarType
.
fixed
),
);
final
SliderThemeData
otherSliderTheme
=
SliderThemeData
.
fromPrimaryColors
(
...
...
@@ -360,6 +361,7 @@ void main() {
bannerTheme:
const
MaterialBannerThemeData
(
backgroundColor:
Colors
.
white
),
dividerTheme:
const
DividerThemeData
(
color:
Colors
.
white
),
buttonBarTheme:
const
ButtonBarThemeData
(
alignment:
MainAxisAlignment
.
end
),
bottomNavigationBarTheme:
const
BottomNavigationBarThemeData
(
type:
BottomNavigationBarType
.
shifting
),
);
final
ThemeData
themeDataCopy
=
theme
.
copyWith
(
...
...
@@ -426,6 +428,7 @@ void main() {
bannerTheme:
otherTheme
.
bannerTheme
,
dividerTheme:
otherTheme
.
dividerTheme
,
buttonBarTheme:
otherTheme
.
buttonBarTheme
,
bottomNavigationBarTheme:
otherTheme
.
bottomNavigationBarTheme
,
);
expect
(
themeDataCopy
.
brightness
,
equals
(
otherTheme
.
brightness
));
...
...
@@ -493,6 +496,7 @@ void main() {
expect
(
themeDataCopy
.
bannerTheme
,
equals
(
otherTheme
.
bannerTheme
));
expect
(
themeDataCopy
.
dividerTheme
,
equals
(
otherTheme
.
dividerTheme
));
expect
(
themeDataCopy
.
buttonBarTheme
,
equals
(
otherTheme
.
buttonBarTheme
));
expect
(
themeDataCopy
.
bottomNavigationBarTheme
,
equals
(
otherTheme
.
bottomNavigationBarTheme
));
});
testWidgets
(
'ThemeData.toString has less than 200 characters output'
,
(
WidgetTester
tester
)
async
{
...
...
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