Change background color of ListTile upon selection in Flutter

前端 未结 12 1735
闹比i
闹比i 2020-12-15 03:10

I\'ve made a ListView in Flutter, but now I have some ListTiles in this ListView that can be selected. Upon selection, I want the back

12条回答
  •  囚心锁ツ
    2020-12-15 03:39

    If you also need an onTap listener with a ripple effect, you can use Ink:

    ListView(
      children: [
        Ink(
          color: Colors.lightGreen,
          child: ListTile(
            title: Text('With lightGreen background'),
            onTap() { },
          ),
        ),
      ],
    );
    

提交回复
热议问题