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> {
...
@@ -88,6 +88,8 @@ class ShrinePageState extends State<ShrinePage> {
appBar:
new
AppBar
(
appBar:
new
AppBar
(
elevation:
_appBarElevation
,
elevation:
_appBarElevation
,
backgroundColor:
Theme
.
of
(
context
).
cardColor
,
backgroundColor:
Theme
.
of
(
context
).
cardColor
,
iconTheme:
Theme
.
of
(
context
).
iconTheme
,
brightness:
Brightness
.
light
,
flexibleSpace:
new
Container
(
flexibleSpace:
new
Container
(
decoration:
new
BoxDecoration
(
decoration:
new
BoxDecoration
(
border:
new
Border
(
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;
...
@@ -14,13 +14,11 @@ import 'shrine/shrine_theme.dart' show ShrineTheme;
// isn't a standalone app with its own main() and MaterialApp.
// isn't a standalone app with its own main() and MaterialApp.
Widget
buildShrine
(
Widget
child
)
{
Widget
buildShrine
(
Widget
child
)
{
return
new
Theme
(
return
new
Theme
(
data:
new
ThemeData
(
primarySwatch:
Colors
.
grey
),
data:
new
ThemeData
(
child:
new
IconTheme
(
primarySwatch:
Colors
.
grey
,
data:
new
IconThemeData
(
color:
const
Color
(
0xFF707070
)),
iconTheme:
new
IconThemeData
(
color:
const
Color
(
0xFF707070
))
child:
new
ShrineTheme
(
),
child:
child
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 {
...
@@ -46,10 +46,6 @@ abstract class AppBarBottomWidget extends Widget {
/// AppBar's [collapsedHeight] and [bottomHeight] define how small the app bar
/// AppBar's [collapsedHeight] and [bottomHeight] define how small the app bar
/// will become when the application is scrolled.
/// 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:
/// See also:
///
///
/// * [Scaffold]
/// * [Scaffold]
...
@@ -72,6 +68,7 @@ class AppBar extends StatelessWidget {
...
@@ -72,6 +68,7 @@ class AppBar extends StatelessWidget {
this
.
elevation
:
4
,
this
.
elevation
:
4
,
this
.
backgroundColor
,
this
.
backgroundColor
,
this
.
brightness
,
this
.
brightness
,
this
.
iconTheme
,
this
.
textTheme
,
this
.
textTheme
,
this
.
padding
:
EdgeInsets
.
zero
,
this
.
padding
:
EdgeInsets
.
zero
,
double
expandedHeight
,
double
expandedHeight
,
...
@@ -120,23 +117,26 @@ class AppBar extends StatelessWidget {
...
@@ -120,23 +117,26 @@ class AppBar extends StatelessWidget {
/// The following elevations have defined shadows: 1, 2, 3, 4, 6, 8, 9, 12, 16, 24
/// The following elevations have defined shadows: 1, 2, 3, 4, 6, 8, 9, 12, 16, 24
final
int
elevation
;
final
int
elevation
;
/// The color to use for the app bar's material. T
his generally
should be set
/// The color to use for the app bar's material. T
ypically this
should be set
///
in tandem with [brightness
].
///
along with [brightness], [iconTheme], [textTheme
].
///
///
/// Defaults to [ThemeData.primaryColor].
/// Defaults to [ThemeData.primaryColor].
final
Color
backgroundColor
;
final
Color
backgroundColor
;
/// The brightness of the app bar's material. This generally should be set in
/// The brightness of the app bar's material. Typically this is set along
/// tandem with [backgroundColor].
/// with [backgroundColor], [iconTheme], [textTheme].
///
/// Defaults to [ThemeData.brightness].
///
///
/// Icons within the app bar will continue to use
/// Defaults to [ThemeData.primaryColorBrightness].
/// [ThemeData.primaryIconTheme]. If this clashes with the brightness
/// specified here, consider using an [IconTheme] inside the [AppBar].
final
Brightness
brightness
;
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].
/// Defaults to [ThemeData.primaryTextTheme].
final
TextTheme
textTheme
;
final
TextTheme
textTheme
;
...
@@ -175,6 +175,7 @@ class AppBar extends StatelessWidget {
...
@@ -175,6 +175,7 @@ class AppBar extends StatelessWidget {
elevation:
elevation
??
this
.
elevation
,
elevation:
elevation
??
this
.
elevation
,
backgroundColor:
backgroundColor
??
this
.
backgroundColor
,
backgroundColor:
backgroundColor
??
this
.
backgroundColor
,
brightness:
brightness
??
this
.
brightness
,
brightness:
brightness
??
this
.
brightness
,
iconTheme:
iconTheme
??
this
.
iconTheme
,
textTheme:
textTheme
??
this
.
textTheme
,
textTheme:
textTheme
??
this
.
textTheme
,
padding:
padding
??
this
.
padding
,
padding:
padding
??
this
.
padding
,
expandedHeight:
expandedHeight
??
this
.
_expandedHeight
,
expandedHeight:
expandedHeight
??
this
.
_expandedHeight
,
...
@@ -215,11 +216,11 @@ class AppBar extends StatelessWidget {
...
@@ -215,11 +216,11 @@ class AppBar extends StatelessWidget {
final
double
statusBarHeight
=
MediaQuery
.
of
(
context
).
padding
.
top
;
final
double
statusBarHeight
=
MediaQuery
.
of
(
context
).
padding
.
top
;
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
ThemeData
theme
=
Theme
.
of
(
context
);
IconThemeData
iconTheme
=
theme
.
primaryIconTheme
;
IconThemeData
appBarIconTheme
=
iconTheme
??
theme
.
primaryIconTheme
;
TextStyle
centerStyle
=
textTheme
?.
title
??
theme
.
primaryTextTheme
.
title
;
TextStyle
centerStyle
=
textTheme
?.
title
??
theme
.
primaryTextTheme
.
title
;
TextStyle
sideStyle
=
textTheme
?.
body1
??
theme
.
primaryTextTheme
.
body1
;
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
SystemChrome
.
setSystemUIOverlayStyle
(
brightness
==
Brightness
.
dark
?
mojom
.
SystemUiOverlayStyle
.
light
?
mojom
.
SystemUiOverlayStyle
.
light
:
mojom
.
SystemUiOverlayStyle
.
dark
);
:
mojom
.
SystemUiOverlayStyle
.
dark
);
...
@@ -231,8 +232,8 @@ class AppBar extends StatelessWidget {
...
@@ -231,8 +232,8 @@ class AppBar extends StatelessWidget {
centerStyle
=
centerStyle
.
copyWith
(
color:
centerStyle
.
color
.
withOpacity
(
opacity
));
centerStyle
=
centerStyle
.
copyWith
(
color:
centerStyle
.
color
.
withOpacity
(
opacity
));
if
(
sideStyle
?.
color
!=
null
)
if
(
sideStyle
?.
color
!=
null
)
sideStyle
=
sideStyle
.
copyWith
(
color:
sideStyle
.
color
.
withOpacity
(
opacity
));
sideStyle
=
sideStyle
.
copyWith
(
color:
sideStyle
.
color
.
withOpacity
(
opacity
));
iconTheme
=
i
conTheme
.
copyWith
(
appBarIconTheme
=
appBarI
conTheme
.
copyWith
(
opacity:
opacity
*
(
i
conTheme
.
opacity
??
1.0
)
opacity:
opacity
*
(
appBarI
conTheme
.
opacity
??
1.0
)
);
);
}
}
...
@@ -262,7 +263,7 @@ class AppBar extends StatelessWidget {
...
@@ -262,7 +263,7 @@ class AppBar extends StatelessWidget {
height:
kToolBarHeight
,
height:
kToolBarHeight
,
child:
new
IconTheme
.
merge
(
child:
new
IconTheme
.
merge
(
context:
context
,
context:
context
,
data:
i
conTheme
,
data:
appBarI
conTheme
,
child:
new
DefaultTextStyle
(
child:
new
DefaultTextStyle
(
style:
sideStyle
,
style:
sideStyle
,
child:
new
Row
(
children:
toolBarRow
)
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