我正在開發一個顫振專案,我使用了 scroll_navigation 但我想更改 selectedItemColor 和 unselectedItemColor 并且我不知道如何更改滾動導航中所選專案的顏色。
@override
Widget build(BuildContext context) {
return ScrollNavigation(
bodyStyle: NavigationBodyStyle(
background: Colors.white,
borderRadius: BorderRadius.horizontal(left: Radius.circular(20)),
scrollDirection: Axis.vertical,
),
barStyle: NavigationBarStyle(
position: NavigationPosition.left,
elevation: 0.0,
background: Colors.white,
),
pages: [
Container(color: Colors.blue[100]),
Container(color: Colors.green[100]),
Container(color: Colors.purple[100]),
Container(color: Colors.amber[100]),
Container(color: Colors.deepOrange[100])
],
items: const [
ScrollNavigationItem(icon: Icon(Icons.camera)),
ScrollNavigationItem(icon: Icon(Icons.chat)),
ScrollNavigationItem(icon: Icon(Icons.favorite)),
ScrollNavigationItem(icon: Icon(Icons.notifications)),
ScrollNavigationItem(icon: Icon(Icons.home))
],
);
}
uj5u.com熱心網友回復:
您可以通過以下方式設定活動和非活動顏色NavigationBarStyle:
barStyle: const NavigationBarStyle(
...
activeColor: Colors.red,
deactiveColor: Colors.yellow,
),
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/430638.html
