flutter/flutter
Text selection highlight should be greyed out when window loses focus
Open
#103,446 opened on May 10, 2022
Repository metrics
- Stars
- (176,322 stars)
- PR merge metrics
- (PR metrics pending)
Description
When a Flutter window loses focus on desktop, the text selection highlight color should be grey. This is the behavior on macOS, and also on Web (tested on Chrome), and most likely other desktop platforms as well.
Steps to Reproduce
- Open a Flutter App with a text field.
- Type in text field and select some text.
- Open a native application with text input/selection.
- Type some text in the new window.
- Select some text in native app
- Switch focus from native app to flutter app, and back and forth to see the selection highlight color change depending on focus. It only changes on the native app, not the flutter app.
Flutter App on the left (Actual), MacOS Notes App on the right (Expected).
https://user-images.githubusercontent.com/948037/167739336-6bc355e2-6e35-4a54-b024-419199e68c50.mov
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: const Center(
child: TextField(),
),
);
}
}