From 203891c9579c527eeea587245e0cbb0a64193a32 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Fri, 3 Nov 2023 20:12:52 +0530 Subject: [PATCH 1/2] fix change view dropdown not working on macos clicking Signed-off-by: Sahil Yeole --- flutter/lib/common/widgets/peer_tab_page.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index 4913e5212..7aad7269a 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -824,13 +824,14 @@ class _PeerViewDropdownState extends State { setState(() { menuPos = RelativeRect.fromLTRB(x, y, x, y); }); + showMenu( + context: context, + position: menuPos, + items: items, + elevation: 8, + ); }, - onTap: () => showMenu( - context: context, - position: menuPos, - items: items, - elevation: 8, - ), + onTap: () => {} ); } } From 0e702d8693a75817482c4fde6d964d1fdbf497df Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Sat, 4 Nov 2023 14:50:04 +0530 Subject: [PATCH 2/2] remove setState Signed-off-by: Sahil Yeole --- flutter/lib/common/widgets/peer_tab_page.dart | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart index 7aad7269a..970e74b73 100644 --- a/flutter/lib/common/widgets/peer_tab_page.dart +++ b/flutter/lib/common/widgets/peer_tab_page.dart @@ -765,8 +765,6 @@ class PeerViewDropdown extends StatefulWidget { } class _PeerViewDropdownState extends State { - RelativeRect menuPos = RelativeRect.fromLTRB(0, 0, 0, 0); - @override Widget build(BuildContext context) { final List types = [PeerUiType.grid, PeerUiType.tile, PeerUiType.list]; @@ -806,6 +804,7 @@ class _PeerViewDropdownState extends State { )))); } + var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0); return _hoverAction( context: context, child: Tooltip( @@ -821,17 +820,14 @@ class _PeerViewDropdownState extends State { onTapDown: (details) { final x = details.globalPosition.dx; final y = details.globalPosition.dy; - setState(() { - menuPos = RelativeRect.fromLTRB(x, y, x, y); - }); - showMenu( - context: context, - position: menuPos, - items: items, - elevation: 8, - ); + menuPos = RelativeRect.fromLTRB(x, y, x, y); }, - onTap: () => {} + onTap: () => showMenu( + context: context, + position: menuPos, + items: items, + elevation: 8, + ) ); } }