Commit 5ccfd948 authored by Ian Hickson's avatar Ian Hickson

Merge pull request #2347 from Hixie/accessible-icons

Hide icons in the accessibility tree.
parents 3d9e70ea c7c730d0
...@@ -9,11 +9,24 @@ import 'icons.dart'; ...@@ -9,11 +9,24 @@ import 'icons.dart';
import 'icon_theme.dart'; import 'icon_theme.dart';
import 'theme.dart'; import 'theme.dart';
/// A material design icon.
///
/// Available icons are shown on this page:
/// <https://design.google.com/icons/>
///
/// Icons are identified by their name (as given on that page), with
/// spaces converted to underscores, from the [Icons] class. For
/// example, the "alarm add" icon is [Icons.alarm_add].
///
/// To use this class, make sure you set `uses-material-design: true`
/// in your project's `flutter.yaml` file. This ensures that the
/// MaterialIcons font is included in your application. This font is
/// used to display the icons.
class Icon extends StatelessComponent { class Icon extends StatelessComponent {
Icon({ Icon({
Key key, Key key,
this.size: 24.0,
this.icon, this.icon,
this.size: 24.0,
this.color this.color
}) : super(key: key) { }) : super(key: key) {
assert(size != null); assert(size != null);
...@@ -52,11 +65,13 @@ class Icon extends StatelessComponent { ...@@ -52,11 +65,13 @@ class Icon extends StatelessComponent {
if (iconAlpha != 255) if (iconAlpha != 255)
iconColor = color.withAlpha((iconAlpha * color.opacity).round()); iconColor = color.withAlpha((iconAlpha * color.opacity).round());
return new SizedBox( return new ExcludeSemantics(
child: new SizedBox(
width: size, width: size,
height: size, height: size,
child: new Center( child: new Center(
child: new Text(new String.fromCharCode(icon.codePoint), child: new Text(
new String.fromCharCode(icon.codePoint),
style: new TextStyle( style: new TextStyle(
inherit: false, inherit: false,
color: iconColor, color: iconColor,
...@@ -65,6 +80,7 @@ class Icon extends StatelessComponent { ...@@ -65,6 +80,7 @@ class Icon extends StatelessComponent {
) )
) )
) )
)
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment