Repository: flutter
Issue: [Linux] `PhysicalKeyboardKey` events with `AltGr + ?` keys are wrong order
Labels: framework,a: internationalization,platform-linux,has reproducible steps,P2,team-linux,triaged-linux,found in release: 3.24,found in release: 3.25

I'm trying to get the `USB HID` codes for key events. But the order is wrong.

### Steps to reproduce

1. Run the example code on Linux.
2. Switch to FR input method.
3. Press `AltGr` + `E`. Press `AltGr`, press `E`, release `E`, release `AltGr`. 

### Expected results

For `PhysicalKeyboardKey`:

1. `AltGr`/`Alt Right` key down event.
2. `E` key down event.
3. `E` key up event.
4. `AltGr`/`Alt Right` key up event.

### Actual results

1. `AltGr`/`Alt Right` key down event.
2. `AltGr`/`Alt Right` key up event.
3. `E` key down event. Character `€`.
4. `E` key up event.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Keyboard Event Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const KeyboardEventPage(),
    );
  }
}

class KeyboardEventPage extends StatefulWidget {
  const KeyboardEventPage({super.key});

  @override
  _KeyboardEventPageState createState() => _KeyboardEventPageState();
}

class _KeyboardEventPageState extends State<KeyboardEventPage> {
  final List<String> _lastKeyEvents = [];
  final FocusNode _focusNode = FocusNode();

  @override
  Widget build(BuildContext context) {
    final child = Scaffold(
      appBar: AppBar(
        title: const Text('Keyboard Event Demo'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Press any key:',
              style: TextStyle(fontSize: 20),
            ),
            const SizedBox(height: 20),
            for (final keyEvent in _lastKeyEvents)
              Text(
                keyEvent,
                style: const TextStyle(fontSize: 16),
              ),
          ],
        ),
      ),
    );
    return FocusScope(
      autofocus: true,
      child: Focus(
        autofocus: true,
        canRequestFocus: true,
        focusNode: _focusNode,
        onKeyEvent: (node, event) {
          setState(() {
            _lastKeyEvents.add(event.toString());
            if (_lastKeyEvents.length > 10) {
              _lastKeyEvents.removeAt(0);
            }
          });
          return KeyEventResult.handled;
        },
        child: child,
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

![image](https://github.com/user-attachments/assets/c2431c07-e17f-4abb-b253-854fd3e0ed1e)

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.24.1, on Ubuntu 22.04.4 LTS 6.5.0-44-generic,
    locale en_US.UTF-8)
    • Flutter version 3.24.1 on channel stable at
      /home/username/workspace/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5874a72aa4 (4 days ago), 2024-08-20 16:46:00 -0500
    • Engine revision c9b9d5780d
    • Dart version 3.5.1
    • DevTools version 2.37.2

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.dev/to/linux-android-setup for detailed
      instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✗] Chrome - develop for the web (Cannot find Chrome executable at
    google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1.1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[!] Android Studio (not installed)
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/linux-android-setup for detailed
      instructions).

[!] Proxy Configuration
    • HTTP_PROXY is set
    ! NO_PROXY is not set

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 6.5.0-44-generic

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 4 categories.

```

</details>