Repository: flutter
Issue: Text selection toolbar is affected by TextField transformations
Labels: a: text input,framework,f: material design,has reproducible steps,P2,workaround available,team-text-input,triaged-text-input,found in release: 3.24,found in release: 3.27

### Steps to reproduce

1. Create a `TextField` widget in a Flutter app.
2. Wrap it with a `Transform` widget (e.g. to scale or rotate the widget).

The use case here is a _drawing app_ that allows users to transform (scale & rotate) boxes with text and provides WYSIWYG input on the TextFields, regardless of where they are placed and how they are transformed. 

### Expected results

* The text selection toolbar should always be sized in screen coordinates, i.e. always have the same size, regardless of the transformation of the TextField.
* The text selection toolbar should always be drawn parallel to the screen's x-axis (i.e. perfectly horizontal), regardless of the transformation of the TextField.

Besides,

* Text selection should still work correctly. 

### Actual results

* The text selection toolbar scales and rotates with the TextField, i.e. it will potentially be drawn too big / small or rotated.
* Only parts of the TextField respond to tap events on a rotated TextField.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'dart:math';

import 'package:flutter/material.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: ConstrainedBox(
            constraints: const BoxConstraints(maxWidth: 300),
            child: Transform.rotate(
              angle: pi / 8.0,
              child: const TextField(),
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

![scaled-textfield](https://github.com/user-attachments/assets/cfea7077-80bb-4ae7-8c6d-8ec4b38ad2aa)

![rotated-textfield](https://github.com/user-attachments/assets/8a04498e-9f13-40f0-8317-d0173542fb0a)

</details>


### Logs

_No response_

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.24.4, on macOS 15.1 24B83 darwin-arm64, locale en-US)
    • Flutter version 3.24.4 on channel stable at /Users/redge/Shared/SDKs/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (13 days ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/redge/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.16.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.95.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.101.20241031

[✓] Connected device (6 available)
    • Daniels iPad Air (mobile)           • 00008112-000108C13E81A01E            • ios            • iOS 18.1 22B83
    • iPhone Mini Daniel (mobile)         • 00008110-001C410C2112401E            • ios            • iOS 18.1 22B83
    • iPhone SE (3rd generation) (mobile) • 60B82120-7A81-4EFD-84E1-594FA2FA296D • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-1 (simulator)
    • macOS (desktop)                     • macos                                • darwin-arm64   • macOS 15.1 24B83 darwin-arm64
    • Mac Designed for iPad (desktop)     • mac-designed-for-ipad                • darwin         • macOS 15.1 24B83 darwin-arm64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 130.0.6723.93

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>