我正在尝试使用 TextSelectionThemeData 更改 flutter 中的 SelectionHandleColor 但它不起作用。考虑了cursorColor 和selectionColor 值,但不考虑selectionHandleColor。这是我的代码,不知道为什么只有该字段不起作用
MaterialApp(
theme: ThemeData(
scaffoldBackgroundColor: Colors.transparent,
colorSchemeSeed: MaterialSwatchGenerator.generate(Colors.blue),
textSelectionTheme: const TextSelectionThemeData(
cursorColor: Colors.red,
selectionHandleColor: Colors.red,
),
),
home: MainChild(),
)
我也试过了...
这是我的代码
import 'package:flutter/material.dart';
ThemeData lightTheme = ThemeData(
brightness: Brightness.light,
textSelectionTheme: const TextSelectionThemeData(
cursorColor: Colors.red,
selectionColor: Colors.blueAccent,
selectionHandleColor: Colors.green,
),
);
ThemeData darkTheme = ThemeData(
brightness: Brightness.dark,
textSelectionTheme: const TextSelectionThemeData(
cursorColor: Colors.yellow,
selectionColor: Colors.pink,
selectionHandleColor: Colors.deepOrange,
),
);
这是相同的输出