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
bb2e7b52
Commit
bb2e7b52
authored
Jun 22, 2016
by
Hans Muller
Committed by
GitHub
Jun 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add AppBar iconTheme parameter (#4693)
parent
e5eabf24
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
26 deletions
+27
-26
shrine_page.dart
examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
+2
-0
shrine_demo.dart
examples/flutter_gallery/lib/demo/shrine_demo.dart
+5
-7
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+20
-19
No files found.
examples/flutter_gallery/lib/demo/shrine/shrine_page.dart
View file @
bb2e7b52
...
...
@@ -88,6 +88,8 @@ class ShrinePageState extends State<ShrinePage> {
appBar:
new
AppBar
(
elevation:
_appBarElevation
,
backgroundColor:
Theme
.
of
(
context
).
cardColor
,
iconTheme:
Theme
.
of
(
context
).
iconTheme
,
brightness:
Brightness
.
light
,
flexibleSpace:
new
Container
(
decoration:
new
BoxDecoration
(
border:
new
Border
(
...
...
examples/flutter_gallery/lib/demo/shrine_demo.dart
View file @
bb2e7b52
...
...
@@ -14,13 +14,11 @@ import 'shrine/shrine_theme.dart' show ShrineTheme;
// isn't a standalone app with its own main() and MaterialApp.
Widget
buildShrine
(
Widget
child
)
{
return
new
Theme
(
data:
new
ThemeData
(
primarySwatch:
Colors
.
grey
),
child:
new
IconTheme
(
data:
new
IconThemeData
(
color:
const
Color
(
0xFF707070
)),
child:
new
ShrineTheme
(
child:
child
)
)
data:
new
ThemeData
(
primarySwatch:
Colors
.
grey
,
iconTheme:
new
IconThemeData
(
color:
const
Color
(
0xFF707070
))
),
child:
new
ShrineTheme
(
child:
child
)
);
}
...
...
packages/flutter/lib/src/material/app_bar.dart
View file @
bb2e7b52
...
...
@@ -46,10 +46,6 @@ abstract class AppBarBottomWidget extends Widget {
/// AppBar's [collapsedHeight] and [bottomHeight] define how small the app bar
/// will become when the application is scrolled.
///
/// By default, icons within an app bar will use the
/// [ThemeData.primaryIconTheme]. This can be overridden by nesting an
/// [IconTheme] inside the [AppBar].
///
/// See also:
///
/// * [Scaffold]
...
...
@@ -72,6 +68,7 @@ class AppBar extends StatelessWidget {
this
.
elevation
:
4
,
this
.
backgroundColor
,
this
.
brightness
,
this
.
iconTheme
,
this
.
textTheme
,
this
.
padding
:
EdgeInsets
.
zero
,
double
expandedHeight
,
...
...
@@ -120,23 +117,26 @@ class AppBar extends StatelessWidget {
/// The following elevations have defined shadows: 1, 2, 3, 4, 6, 8, 9, 12, 16, 24
final
int
elevation
;
/// The color to use for the app bar's material. T
his generally
should be set
///
in tandem with [brightness
].
/// The color to use for the app bar's material. T
ypically this
should be set
///
along with [brightness], [iconTheme], [textTheme
].
///
/// Defaults to [ThemeData.primaryColor].
final
Color
backgroundColor
;
/// The brightness of the app bar's material. This generally should be set in
/// tandem with [backgroundColor].
///
/// Defaults to [ThemeData.brightness].
/// The brightness of the app bar's material. Typically this is set along
/// with [backgroundColor], [iconTheme], [textTheme].
///
/// Icons within the app bar will continue to use
/// [ThemeData.primaryIconTheme]. If this clashes with the brightness
/// specified here, consider using an [IconTheme] inside the [AppBar].
/// Defaults to [ThemeData.primaryColorBrightness].
final
Brightness
brightness
;
/// The typographic style to use for text in the app bar.
/// The color, opacity, and size to use for app bar icons. Typically this
/// is set along with [backgroundColor], [brightness], [textTheme].
///
/// Defaults to [ThemeData.primaryIconTheme].
final
IconThemeData
iconTheme
;
/// The typographic styles to use for text in the app bar. Typically this is
/// set along with [brightness] [backgroundColor], [iconTheme].
///
/// Defaults to [ThemeData.primaryTextTheme].
final
TextTheme
textTheme
;
...
...
@@ -175,6 +175,7 @@ class AppBar extends StatelessWidget {
elevation:
elevation
??
this
.
elevation
,
backgroundColor:
backgroundColor
??
this
.
backgroundColor
,
brightness:
brightness
??
this
.
brightness
,
iconTheme:
iconTheme
??
this
.
iconTheme
,
textTheme:
textTheme
??
this
.
textTheme
,
padding:
padding
??
this
.
padding
,
expandedHeight:
expandedHeight
??
this
.
_expandedHeight
,
...
...
@@ -215,11 +216,11 @@ class AppBar extends StatelessWidget {
final
double
statusBarHeight
=
MediaQuery
.
of
(
context
).
padding
.
top
;
final
ThemeData
theme
=
Theme
.
of
(
context
);
IconThemeData
iconTheme
=
theme
.
primaryIconTheme
;
IconThemeData
appBarIconTheme
=
iconTheme
??
theme
.
primaryIconTheme
;
TextStyle
centerStyle
=
textTheme
?.
title
??
theme
.
primaryTextTheme
.
title
;
TextStyle
sideStyle
=
textTheme
?.
body1
??
theme
.
primaryTextTheme
.
body1
;
Brightness
brightness
=
this
.
brightness
??
theme
.
b
rightness
;
Brightness
brightness
=
this
.
brightness
??
theme
.
primaryColorB
rightness
;
SystemChrome
.
setSystemUIOverlayStyle
(
brightness
==
Brightness
.
dark
?
mojom
.
SystemUiOverlayStyle
.
light
:
mojom
.
SystemUiOverlayStyle
.
dark
);
...
...
@@ -231,8 +232,8 @@ class AppBar extends StatelessWidget {
centerStyle
=
centerStyle
.
copyWith
(
color:
centerStyle
.
color
.
withOpacity
(
opacity
));
if
(
sideStyle
?.
color
!=
null
)
sideStyle
=
sideStyle
.
copyWith
(
color:
sideStyle
.
color
.
withOpacity
(
opacity
));
iconTheme
=
i
conTheme
.
copyWith
(
opacity:
opacity
*
(
i
conTheme
.
opacity
??
1.0
)
appBarIconTheme
=
appBarI
conTheme
.
copyWith
(
opacity:
opacity
*
(
appBarI
conTheme
.
opacity
??
1.0
)
);
}
...
...
@@ -262,7 +263,7 @@ class AppBar extends StatelessWidget {
height:
kToolBarHeight
,
child:
new
IconTheme
.
merge
(
context:
context
,
data:
i
conTheme
,
data:
appBarI
conTheme
,
child:
new
DefaultTextStyle
(
style:
sideStyle
,
child:
new
Row
(
children:
toolBarRow
)
...
...
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