我有一个小部件树,如Gridview> Container> Card> ListTile,但不是希望ListTile上有前导图像,我希望将其作为卡的背景图像,有没有办法实现这种外观?
答案 0 :(得分:1)
如果我正确理解了您的问题,则可以将该图像放入容器中
Card(
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover, //I assumed you want to occupy the entire space of the card
image: AssetImage(
'the_path_of_the_image',
),
),
),
child: ListTile(
leading: Text(
'Testing the ListTile',
style: TextStyle(color: Colors.white),
),
title: Text(
'Testing again!',
style: TextStyle(color: Colors.white),
),
),
),
);