Stack(
children: <Widget>[
Column(
children: <Widget>[
AspectRatio(
aspectRatio: 16/9,
child: Image.network(posts[index].imageUrl, fit: BoxFit.cover,),
),
SizedBox(height: 16,),
Text(
posts[index].title,
style: Theme.of(context).textTheme.title,
),
Text(
posts[index].author,
style: Theme.of(context).textTheme.subhead,
),
SizedBox(height: 16,)
],
),
Positioned.fill(
child: Material(
color: Colors.transparent,
child: InkWell(
splashColor: Colors.white.withOpacity(0.3), // 慢慢展开的颜色
highlightColor: Colors.white.withOpacity(0.1), // 高亮颜色
onTap: (){
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PostShow(post: posts[index],)
)
);
}
),
),
)
],
)

预览
网友评论