在我的项目中,我有一个需要应用背景颜色的 ListTile 列表。通过应用颜色,ListTiles 会失去 onTap 飞溅效果。
// 1 (splash effect working)
ListTile(title: Text("ListTile without color"), onTap: () {}),
// 2 (splash no effect working)
ListTile(
tileColor: Colors.blue,
title: Text("ListTile with color"),
onTap: () {}),
// 3 (splash no effect working)
Container(
color: Colors.blue,
child: ListTile(
title: Text(
"ListTile without color in container with color"),
onTap: () {}))
Run Code Online (Sandbox Code Playgroud)
完整示例:
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights …Run Code Online (Sandbox Code Playgroud)