问题描述
如何使staggeredGridView
颤动有两行。第一行中将有两个图像,第二行中将有三个图像,第二行的最后一个图像中将有一些文本,例如20+或40+。
请看下面的图片,以便更好地理解
body: Padding(
child: Container
(
height: 1500,decoration: Boxdecoration(
color: Colors.white,),child: StaggeredGridView.count(
crossAxisCount: 4,mainAxisspacing: 3.0,crossAxisspacing: 3.0,staggeredTiles: [
StaggeredTile.count(2,1),StaggeredTile.count(2,StaggeredTile.count(1,],children: <Widget>[
myPhotoList(
"https://www.google.com/search?q=bird&rlz=1C1CHBD_enBD884BD884&sxsrf=ALeKk032QyXLy5s0te6Y52Sp3yyA2g4sfQ:1598990850500&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjslZKN4cjrAhUWWX0KHe3sAdMQ_AUoAXoECB0QAw&biw=1536&bih=792#imgrc=1ois95B-LwbEBM"),myPhotoList(
"https://www.google.com/search?q=bird&rlz=1C1CHBD_enBD884BD884&sxsrf=ALeKk032QyXLy5s0te6Y52Sp3yyA2g4sfQ:1598990850500&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjslZKN4cjrAhUWWX0KHe3sAdMQ_AUoAXoECB0QAw&biw=1536&bih=792#imgrc=1ois95B-LwbEBM"),Details(),Widget myPhotoList(String img) {
return Container(
decoration: Boxdecoration(
image: decorationImage(
fit: BoxFit.fill,image: NetworkImage(
img),);
}
解决方法
您在寻找这个吗?
body: Container(
height: 1500,decoration: BoxDecoration(
color: Colors.white,),child: StaggeredGridView.count(
crossAxisCount: 6,mainAxisSpacing: 3.0,crossAxisSpacing: 3.0,staggeredTiles: [
StaggeredTile.count(3,2),StaggeredTile.count(3,StaggeredTile.count(2,// StaggeredTile.count(1,1),],children: <Widget>[
myPhotoList(
"https://www.google.com/search?q=bird&rlz=1C1CHBD_enBD884BD884&sxsrf=ALeKk032QyXLy5s0te6Y52Sp3yyA2g4sfQ:1598990850500&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjslZKN4cjrAhUWWX0KHe3sAdMQ_AUoAXoECB0QAw&biw=1536&bih=792#imgrc=1ois95B-LwbEBM"),myPhotoList(
"https://www.google.com/search?q=bird&rlz=1C1CHBD_enBD884BD884&sxsrf=ALeKk032QyXLy5s0te6Y52Sp3yyA2g4sfQ:1598990850500&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjslZKN4cjrAhUWWX0KHe3sAdMQ_AUoAXoECB0QAw&biw=1536&bih=792#imgrc=1ois95B-LwbEBM"),//myPhotoList(
// "https://www.google.com/search?q=bird&rlz=1C1CHBD_enBD884BD884&sxsrf=ALeKk032QyXLy5s0te6Y52Sp3yyA2g4sfQ:1598990850500&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjslZKN4cjrAhUWWX0KHe3sAdMQ_AUoAXoECB0QAw&biw=1536&bih=792#imgrc=1ois95B-LwbEBM"),