From 0125b03299f281292dd1b3eff6dd726c6bdbf268 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Mon, 8 Nov 2021 15:18:04 -0800 Subject: [PATCH] In CupertinoIcons doc adopt diagram and fix broken glyph map link (#93087) --- packages/flutter/lib/src/cupertino/icons.dart | 35 +++++++++++++++++-- packages/flutter/lib/src/material/icons.dart | 2 +- packages/flutter/lib/src/widgets/icon.dart | 2 +- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/packages/flutter/lib/src/cupertino/icons.dart b/packages/flutter/lib/src/cupertino/icons.dart index 270c1269d6..d214511b3a 100644 --- a/packages/flutter/lib/src/cupertino/icons.dart +++ b/packages/flutter/lib/src/cupertino/icons.dart @@ -21,11 +21,40 @@ import 'package:flutter/widgets.dart'; /// cupertino_icons: ^1.0.0 /// ``` /// -/// [![icon gallery preview](https://raw.githubusercontent.com/flutter/cupertino_icons/master/gallery_preview_1.0.0.png)](https://flutter.github.io/cupertino_icons) +/// {@tool snippet} /// -/// For versions 1.0.0 and above (available only on Flutter SDK versions 1.22+), see the [Cupertino Icons Gallery](https://flutter.github.io/cupertino_icons). +/// This example shows how to create a [Row] of Cupertino [Icon]s in different colors and +/// sizes. The first [Icon] uses a [Icon.semanticLabel] to announce in accessibility +/// modes like VoiceOver. /// -/// For versions 0.1.3 and below, see this [glyph map](https://raw.githubusercontent.com/flutter/cupertino_icons/master/map.png). +/// ![The following code snippet would generate a row of icons consisting of a pink heart, a green bell, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/cupertino/cupertino_icon.png) +/// +/// ```dart +/// Row( +/// mainAxisAlignment: MainAxisAlignment.spaceAround, +/// children: const [ +/// Icon( +/// CupertinoIcons.heart_fill, +/// color: Colors.pink, +/// size: 24.0, +/// semanticLabel: 'Text to announce in accessibility modes', +/// ), +/// Icon( +/// CupertinoIcons.bell_fill, +/// color: Colors.green, +/// size: 30.0, +/// ), +/// Icon( +/// CupertinoIcons.umbrella_fill, +/// color: Colors.blue, +/// size: 36.0, +/// ), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// +/// For versions 0.1.3 and below, see this [glyph map](https://raw.githubusercontent.com/flutter/packages/master/third_party/packages/cupertino_icons/map.png). /// /// See also: /// diff --git a/packages/flutter/lib/src/material/icons.dart b/packages/flutter/lib/src/material/icons.dart index 7d8b69abf0..65022b8e5d 100644 --- a/packages/flutter/lib/src/material/icons.dart +++ b/packages/flutter/lib/src/material/icons.dart @@ -116,7 +116,7 @@ class PlatformAdaptiveIcons implements Icons { /// sizes. The first [Icon] uses a [Icon.semanticLabel] to announce in accessibility /// modes like TalkBack and VoiceOver. /// -/// ![A row of icons representing a pink heart, a green musical note, and a blue umbrella](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png) +/// ![The following code snippet would generate a row of icons consisting of a pink heart, a green musical note, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png) /// /// ```dart /// Row( diff --git a/packages/flutter/lib/src/widgets/icon.dart b/packages/flutter/lib/src/widgets/icon.dart index dd97ffeae8..e5f158568f 100644 --- a/packages/flutter/lib/src/widgets/icon.dart +++ b/packages/flutter/lib/src/widgets/icon.dart @@ -30,7 +30,7 @@ import 'icon_theme_data.dart'; /// sizes. The first [Icon] uses a [semanticLabel] to announce in accessibility /// modes like TalkBack and VoiceOver. /// -/// ![A row of icons representing a pink heart, a green musical note, and a blue umbrella](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png) +/// ![The following code snippet would generate a row of icons consisting of a pink heart, a green musical note, and a blue umbrella, each progressively bigger than the last.](https://flutter.github.io/assets-for-api-docs/assets/widgets/icon.png) /// /// ```dart /// Row(