From 1329c8c2bda126d7be2b69595f79da4efeb74f47 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 15 May 2025 12:55:21 -0700 Subject: [PATCH] [Widget Inspector] Fix missing cupertino icon in on-device inspector (#168847) Resolves https://github.com/flutter/flutter/issues/168846 This is a follow-up to https://github.com/flutter/flutter/pull/167677. For apps that do not import `package:cupertino_icons`, the new on-device button's icon shows up as a `[?]`. This fix: * adds an explicit dependency on `package:cupertino_icons` to the framework * imports `CupertinoIcons` into `lib/src/widgets/app.dart` *Note: For some reason, adding the import to `packages/flutter/lib/src/material/app.dart` and `packages/flutter/lib/src/cupertino/app.dart` did not resolve the issue. That's why I've added it to `lib/src/widgets/app.dart`, even though it's not actually used in that file.* **Let me know if this is acceptable!** (cc @Piinks) I'm guessing we might not want to add a dependency on `cupertino_icons` to the Framework (this might even be breaking change?) so if not, it might make sense to use a different icon for the on-device inspector. Thanks! --- packages/flutter/lib/src/cupertino/app.dart | 6 +++--- packages/flutter/lib/src/material/app.dart | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/flutter/lib/src/cupertino/app.dart b/packages/flutter/lib/src/cupertino/app.dart index 449eedb3405..d2caad7ebff 100644 --- a/packages/flutter/lib/src/cupertino/app.dart +++ b/packages/flutter/lib/src/cupertino/app.dart @@ -568,9 +568,9 @@ class _CupertinoAppState extends State { return _CupertinoInspectorButton.toggle( onPressed: onPressed, semanticsLabel: semanticsLabel, - // This icon is also used for the Material-styled button and for DevTools. - // It should be updated in all 3 places if changed. - icon: CupertinoIcons.cursor_rays, + // This unicode icon is also used for the Material-styled button and for + // DevTools. It should be updated in all 3 places if changed. + icon: const IconData(0x1F74A), toggledOn: selectionOnTapEnabled, ); } diff --git a/packages/flutter/lib/src/material/app.dart b/packages/flutter/lib/src/material/app.dart index e40ccd51e79..f1852af900c 100644 --- a/packages/flutter/lib/src/material/app.dart +++ b/packages/flutter/lib/src/material/app.dart @@ -970,9 +970,9 @@ class _MaterialAppState extends State { return _MaterialInspectorButton.toggle( onPressed: onPressed, semanticsLabel: semanticsLabel, - // This icon is also used for the Cupertino-styled button and for DevTools. - // It should be updated in all 3 places if changed. - icon: CupertinoIcons.cursor_rays, + // This unicode icon is also used for the Cupertino-styled button and for + // DevTools. It should be updated in all 3 places if changed. + icon: const IconData(0x1F74A), isDarkTheme: _isDarkTheme(context), toggledOn: selectionOnTapEnabled, );