Listview 如何在点击时更改ListTile()的背景色?
非常新的颤振,我正试图改变背景颜色的多个ListTile时,他们被点击。ListTiles是抽屉的一部分,背景颜色当前由它们所在的容器设置。我看到这个问题被问了很多次,但对于给出的解决方案,我运气不太好。以下是我正在使用的一些代码:Listview 如何在点击时更改ListTile()的背景色?,listview,flutter,dart,background-color,mobile-development,Listview,Flutter,Dart,Background Color,Mobile Development,非常新的颤振,我正试图改变背景颜色的多个ListTile时,他们被点击。ListTiles是抽屉的一部分,背景颜色当前由它们所在的容器设置。我看到这个问题被问了很多次,但对于给出的解决方案,我运气不太好。以下是我正在使用的一些代码: Drawer normalDrawer(String route){ return Drawer( child: ListView( padding: EdgeInsets.zero, children: <Widget&g
Drawer normalDrawer(String route){
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
Container(
color: Colors.green,
child: Column(
children: <Widget>[
ListTile(
leading: Icon(Icons.archive, color: Colors.white),
title: Text('Archived',
style: TextStyle(
color: Colors.white,
fontSize: 18.0,
fontWeight: FontWeight.w400)),
onTap: () {
_scaffoldKey.currentState.openEndDrawer();
Navigator.pushNamed(
context,
"/archived");
},
),
]),
),
],
),
);
}
Drawer-normalDrawer(字符串路由){
回程抽屉(
子:ListView(
填充:EdgeInsets.zero,
儿童:[
容器(
颜色:颜色。绿色,
子:列(
儿童:[
列表砖(
前导:图标(Icons.archive,颜色:Colors.white),
标题:文本('存档',
样式:TextStyle(
颜色:颜色,白色,
字体大小:18.0,
fontWeight:fontWeight.w400),
onTap:(){
_scaffoldKey.currentState.openEndDrawer();
Navigator.pushNamed(
上下文
“/存档”);
},
),
]),
),
],
),
);
}
你说的是波纹颜色?@AhmedKhattab不太清楚,它实际上需要换一种不同的颜色。