嗨朋友们,我在根据我尝试过的屏幕设置视图的卡片高度时遇到问题,方法是使用下面的代码动态设置屏幕,请找到屏幕以及我需要文本下方的确切 10 个边距,而不是如果我不使用媒体查询,我尝试使用动态 MediaQuery 就这么多底部有空间
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
final double itemHeight = (size.height - kToolbarHeight - 24) / 2.3;
final double itemWidth = size.width / 2;
return livevideolist != null
? new GridView.builder(
itemCount: livevideolist == null ? 0 : livevideolist.length,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
childAspectRatio: (itemWidth / itemHeight),
crossAxisCount: 2),
itemBuilder: (BuildContext context, int index) {
return new GestureDetector(
onTap: () {
String youtubeid = livevideolist[index]['url'];
playYoutubeVideo(youtubeid);
},
child: new Card(
elevation: 4.0,
margin: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0),
child: new Column(
children: <Widget>[
new Container(
height: 150.0,
width: double.infinity,
decoration: new BoxDecoration(
image: new DecorationImage(
image:
new NetworkImage(livevideolist[index]['image']),
fit: BoxFit.fill,
),
),
),
Expanded(
child: new Container(
child: new Text(livevideolist[index]['title']),
margin: EdgeInsets.only(left: 10.0, top: 10.0),
),
),
],
),
),
);
},
)
: new Center(
child: new CircularProgressIndicator(),
);
}