From 561ddd15ea95345f22bf41abc91545fc9fbdd7f4 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Mon, 2 Feb 2026 12:41:22 +0100 Subject: [PATCH] fix: replace gamepads library close #362 --- lib/services/gamepad_service.dart | 327 ++++++++++-------- linux/flutter/generated_plugin_registrant.cc | 8 +- linux/flutter/generated_plugins.cmake | 2 +- macos/Flutter/GeneratedPluginRegistrant.swift | 4 +- macos/Podfile.lock | 12 +- pubspec.lock | 82 +---- pubspec.yaml | 2 +- .../flutter/generated_plugin_registrant.cc | 6 +- windows/flutter/generated_plugins.cmake | 2 +- 9 files changed, 202 insertions(+), 243 deletions(-) diff --git a/lib/services/gamepad_service.dart b/lib/services/gamepad_service.dart index fb086c99..a8c363b3 100644 --- a/lib/services/gamepad_service.dart +++ b/lib/services/gamepad_service.dart @@ -4,14 +4,14 @@ import 'dart:io'; import 'package:flutter/scheduler.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter/services.dart'; -import 'package:gamepads/gamepads.dart'; +import 'package:universal_gamepad/universal_gamepad.dart'; import '../utils/app_logger.dart'; /// Service that bridges gamepad input to Flutter's focus navigation system. /// -/// Listens to gamepad events from the `gamepads` package and translates them -/// into focus navigation actions and key events that integrate with the +/// Listens to gamepad events from the `universal_gamepad` package and translates +/// them into focus navigation actions and key events that integrate with the /// existing keyboard navigation system. class GamepadService { static GamepadService? _instance; @@ -32,20 +32,20 @@ class GamepadService { // Deadzone for analog sticks (0.0 to 1.0) static const double _stickDeadzone = 0.5; - // Track D-pad state to avoid repeated navigation events - bool _dpadUp = false; - bool _dpadDown = false; - bool _dpadLeft = false; - bool _dpadRight = false; + // Auto-repeat timing for held directional inputs (D-pad / stick) + static const Duration _repeatInitialDelay = Duration(milliseconds: 400); + static const Duration _repeatInterval = Duration(milliseconds: 80); - // Track stick state to avoid repeated navigation events + Timer? _repeatTimer; + + // Track stick state to detect deadzone crossings bool _leftStickUp = false; bool _leftStickDown = false; bool _leftStickLeft = false; bool _leftStickRight = false; // Track button states to prevent repeated events from button holds - final Set _pressedButtons = {}; + final Set _pressedButtons = {}; GamepadService._(); @@ -65,7 +65,7 @@ class GamepadService { // List connected gamepads try { - final gamepads = await Gamepads.list(); + final gamepads = await Gamepad.instance.listGamepads(); appLogger.i('GamepadService: Found ${gamepads.length} gamepad(s)'); for (final gamepad in gamepads) { appLogger.i(' - ${gamepad.name} (id: ${gamepad.id})'); @@ -75,7 +75,7 @@ class GamepadService { } _subscription?.cancel(); - _subscription = Gamepads.events.listen( + _subscription = Gamepad.instance.events.listen( _handleGamepadEvent, onError: (e) => appLogger.e('GamepadService: Stream error', error: e), ); @@ -84,65 +84,104 @@ class GamepadService { /// Stop listening to gamepad events. void stop() { + _stopDirectionRepeat(); _subscription?.cancel(); _subscription = null; + Gamepad.instance.dispose(); } void _handleGamepadEvent(GamepadEvent event) { - final key = event.key.toLowerCase(); - final value = event.value; + switch (event) { + case GamepadConnectionEvent e: + appLogger.i( + 'GamepadService: Gamepad ${e.connected ? "connected" : "disconnected"}: ${e.info.name}', + ); + case GamepadButtonEvent e: + _handleButton(e); + case GamepadAxisEvent e: + _handleAxis(e); + } + } - // Switch to keyboard mode on any significant gamepad input - if (value.abs() > 0.3) { + void _handleButton(GamepadButtonEvent event) { + // Switch to keyboard mode on any button press + if (event.pressed) { onGamepadInput?.call(); _setTraditionalFocusHighlight(); _scheduleFrameIfIdle(); } - // Handle D-pad (reported as axes on macOS) - if (_isDpadYAxis(key)) { - _handleDpadY(value); - return; - } - if (_isDpadXAxis(key)) { - _handleDpadX(value); - return; - } + final wasPressed = _pressedButtons.contains(event.button); - // Handle face buttons - final isPressed = value > 0.5; - final wasPressed = _pressedButtons.contains(key); + if (event.pressed && !wasPressed) { + _pressedButtons.add(event.button); - if (isPressed && !wasPressed) { - _pressedButtons.add(key); - - if (_isButtonA(key)) { - // Use enter instead of gameButtonA so it works with Flutter's built-in - // widgets (buttons, list tiles, etc.) which listen for enter - _simulateKeyPress(LogicalKeyboardKey.enter); - } else if (_isButtonB(key)) { - // Use escape instead of gameButtonB so it works with Flutter's built-in - // widgets (bottom sheets, dialogs, menus) which only listen for escape - _simulateKeyPress(LogicalKeyboardKey.escape); - } else if (_isButtonX(key)) { - _simulateKeyPress(LogicalKeyboardKey.gameButtonX); - } else if (_isL1(key)) { - onL1Pressed?.call(); - } else if (_isR1(key)) { - onR1Pressed?.call(); + // D-pad — navigate with auto-repeat while held + switch (event.button) { + case GamepadButton.dpadUp: + _startDirectionRepeat(TraversalDirection.up); + return; + case GamepadButton.dpadDown: + _startDirectionRepeat(TraversalDirection.down); + return; + case GamepadButton.dpadLeft: + _startDirectionRepeat(TraversalDirection.left); + return; + case GamepadButton.dpadRight: + _startDirectionRepeat(TraversalDirection.right); + return; + // Face buttons — send KeyDown on press, KeyUp on release + // so widget-level long-press timers work naturally + case GamepadButton.a: + _simulateKeyDown(LogicalKeyboardKey.enter); + case GamepadButton.x: + _simulateKeyDown(LogicalKeyboardKey.gameButtonX); + // Immediate actions on press + case GamepadButton.b: + _simulateKeyPress(LogicalKeyboardKey.escape); + case GamepadButton.leftShoulder: + onL1Pressed?.call(); + case GamepadButton.rightShoulder: + onR1Pressed?.call(); + default: + break; } - } else if (!isPressed && wasPressed) { - _pressedButtons.remove(key); + } else if (!event.pressed && wasPressed) { + _pressedButtons.remove(event.button); + + switch (event.button) { + // D-pad release — stop repeat + case GamepadButton.dpadUp: + case GamepadButton.dpadDown: + case GamepadButton.dpadLeft: + case GamepadButton.dpadRight: + _stopDirectionRepeat(); + // Face button release — send KeyUp + case GamepadButton.a: + _simulateKeyUp(LogicalKeyboardKey.enter); + case GamepadButton.x: + _simulateKeyUp(LogicalKeyboardKey.gameButtonX); + default: + break; + } + } + } + + void _handleAxis(GamepadAxisEvent event) { + // Switch to keyboard mode on significant axis input + if (event.value.abs() > 0.3) { + onGamepadInput?.call(); + _setTraditionalFocusHighlight(); + _scheduleFrameIfIdle(); } - // Handle left analog stick - if (_isLeftStickY(key)) { - _handleLeftStickY(value); - return; - } - if (_isLeftStickX(key)) { - _handleLeftStickX(value); - return; + switch (event.axis) { + case GamepadAxis.leftStickY: + _handleLeftStickY(event.value); + case GamepadAxis.leftStickX: + _handleLeftStickX(event.value); + default: + break; } } @@ -153,6 +192,22 @@ class GamepadService { _simulateKeyPress(logicalKey); } + /// Fire [direction] immediately, then auto-repeat after an initial delay. + void _startDirectionRepeat(TraversalDirection direction) { + _stopDirectionRepeat(); + _moveFocus(direction); + _repeatTimer = Timer(_repeatInitialDelay, () { + _repeatTimer = Timer.periodic(_repeatInterval, (_) { + _moveFocus(direction); + }); + }); + } + + void _stopDirectionRepeat() { + _repeatTimer?.cancel(); + _repeatTimer = null; + } + LogicalKeyboardKey _directionToKey(TraversalDirection direction) { switch (direction) { case TraversalDirection.up: @@ -166,50 +221,67 @@ class GamepadService { } } + /// Simulate a full key press (down + up) in a single frame. void _simulateKeyPress(LogicalKeyboardKey logicalKey) { - // Schedule on next frame to ensure we're on the main thread SchedulerBinding.instance.addPostFrameCallback((_) { - final focusNode = FocusManager.instance.primaryFocus; - if (focusNode == null) return; - - // Create a synthetic key down event - final keyDownEvent = KeyDownEvent( - physicalKey: _getPhysicalKey(logicalKey), - logicalKey: logicalKey, - timeStamp: Duration(milliseconds: DateTime.now().millisecondsSinceEpoch), - ); - - // Dispatch through the focus system by walking up the focus tree - // and calling each node's onKeyEvent handler - FocusNode? node = focusNode; - KeyEventResult result = KeyEventResult.ignored; - - while (node != null && result != KeyEventResult.handled) { - // The Focus widget stores its handler in onKeyEvent - if (node.onKeyEvent != null) { - result = node.onKeyEvent!(node, keyDownEvent); - } - node = node.parent; - } - - // Send key up event - final keyUpEvent = KeyUpEvent( - physicalKey: _getPhysicalKey(logicalKey), - logicalKey: logicalKey, - timeStamp: Duration(milliseconds: DateTime.now().millisecondsSinceEpoch), - ); - - node = focusNode; - while (node != null) { - if (node.onKeyEvent != null) { - final upResult = node.onKeyEvent!(node, keyUpEvent); - if (upResult == KeyEventResult.handled) break; - } - node = node.parent; - } + _dispatchKeyDown(logicalKey); + _dispatchKeyUp(logicalKey); }); } + /// Simulate only key down — pair with [_simulateKeyUp] on release + /// so widget-level long-press timers see real hold duration. + void _simulateKeyDown(LogicalKeyboardKey logicalKey) { + SchedulerBinding.instance.addPostFrameCallback((_) { + _dispatchKeyDown(logicalKey); + }); + } + + /// Simulate only key up — the release half of [_simulateKeyDown]. + void _simulateKeyUp(LogicalKeyboardKey logicalKey) { + SchedulerBinding.instance.addPostFrameCallback((_) { + _dispatchKeyUp(logicalKey); + }); + } + + void _dispatchKeyDown(LogicalKeyboardKey logicalKey) { + final focusNode = FocusManager.instance.primaryFocus; + if (focusNode == null) return; + + final event = KeyDownEvent( + physicalKey: _getPhysicalKey(logicalKey), + logicalKey: logicalKey, + timeStamp: Duration(milliseconds: DateTime.now().millisecondsSinceEpoch), + ); + + FocusNode? node = focusNode; + while (node != null) { + if (node.onKeyEvent != null) { + if (node.onKeyEvent!(node, event) == KeyEventResult.handled) break; + } + node = node.parent; + } + } + + void _dispatchKeyUp(LogicalKeyboardKey logicalKey) { + final focusNode = FocusManager.instance.primaryFocus; + if (focusNode == null) return; + + final event = KeyUpEvent( + physicalKey: _getPhysicalKey(logicalKey), + logicalKey: logicalKey, + timeStamp: Duration(milliseconds: DateTime.now().millisecondsSinceEpoch), + ); + + FocusNode? node = focusNode; + while (node != null) { + if (node.onKeyEvent != null) { + if (node.onKeyEvent!(node, event) == KeyEventResult.handled) break; + } + node = node.parent; + } + } + PhysicalKeyboardKey _getPhysicalKey(LogicalKeyboardKey logicalKey) { if (logicalKey == LogicalKeyboardKey.gameButtonA) { return PhysicalKeyboardKey.gameButtonA; @@ -231,68 +303,18 @@ class GamepadService { return PhysicalKeyboardKey.enter; } - // macOS DualSense key matching - // D-pad reports as axes: dpad - xaxis, dpad - yaxis - bool _isDpadYAxis(String key) => key == 'dpad - yaxis'; - bool _isDpadXAxis(String key) => key == 'dpad - xaxis'; - - // Face buttons - macOS uses SF Symbol names for PlayStation controllers - bool _isButtonA(String key) => key == 'xmark.circle'; // Cross/X button (bottom) - bool _isButtonB(String key) => key == 'circle.circle'; // Circle/O button (right) - bool _isButtonX(String key) => key == 'square.circle'; // Square button (left) - - // Analog sticks - bool _isLeftStickX(String key) => key == 'l.joystick - xaxis'; - bool _isLeftStickY(String key) => key == 'l.joystick - yaxis'; - - // Bumper buttons - bool _isL1(String key) => key == 'l1.rectangle.roundedbottom'; - bool _isR1(String key) => key == 'r1.rectangle.roundedbottom'; - - // D-pad Y axis: -1 = down (visually up on controller), 1 = up (visually down) - // Inverted because macOS reports opposite of expected - void _handleDpadY(double value) { - if (value < -0.5 && !_dpadDown) { - _dpadDown = true; - _dpadUp = false; - _moveFocus(TraversalDirection.down); - } else if (value > 0.5 && !_dpadUp) { - _dpadUp = true; - _dpadDown = false; - _moveFocus(TraversalDirection.up); - } else if (value == 0) { - _dpadUp = false; - _dpadDown = false; - } - } - - // D-pad X axis: -1 = left, 1 = right, 0 = released - void _handleDpadX(double value) { - if (value < -0.5 && !_dpadLeft) { - _dpadLeft = true; - _dpadRight = false; - _moveFocus(TraversalDirection.left); - } else if (value > 0.5 && !_dpadRight) { - _dpadRight = true; - _dpadLeft = false; - _moveFocus(TraversalDirection.right); - } else if (value == 0) { - _dpadLeft = false; - _dpadRight = false; - } - } - - // Left stick Y axis - inverted like D-pad + // W3C: leftStickY -1.0 = up, 1.0 = down void _handleLeftStickY(double value) { - if (value < -_stickDeadzone && !_leftStickDown) { + if (value > _stickDeadzone && !_leftStickDown) { _leftStickDown = true; _leftStickUp = false; - _moveFocus(TraversalDirection.down); - } else if (value > _stickDeadzone && !_leftStickUp) { + _startDirectionRepeat(TraversalDirection.down); + } else if (value < -_stickDeadzone && !_leftStickUp) { _leftStickUp = true; _leftStickDown = false; - _moveFocus(TraversalDirection.up); + _startDirectionRepeat(TraversalDirection.up); } else if (value.abs() <= _stickDeadzone) { + if (_leftStickUp || _leftStickDown) _stopDirectionRepeat(); _leftStickUp = false; _leftStickDown = false; } @@ -302,12 +324,13 @@ class GamepadService { if (value < -_stickDeadzone && !_leftStickLeft) { _leftStickLeft = true; _leftStickRight = false; - _moveFocus(TraversalDirection.left); + _startDirectionRepeat(TraversalDirection.left); } else if (value > _stickDeadzone && !_leftStickRight) { _leftStickRight = true; _leftStickLeft = false; - _moveFocus(TraversalDirection.right); + _startDirectionRepeat(TraversalDirection.right); } else if (value.abs() <= _stickDeadzone) { + if (_leftStickLeft || _leftStickRight) _stopDirectionRepeat(); _leftStickLeft = false; _leftStickRight = false; } diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 2a1e7c30..7bc92601 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -7,11 +7,11 @@ #include "generated_plugin_registrant.h" #include -#include #include #include #include #include +#include #include #include @@ -19,9 +19,6 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) flutter_webrtc_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterWebRTCPlugin"); flutter_web_r_t_c_plugin_register_with_registrar(flutter_webrtc_registrar); - g_autoptr(FlPluginRegistrar) gamepads_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "GamepadsLinuxPlugin"); - gamepads_linux_plugin_register_with_registrar(gamepads_linux_registrar); g_autoptr(FlPluginRegistrar) hotkey_manager_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "HotkeyManagerLinuxPlugin"); hotkey_manager_linux_plugin_register_with_registrar(hotkey_manager_linux_registrar); @@ -34,6 +31,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin"); sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar); + g_autoptr(FlPluginRegistrar) universal_gamepad_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "GamepadPlugin"); + gamepad_plugin_register_with_registrar(universal_gamepad_registrar); g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index d62b1d90..bc8ad390 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -4,11 +4,11 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_webrtc - gamepads_linux hotkey_manager_linux os_media_controls screen_retriever_linux sqlite3_flutter_libs + universal_gamepad url_launcher_linux window_manager ) diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 0235d5e7..b8e75870 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -9,7 +9,6 @@ import connectivity_plus import device_info_plus import file_picker import flutter_webrtc -import gamepads_darwin import hotkey_manager_macos import in_app_review import os_media_controls @@ -19,6 +18,7 @@ import screen_retriever_macos import shared_preferences_foundation import sqflite_darwin import sqlite3_flutter_libs +import universal_gamepad import url_launcher_macos import wakelock_plus import window_manager @@ -28,7 +28,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin")) - GamepadsDarwinPlugin.register(with: registry.registrar(forPlugin: "GamepadsDarwinPlugin")) HotkeyManagerMacosPlugin.register(with: registry.registrar(forPlugin: "HotkeyManagerMacosPlugin")) InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin")) OsMediaControlsPlugin.register(with: registry.registrar(forPlugin: "OsMediaControlsPlugin")) @@ -38,6 +37,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin")) + GamepadPlugin.register(with: registry.registrar(forPlugin: "GamepadPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 779e10d8..6e23a4fb 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -9,8 +9,6 @@ PODS: - FlutterMacOS - WebRTC-SDK (= 137.7151.04) - FlutterMacOS (1.0.0) - - gamepads_darwin (0.1.1): - - FlutterMacOS - HotKey (0.2.1) - hotkey_manager_macos (0.0.1): - FlutterMacOS @@ -57,6 +55,8 @@ PODS: - sqlite3/perf-threadsafe - sqlite3/rtree - sqlite3/session + - universal_gamepad (0.1.0): + - FlutterMacOS - url_launcher_macos (0.0.1): - FlutterMacOS - wakelock_plus (0.0.1): @@ -71,7 +71,6 @@ DEPENDENCIES: - file_picker (from `Flutter/ephemeral/.symlinks/plugins/file_picker/macos`) - flutter_webrtc (from `Flutter/ephemeral/.symlinks/plugins/flutter_webrtc/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - - gamepads_darwin (from `Flutter/ephemeral/.symlinks/plugins/gamepads_darwin/macos`) - hotkey_manager_macos (from `Flutter/ephemeral/.symlinks/plugins/hotkey_manager_macos/macos`) - in_app_review (from `Flutter/ephemeral/.symlinks/plugins/in_app_review/macos`) - os_media_controls (from `Flutter/ephemeral/.symlinks/plugins/os_media_controls/macos`) @@ -81,6 +80,7 @@ DEPENDENCIES: - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`) - sqlite3_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/darwin`) + - universal_gamepad (from `Flutter/ephemeral/.symlinks/plugins/universal_gamepad/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`) - window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`) @@ -102,8 +102,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/flutter_webrtc/macos FlutterMacOS: :path: Flutter/ephemeral - gamepads_darwin: - :path: Flutter/ephemeral/.symlinks/plugins/gamepads_darwin/macos hotkey_manager_macos: :path: Flutter/ephemeral/.symlinks/plugins/hotkey_manager_macos/macos in_app_review: @@ -122,6 +120,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin sqlite3_flutter_libs: :path: Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/darwin + universal_gamepad: + :path: Flutter/ephemeral/.symlinks/plugins/universal_gamepad/macos url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos wakelock_plus: @@ -135,7 +135,6 @@ SPEC CHECKSUMS: file_picker: 7584aae6fa07a041af2b36a2655122d42f578c1a flutter_webrtc: 718eae22a371cd94e5d56aa4f301443ebc5bb737 FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 - gamepads_darwin: 643b6a69e20ca678fae83781b7f7fc8f15f5d710 HotKey: 400beb7caa29054ea8d864c96f5ba7e5b4852277 hotkey_manager_macos: a4317849af96d2430fa89944d3c58977ca089fbe in_app_review: 66e7680752b632d83f4f0e88b34d52ed303fbff4 @@ -147,6 +146,7 @@ SPEC CHECKSUMS: sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 sqlite3: 8d708bc63e9f4ce48f0ad9d6269e478c5ced1d9b sqlite3_flutter_libs: d13b8b3003f18f596e542bcb9482d105577eff41 + universal_gamepad: 8922f1f238f62d6847de887228976d5b572b57da url_launcher_macos: f87a979182d112f911de6820aefddaf56ee9fbfd wakelock_plus: 917609be14d812ddd9e9528876538b2263aaa03b WebRTC-SDK: 40d4f5ba05cadff14e4db5614aec402a633f007e diff --git a/pubspec.lock b/pubspec.lock index b5cd4705..07fad22b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -501,70 +501,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" - gamepads: - dependency: "direct main" - description: - name: gamepads - sha256: "3a8a35502f0b3d28ea55e2c6c42320583389c0514a2bdd92ba0440d0cadd628e" - url: "https://pub.dev" - source: hosted - version: "0.1.9" - gamepads_android: - dependency: transitive - description: - name: gamepads_android - sha256: "7913cd171ff06d5b588cb3e1dae64390c6e1352dd2999ff19a96d822eb7441fd" - url: "https://pub.dev" - source: hosted - version: "0.1.6" - gamepads_darwin: - dependency: transitive - description: - name: gamepads_darwin - sha256: "91250975ee196703816c55117502ec53ce4a1b881ca50dec1d0fbcb9fbb75eff" - url: "https://pub.dev" - source: hosted - version: "0.1.2+2" - gamepads_ios: - dependency: transitive - description: - name: gamepads_ios - sha256: "085459e2f677c18c4b15aee5dacc66e0b05491d4ed32bd3041c8328394e00d3a" - url: "https://pub.dev" - source: hosted - version: "0.1.3+1" - gamepads_linux: - dependency: transitive - description: - name: gamepads_linux - sha256: f4c17915a84400d7f624aadb6371424ada596eedff2a25663121453e65917e0d - url: "https://pub.dev" - source: hosted - version: "0.1.1+3" - gamepads_platform_interface: - dependency: transitive - description: - name: gamepads_platform_interface - sha256: ddab8677a4137d92e381b04cc97a8081ae4b75673dc0f24c846618d2b5226c4f - url: "https://pub.dev" - source: hosted - version: "0.1.2+1" - gamepads_web: - dependency: transitive - description: - name: gamepads_web - sha256: "4885a792f16de023c4975854ffe17ffccacb46beb1e78ac1ecde76fd10edcb22" - url: "https://pub.dev" - source: hosted - version: "0.1.0" - gamepads_windows: - dependency: transitive - description: - name: gamepads_windows - sha256: "454320638b8ad73890530545a2f788d83a752471010edade0f00b1636c1b382d" - url: "https://pub.dev" - source: hosted - version: "0.1.4+1" glob: dependency: transitive description: @@ -701,14 +637,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" - js_interop: - dependency: transitive - description: - name: js_interop - sha256: "7ec859c296958ccea34dc770504bd3ff4ae52fdd9e7eeb2bacc7081ad476a1f5" - url: "https://pub.dev" - source: hosted - version: "0.0.1" json_annotation: dependency: "direct main" description: @@ -1379,6 +1307,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.3" + universal_gamepad: + dependency: "direct main" + description: + name: universal_gamepad + sha256: e31955d2f9b2a1aa11eebd64a80df6a2a66ccdae309471c447b36b44bf55d1c1 + url: "https://pub.dev" + source: hosted + version: "1.0.0" url_launcher: dependency: "direct main" description: @@ -1604,5 +1540,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.10.4 <4.0.0" + dart: ">=3.10.7 <4.0.0" flutter: ">=3.35.0" diff --git a/pubspec.yaml b/pubspec.yaml index b9d2b5d9..ef5ecb07 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,7 @@ dependencies: wakelock_plus: ^1.2.10 path_provider: ^2.1.0 path: ^1.9.0 - gamepads: ^0.1.9 + universal_gamepad: ^1.0.0 drift: ^2.28.2 sqlite3_flutter_libs: ^0.5.41 workmanager: ^0.9.0+3 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index fa4e381b..5f835ebe 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -8,11 +8,11 @@ #include #include -#include #include #include #include #include +#include #include #include @@ -21,8 +21,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); FlutterWebRTCPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterWebRTCPlugin")); - GamepadsWindowsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("GamepadsWindowsPluginCApi")); HotkeyManagerWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("HotkeyManagerWindowsPluginCApi")); OsMediaControlsPluginCApiRegisterWithRegistrar( @@ -31,6 +29,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi")); Sqlite3FlutterLibsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin")); + GamepadPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("GamepadPluginCApi")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); WindowManagerPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 3f8229cf..fd5c102b 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -5,11 +5,11 @@ list(APPEND FLUTTER_PLUGIN_LIST connectivity_plus flutter_webrtc - gamepads_windows hotkey_manager_windows os_media_controls screen_retriever_windows sqlite3_flutter_libs + universal_gamepad url_launcher_windows window_manager )