From 852d69ce2736d0b3b5a4bc9f8002f41f9d9cf1ff Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Tue, 14 Nov 2023 16:37:21 -0800 Subject: [PATCH] add onPressed --- .../standalone_ui/vs_code/debug_sessions.dart | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/devtools_app/lib/src/standalone_ui/vs_code/debug_sessions.dart b/packages/devtools_app/lib/src/standalone_ui/vs_code/debug_sessions.dart index 75fde56b67c..35b6dc05f6c 100644 --- a/packages/devtools_app/lib/src/standalone_ui/vs_code/debug_sessions.dart +++ b/packages/devtools_app/lib/src/standalone_ui/vs_code/debug_sessions.dart @@ -228,7 +228,25 @@ class _DevToolsMenuState extends State<_DevToolsMenu> { builder: (context, extensions, _) { return extensions.isEmpty ? const SizedBox.shrink() - : ExtensionScreenMenuItem(extensions: extensions); + : ExtensionScreenMenuItem( + extensions: extensions, + onPressed: (e) { + ga.select( + gac.VsCodeFlutterSidebar.id, + gac.VsCodeFlutterSidebar.openDevToolsScreen( + gac.DevToolsExtensionEvents.extensionScreenName( + e, + ), + ), + ); + unawaited( + widget.api.openDevToolsPage( + widget.session.id, + e.screenId, + ), + ); + }, + ); }, ), ], @@ -301,10 +319,16 @@ class DevToolsScreenMenuItem extends StatelessWidget { } class ExtensionScreenMenuItem extends StatelessWidget { - const ExtensionScreenMenuItem({super.key, required this.extensions}); + const ExtensionScreenMenuItem({ + super.key, + required this.extensions, + required this.onPressed, + }); final List extensions; + final void Function(DevToolsExtensionConfig) onPressed; + @override Widget build(BuildContext context) { return SubmenuButton( @@ -316,9 +340,7 @@ class ExtensionScreenMenuItem extends StatelessWidget { (e) => DevToolsScreenMenuItem( title: e.name, icon: e.icon, - // TODO: this should open the extension screen in the browser, - // or if possible, in an embedded iFrame in VS code. - onPressed: () {}, + onPressed: () => onPressed(e), ), ) .toList(),