flutter/flutter

Text selection highlight should be greyed out when window loses focus

開放

#103,446 建立於 2022年5月10日

 (10 則留言) (0 個反應) (0 位負責人)Dart (30,366 個分叉)batch import

倉庫指標

星標
 (176,322 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

  1. Open a Flutter App with a text field.
  2. Type in text field and select some text.
  3. Open a native application with text input/selection.
  4. Type some text in the new window.
  5. Select some text in native app
  6. 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(),
      ),
    );
  }
}

貢獻者指南