![](/img/trans.png)
[英]Flutter SearchDelegate: How to remove text underline and blue line (color) below text?
[英]Flutter SearchDelegate: How to change the color of the blue bubbles from text cursor and select?
Flutter SearchDelegate:如何在 Flutter 中更改搜索委托小部件中藍色氣泡的顏色?
環境:sdk:">=2.12.0 <3.0.0"
在我的 Scaffold-Appbar 中,我有一個帶有 IconButton 的操作,然后我調用了 DataSearch。 然后我在 DataSearch 中設置 ThemeData appBarTheme。 而已。
appBar: AppBar(
title: Text(widget.title),
actions: [
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
showSearch(context: context, delegate: DataSearch());
},
),
],
),
class DataSearch extends SearchDelegate<String> {
@override
ThemeData appBarTheme(BuildContext context) {
return ThemeData(
textSelectionTheme: TextSelectionThemeData(
//cursorColor: Colors.red,
selectionHandleColor: Colors.red,
//selectionColor: Colors.white,
), // cursor color
);
}
您可以通過設置selectionHandleColor來更改textSelectionTheme
的顏色。
textSelectionTheme: TextSelectionThemeData(
selectionHandleColor: Colors.red, // Change bubble to red
cursorColor: Colors.white,
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.