在下面的代码中,我想将蓝色叶子颜色更改为黑色(已附加图像)我知道如何更改光标颜色,但如何更改此叶子颜色?我什至不确定这是正确的名字
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 38),
child: TextField(
cursorColor: Colors.black,
style: const TextStyle(
color: Colors.black54,
fontFamily: 'sen',
fontSize: 15,
),
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Type Message",
hintStyle: TextStyle(
color: Colors.black54,
fontFamily: 'sen',
fontSize: 15
)
),
),
),
),
你所说的蓝色叶子叫做
Text selection handle
,你给它起的有趣的名字可能是你没有找到改变颜色的方法的原因。
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: darkBlue,
colorScheme: const ColorScheme.dark(
primary: Colors.yellow,
),
),
home: ...
);
}
}
TextSelectionThemeData
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: darkBlue,
textSelectionTheme: const TextSelectionThemeData(
selectionHandleColor: Colors.yellow
)
),
home: ...
);
}
}
希望有帮助!