A graphical icon widget drawn with a glyph from a font described in an IconData such as material’s predefined IconDatas in Icons.
Icons are not interactive. For an interactive icon, consider material’s IconButton.
There must be an ambient Directionality widget when using Icon. Typically this is introduced automatically by the WidgetsApp or MaterialApp.
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
Icon(
Icons.favorite,
color: Colors.pink,
size: 24.0,
semanticLabel: 'Text to announce in accessibility modes',
),
Icon(
Icons.audiotrack,
color: Colors.green,
size: 30.0,
),
Icon(
Icons.beach_access,
color: Colors.blue,
size: 36.0,
),
],
)
See also:
- IconButton, for interactive icons.
- Icons, for the list of available icons for use with this class.
- IconTheme, which provides ambient configuration for icons.
- ImageIcon, for showing icons from AssetImages or other ImageProviders.
Constructors
Icon(IconData icon, { Key key, double size, Color color, String semanticLabel, TextDirection textDirection })Creates an icon. […]