Anywhere that accepted IconData now accepts either an Icon or an
ImageIcon.

Places that used to take an IconData in an `icon` argument, notably
IconButton and DrawerItem, now take a Widget in that slot. You can wrap
the value that used to be passed in in an Icon constructor to get the
same result.

Icon itself now takes the icon as a positional argument, for brevity.

ThemeData now has an iconTheme as well as a primaryIconTheme, the same
way it has had a textTheme and primaryTextTheme for a while.

IconTheme.of() always returns a value now (though that value itself may
have nulls in it). It defaults to the ThemeData.iconTheme.

IconThemeData.fallback() is a new method that returns an icon theme data
structure with all fields filled in.

IconTheme.merge() is a new constructor that takes a context and creates
a widget that mixes in the new values with the inherited values.

Most places that introduced an IconTheme widget now use IconTheme.merge.

IconThemeData.merge and IconThemeData.copyWith act in a way analogous to
the similarly-named members of TextStyle.

ImageIcon is introduced. It acts like Icon but takes an ImageProvider
instead of an IconData.

Also: Fix the analyzer to actually check the stocks app.
This commit is contained in:
Ian Hickson
2016-06-20 21:04:45 -07:00
committed by GitHub
parent e071f0bafd
commit e502e9c8f8
57 changed files with 554 additions and 237 deletions

View File

@@ -75,7 +75,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
title: new Text('Advanced Layout'),
actions: <Widget>[
new IconButton(
icon: Icons.create,
icon: new Icon(Icons.create),
tooltip: 'Search',
onPressed: () {
print('Pressed search');
@@ -162,7 +162,7 @@ class MenuItemWithIcon extends StatelessWidget {
Widget build(BuildContext context) {
return new Row(
children: <Widget>[
new Icon(icon: icon),
new Icon(icon),
new Padding(
padding: new EdgeInsets.only(left: 8.0, right: 8.0),
child: new Text(title)
@@ -263,7 +263,10 @@ class IconWithText extends StatelessWidget {
return new Row(
mainAxisAlignment: MainAxisAlignment.collapse,
children: <Widget>[
new IconButton(icon: icon, onPressed: () { print('Pressed $title button'); } ),
new IconButton(
icon: new Icon(icon),
onPressed: () { print('Pressed $title button'); }
),
new Text(title)
]
);
@@ -290,7 +293,7 @@ class MiniIconWithText extends StatelessWidget {
backgroundColor: Theme.of(context).primaryColor,
shape: BoxShape.circle
),
child: new Icon(icon: icon, color: Colors.white, size: 12.0)
child: new Icon(icon, color: Colors.white, size: 12.0)
)
),
new Text(title, style: Theme.of(context).textTheme.caption)
@@ -347,7 +350,7 @@ class UserHeader extends StatelessWidget {
new Row(
children: <Widget>[
new Text('Yesterday at 11:55 • ', style: Theme.of(context).textTheme.caption),
new Icon(icon: Icons.people, size: 16.0, color: Theme.of(context).textTheme.caption.color)
new Icon(Icons.people, size: 16.0, color: Theme.of(context).textTheme.caption.color)
]
)
]
@@ -392,8 +395,14 @@ class ItemImageBox extends StatelessWidget {
child: new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new IconButton(icon: Icons.edit, onPressed: () { print('Pressed edit button'); }),
new IconButton(icon: Icons.zoom_in, onPressed: () { print('Pressed zoom button'); })
new IconButton(
icon: new Icon(Icons.edit),
onPressed: () { print('Pressed edit button'); }
),
new IconButton(
icon: new Icon(Icons.zoom_in),
onPressed: () { print('Pressed zoom button'); }
),
]
)
),
@@ -483,11 +492,11 @@ class ItemGalleryBox extends StatelessWidget {
new Row(
children: <Widget>[
new IconButton(
icon: Icons.share,
icon: new Icon(Icons.share),
onPressed: () { print('Pressed share'); }
),
new IconButton(
icon: Icons.event,
icon: new Icon(Icons.event),
onPressed: () { print('Pressed event'); }
),
new Flexible(
@@ -555,7 +564,7 @@ class BottomBarButton extends StatelessWidget {
child: new Column(
children: <Widget>[
new IconButton(
icon: icon,
icon: new Icon(icon),
onPressed: () { print('Pressed: $title'); }
),
new Text(title, style: Theme.of(context).textTheme.caption)
@@ -579,7 +588,7 @@ class GalleryDrawer extends StatelessWidget {
children: <Widget>[
new FancyDrawerHeader(),
new DrawerItem(
icon: Icons.brightness_5,
icon: new Icon(Icons.brightness_5),
onPressed: () { _changeTheme(context, true); },
selected: ComplexLayoutApp.of(context).lightTheme,
child: new Row(
@@ -594,7 +603,7 @@ class GalleryDrawer extends StatelessWidget {
)
),
new DrawerItem(
icon: Icons.brightness_7,
icon: new Icon(Icons.brightness_7),
onPressed: () { _changeTheme(context, false); },
selected: !ComplexLayoutApp.of(context).lightTheme,
child: new Row(
@@ -610,7 +619,7 @@ class GalleryDrawer extends StatelessWidget {
),
new Divider(),
new DrawerItem(
icon: Icons.hourglass_empty,
icon: new Icon(Icons.hourglass_empty),
selected: timeDilation != 1.0,
onPressed: () { ComplexLayoutApp.of(context).toggleAnimationSpeed(); },
child: new Row(