[英]Flutter. Using Theme, how to change scroll offset color?
一開始我很抱歉我的英語。 我不是母語人士,另外這是我用這種語言發表的第一篇文章。 我將不勝感激您的理解。 這就是我的意思:
如何在深色主題中設置除此綠色以外的滾動顏色? 我不能這樣做。
下面是我的代碼:
theme: ThemeData(
brightness: Brightness.dark,
primaryColor: Colors.pink,
backgroundColor: Colors.grey[900],
textSelectionColor: Colors.pink,
textSelectionHandleColor: Colors.pink[700],
textTheme: TextTheme(
body1: TextStyle(color: Colors.white),
),
),
預先感謝您的幫助 :)
您需要使用accentColor property
的ThemeData class
小部件的前景色(旋鈕、文本、過度滾動邊緣效果等)。
示例代碼
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MyApp',
theme: ThemeData(
brightness: Brightness.light,
//Change your color here
accentColor: Colors.blue,
accentColorBrightness: Brightness.light,
),
home: MyHomePage(),
);
}
}
GlowingOverscrollIndicator 將為您完成以下代碼中的工作,
GlowingOverscrollIndicator(
axisDirection: AxisDirection.down,
// the color you want to change in place of green
color: Colors.yellow,
child: Your_ListView_Widget,
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.