Skip to content

Commit

Permalink
add onPressed
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll committed Nov 15, 2023
1 parent c609e92 commit 852d69c
Showing 1 changed file with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
);
},
);
},
),
],
Expand Down Expand Up @@ -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<DevToolsExtensionConfig> extensions;

final void Function(DevToolsExtensionConfig) onPressed;

@override
Widget build(BuildContext context) {
return SubmenuButton(
Expand All @@ -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(),
Expand Down

0 comments on commit 852d69c

Please sign in to comment.