如何在Image.network
上显示图标?我使用了Stack
小工具,它没有帮助,图标在图像下面,不可见。我希望我的IconButton
显示在右上角的图像上,但Stack
小工具对我不起作用。
SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(),
delegate: SliverChildBuilderDelegate(childCount: product.length,
(BuildContext context, int index) {
final media =
product[index].media?.map((e) => e.toJson()).toList();
final photo = media?[0]['links']['local']['thumbnails']['350'];
final productItem = product[index];
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProductScreen(
name: productItem.name,
link: productItem.link,
)));
},
child: Container(
padding: REdgeInsets.only(left: 2, right: 2, top: 5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8)),
child: Column(
children: <Widget>[
InkWell(
child: Container(
margin: REdgeInsets.only(top: 5),
child: Stack(
children: [
IconButton(onPressed: () {}, icon: Icon(Icons.favorite),),
Image.network(),
]
),
),
),
SizedBox(
height: 10.h,
),
Text(),
SizedBox(height: 8.h),
Text(),
SizedBox(height: 5.h),
buildButton(index, productItem.id),
],
),
),
);
}),
),
1条答案
按热度按时间yzuktlbb1#
请尝试以下代码: