-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: desktopRunning on desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
On our desktop platforms Mac, Linux, and Windows, right clicking anywhere in a native app usually brings up the context menu with some relevant options (Select All, etc.). In Flutter desktop apps, that menu can only be shown inside of an EditableText. Even if a developer wanted to add custom support for that menu to be shown somewhere, it would be very hacky due to tight coupling with EditableText. Soon, selection will be supported outside of EditableText (#95226), and this will be even more needed.
We should provide a simple public API for showing/hiding this menu and modifying its appearance, and we should refactor EditableText to consume that API.
To reproduce
- Run an app with some text field that doesn't take up the entire screen (example below).
- Right click on the text field and notice that the menu is shown.
- Click anywhere to dismiss the menu.
- Right click anywhere outside of the text field.
- No context menu is shown, and there is no way for the developer to show it if they wanted to.
Code
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: const Text('Flutter Demo'),
),
body: const Center(
child: TextField(),
),
),
);
}
}
renancaraujo, FMorschel and sachaarbonel
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: desktopRunning on desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.