fix: Only focus in dpad mode

This commit is contained in:
PartyDonut 2025-10-26 18:17:42 +01:00
parent 0739247836
commit 39547163c3

View file

@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:fladder/util/adaptive_layout/adaptive_layout.dart';
abstract class ItemAction { abstract class ItemAction {
Widget toMenuItemButton(); Widget toMenuItemButton();
PopupMenuEntry toPopupMenuItem({bool useIcons = false}); PopupMenuEntry toPopupMenuItem({bool useIcons = false});
@ -100,7 +102,7 @@ class ItemActionButton extends ItemAction {
final foregroundColor = final foregroundColor =
selected ? Theme.of(context).colorScheme.onPrimaryContainer : Theme.of(context).colorScheme.onSurface; selected ? Theme.of(context).colorScheme.onPrimaryContainer : Theme.of(context).colorScheme.onSurface;
return ElevatedButton( return ElevatedButton(
autofocus: selected, autofocus: AdaptiveLayout.inputDeviceOf(context) == InputDevice.dPad && selected,
style: ButtonStyle( style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll( backgroundColor: WidgetStatePropertyAll(
selected ? Theme.of(context).colorScheme.primaryContainer : Colors.transparent, selected ? Theme.of(context).colorScheme.primaryContainer : Colors.transparent,