[英]How I can set height for Card and make in flexible?
I want set minimal height to screen bottom for my film decription card, and resizing and sroll it when description is big.我想为我的电影描述卡设置屏幕底部的最小高度,并在描述很大时调整大小并滚动它。 I try to do like this, but when discription is small, card getting smaller and seems so bad.
我尝试这样做,但是当描述很小时,卡片变得越来越小并且看起来很糟糕。
_screenHalf = (MediaQuery.of(context).size.height - AppBar().preferredSize.height) / 2;
Widget _buildFilmDescriptionPage() {
return Hero(
tag: '$name',
child: Container(
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: ExactAssetImage(image),
fit: BoxFit.cover,
alignment: Alignment.topCenter),
),
child: _buildFilmDescriptionCard()
),
);
}
ListView _buildFilmDescriptionCard() {
return ListView(
children: <Widget>[
Card(
elevation: 5,
clipBehavior: Clip.hardEdge,
margin: EdgeInsets.only(top: _screenHalf),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20)
)
),
child: Column(
children: <Widget>[
Container(
margin: const EdgeInsets.only(
top: 5, bottom: 5, left: 10, right: 10),
child: Text(
name,
style: TextStyle(
fontSize: 18,
color: Colors.black,
),
),
),
Container(
margin: const EdgeInsets.only(
top: 5, bottom: 5, left: 10, right: 10),
child: Text(
date,
style: TextStyle(
fontSize: 14,
color: Colors.black,
),
),
),
Container(
margin: const EdgeInsets.only(
top: 5, bottom: 5, left: 10, right: 10),
child: Text(
description,
style: TextStyle(
fontSize: 14,
color: Colors.black,
),
),
),
],
),
),
],
);
}
I want set minimal height to screen bottom for my film decription card, and resizing and sroll it when description is big.我想为我的电影描述卡设置屏幕底部的最小高度,并在描述很大时调整大小并滚动它。 I try to do like this, but when discription is small, card getting smaller and seems so bad.
我尝试这样做,但是当描述很小时,卡片变得越来越小并且看起来很糟糕。
_screenHalf = (MediaQuery.of(context).size.height - AppBar().preferredSize.height) / 2;
Widget _buildFilmDescriptionPage() {
return Hero(
tag: '$name',
child: Container(
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: ExactAssetImage(image),
fit: BoxFit.cover,
alignment: Alignment.topCenter),
),
child: _buildFilmDescriptionCard()
),
);
}
ListView _buildFilmDescriptionCard() {
return ListView(
children: <Widget>[
Card(
elevation: 5,
clipBehavior: Clip.hardEdge,
margin: EdgeInsets.only(top: _screenHalf),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20)
)
),
child: Column(
children: <Widget>[
Container(
margin: const EdgeInsets.only(
top: 5, bottom: 5, left: 10, right: 10),
child: Text(
name,
style: TextStyle(
fontSize: 18,
color: Colors.black,
),
),
),
Container(
margin: const EdgeInsets.only(
top: 5, bottom: 5, left: 10, right: 10),
child: Text(
date,
style: TextStyle(
fontSize: 14,
color: Colors.black,
),
),
),
Container(
margin: const EdgeInsets.only(
top: 5, bottom: 5, left: 10, right: 10),
child: Text(
description,
style: TextStyle(
fontSize: 14,
color: Colors.black,
),
),
),
],
),
),
],
);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.