[Android] Disabling interactive selection does not work as expected
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
On Android, create an app with `TextField.enableInteractiveSelection` set to `false`.
Environment:
* Pixel Pro Fold 10
* Android 17 beta 4
* Flutter 3.44.0-1.0.pre-354 (master 7e0b42573df8eacab5ef1ef9109cc36b0ace3dc4)
### Expected results
1. Long-pressing the text field should not show a context menu.
2. Open GBoard > **Text editing**. Pressing **Select all**, **Copy**, **Paste** should do nothing.
3. Open GBoard > **Clipboard**. Pressing on a clip should do nothing.
### Actual results
1. Long-pressing the text field incorrectly shows a context menu. Pressing Paste incorrectly pastes content.
2. Open GBoard > **Text editing**. Pressing **Select all** incorrectly selects all text, **Copy** incorrectly copies text, **Paste** incorrectly pastes text.
3. Open GBoard > **Clipboard**. Pressing on a clip incorrectly pastes text.
### Code sample
Code sample
```dart
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: MinimalSelectionApp()));
class MinimalSelectionApp extends StatelessWidget {
const MinimalSelectionApp({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Selection Disabled")),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
const TextField(
// This is the core property
enableInteractiveSelection: false,
decoration: InputDecoration(
labelText: "You cannot copy/paste here",
hintText: "Long-pressing does nothing",
border: OutlineInputBorder(),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () => FocusScope.of(context).unfocus(),
child: const Text("Dismiss Keyboard"),
),
],
),
),
);
}
}
```
### Screenshots or Video
N/A
### Logs
N/A
### Flutter Doctor output
N/A
Contributor guide
Assessment
This issue has not been assessed yet.