update conditions for showing context menu items

This commit is contained in:
Adam Velebil 2024-01-23 14:41:29 +01:00
parent dfdf82805c
commit a61012f563
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10

View File

@ -299,12 +299,12 @@ class _DeviceRowState extends ConsumerState<_DeviceRow> {
} }
return GestureDetector( return GestureDetector(
onSecondaryTapDown: isDesktop onSecondaryTapDown: isDesktop && menuItems.isNotEmpty
? (details) { ? (details) {
showMenuFn(details); showMenuFn(details);
} }
: null, : null,
onDoubleTapDown: isAndroid onLongPressStart: isAndroid
? (details) { ? (details) {
showMenuFn(details); showMenuFn(details);
} }
@ -313,13 +313,13 @@ class _DeviceRowState extends ConsumerState<_DeviceRow> {
padding: const EdgeInsets.symmetric(vertical: 6.5), padding: const EdgeInsets.symmetric(vertical: 6.5),
child: widget.selected child: widget.selected
? IconButton.filled( ? IconButton.filled(
tooltip: tooltip, tooltip: isDesktop ? tooltip : null,
icon: widget.leading, icon: widget.leading,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
onPressed: widget.onTap, onPressed: widget.onTap,
) )
: IconButton( : IconButton(
tooltip: tooltip, tooltip: isDesktop ? tooltip : null,
icon: widget.leading, icon: widget.leading,
padding: const EdgeInsets.symmetric(horizontal: 8), padding: const EdgeInsets.symmetric(horizontal: 8),
onPressed: widget.onTap, onPressed: widget.onTap,
@ -350,7 +350,6 @@ class _DeviceRowState extends ConsumerState<_DeviceRow> {
if (serial != null) if (serial != null)
PopupMenuItem( PopupMenuItem(
enabled: true, enabled: true,
value: 0,
onTap: () async { onTap: () async {
await ref.read(withContextProvider)((context) async { await ref.read(withContextProvider)((context) async {
await _showKeyCustomizationDialog(manager, context, node, serial); await _showKeyCustomizationDialog(manager, context, node, serial);
@ -363,7 +362,7 @@ class _DeviceRowState extends ConsumerState<_DeviceRow> {
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
enabled: true), enabled: true),
), ),
if (hidden.isNotEmpty) if (isDesktop && hidden.isNotEmpty)
PopupMenuItem( PopupMenuItem(
enabled: hidden.isNotEmpty, enabled: hidden.isNotEmpty,
onTap: () { onTap: () {
@ -377,7 +376,7 @@ class _DeviceRowState extends ConsumerState<_DeviceRow> {
enabled: hidden.isNotEmpty, enabled: hidden.isNotEmpty,
), ),
), ),
if (node != null) if (isDesktop && node is NfcReaderNode)
PopupMenuItem( PopupMenuItem(
onTap: () { onTap: () {
ref.read(_hiddenDevicesProvider.notifier).hideDevice(node.path); ref.read(_hiddenDevicesProvider.notifier).hideDevice(node.path);