show custom keymap hint for gamepads

This commit is contained in:
Jonas Bark
2025-10-27 09:38:19 +01:00
parent e8ca3fc287
commit fec13d012b
4 changed files with 12 additions and 8 deletions

View File

@@ -151,6 +151,12 @@ class _DevicePageState extends State<DevicePage> with WidgetsBindingObserver {
Text('Enable auto-rotation on your device to make sure the app works correctly.'),
],
),
if (connection.gamepadDevices.isNotEmpty && actionHandler.supportedApp is! CustomApp)
Warning(
children: [
Text('Your gamepad requires a custom keymap to be able to use all buttons.'),
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Text('Connected Devices', style: Theme.of(context).textTheme.titleMedium),

View File

@@ -101,8 +101,11 @@ class _KeymapExplanationState extends State<KeymapExplanation> {
crossAxisAlignment: WrapCrossAlignment.center,
children: [
if (actionHandler.supportedApp is! CustomApp)
for (final button in keyPair.buttons.filter((b) => allAvailableButtons.contains(b)))
IntrinsicWidth(child: ButtonWidget(button: button))
if (keyPair.buttons.filter((b) => allAvailableButtons.contains(b)).isEmpty)
Text('No button assigned for your connected device')
else
for (final button in keyPair.buttons.filter((b) => allAvailableButtons.contains(b)))
IntrinsicWidth(child: ButtonWidget(button: button))
else
for (final button in keyPair.buttons) IntrinsicWidth(child: ButtonWidget(button: button)),
],

View File

@@ -8,6 +8,7 @@ class Warning extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 6),
width: double.infinity,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.errorContainer,
borderRadius: BorderRadius.circular(8),

View File

@@ -20,8 +20,6 @@ PODS:
- FlutterMacOS
- screen_retriever_macos (0.0.1):
- FlutterMacOS
- share_plus (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
@@ -46,7 +44,6 @@ DEPENDENCIES:
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- screen_retriever_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever_macos/macos`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- universal_ble (from `Flutter/ephemeral/.symlinks/plugins/universal_ble/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
@@ -74,8 +71,6 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
screen_retriever_macos:
:path: Flutter/ephemeral/.symlinks/plugins/screen_retriever_macos/macos
share_plus:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
universal_ble:
@@ -98,7 +93,6 @@ SPEC CHECKSUMS:
package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b
path_provider_foundation: 0b743cbb62d8e47eab856f09262bb8c1ddcfe6ba
screen_retriever_macos: 776e0fa5d42c6163d2bf772d22478df4b302b161
share_plus: 1fa619de8392a4398bfaf176d441853922614e89
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
universal_ble: cf52a7b3fd2e7c14d6d7262e9fdadb72ab6b88a6
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404